diff --git a/lib/lib.d.ts b/lib/lib.d.ts index 6a4e8ec52160c..706da90817441 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -166,14 +166,14 @@ interface ObjectConstructor { * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null */ - create(o: T): T; + create(o: T): T; /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null * @param properties JavaScript object that contains one or more property descriptors. */ - create(o: any, properties: PropertyDescriptorMap): any; + create(o: object | null, properties: PropertyDescriptorMap): any; /** * Adds a property to an object, or modifies attributes of an existing property. diff --git a/lib/lib.es2015.collection.d.ts b/lib/lib.es2015.collection.d.ts index 9f4a23f32544d..bf36745dcf9bb 100644 --- a/lib/lib.es2015.collection.d.ts +++ b/lib/lib.es2015.collection.d.ts @@ -24,7 +24,7 @@ interface Map { forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; get(key: K): V | undefined; has(key: K): boolean; - set(key: K, value?: V): this; + set(key: K, value: V): this; readonly size: number; } @@ -42,16 +42,16 @@ interface ReadonlyMap { readonly size: number; } -interface WeakMap { +interface WeakMap { delete(key: K): boolean; get(key: K): V | undefined; has(key: K): boolean; - set(key: K, value?: V): this; + set(key: K, value: V): this; } interface WeakMapConstructor { new (): WeakMap; - new (entries?: [K, V][]): WeakMap; + new (entries?: [K, V][]): WeakMap; readonly prototype: WeakMap; } declare var WeakMap: WeakMapConstructor; diff --git a/lib/lib.es2015.core.d.ts b/lib/lib.es2015.core.d.ts index 7f03aaec04d02..ae633957cd53b 100644 --- a/lib/lib.es2015.core.d.ts +++ b/lib/lib.es2015.core.d.ts @@ -345,7 +345,7 @@ interface ObjectConstructor { * @param o The object to change its prototype. * @param proto The value of the new prototype or null. */ - setPrototypeOf(o: any, proto: any): any; + setPrototypeOf(o: any, proto: object | null): any; /** * Gets the own property descriptor of the specified object. diff --git a/lib/lib.es2015.iterable.d.ts b/lib/lib.es2015.iterable.d.ts index 02c72a5ee36af..3f9ffc62f3c45 100644 --- a/lib/lib.es2015.iterable.d.ts +++ b/lib/lib.es2015.iterable.d.ts @@ -119,10 +119,10 @@ interface MapConstructor { new (iterable: Iterable<[K, V]>): Map; } -interface WeakMap { } +interface WeakMap { } interface WeakMapConstructor { - new (iterable: Iterable<[K, V]>): WeakMap; + new (iterable: Iterable<[K, V]>): WeakMap; } interface Set { @@ -462,4 +462,4 @@ interface Float64ArrayConstructor { * @param thisArg Value of 'this' used to invoke the mapfn. */ from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} \ No newline at end of file +} diff --git a/lib/lib.es2015.proxy.d.ts b/lib/lib.es2015.proxy.d.ts index d935cdf9781f9..3b1d8828575bf 100644 --- a/lib/lib.es2015.proxy.d.ts +++ b/lib/lib.es2015.proxy.d.ts @@ -19,7 +19,7 @@ and limitations under the License. interface ProxyHandler { - getPrototypeOf? (target: T): {} | null; + getPrototypeOf? (target: T): object | null; setPrototypeOf? (target: T, v: any): boolean; isExtensible? (target: T): boolean; preventExtensions? (target: T): boolean; @@ -32,7 +32,7 @@ interface ProxyHandler { enumerate? (target: T): PropertyKey[]; ownKeys? (target: T): PropertyKey[]; apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, argArray: any, newTarget?: any): {}; + construct? (target: T, argArray: any, newTarget?: any): object } interface ProxyConstructor { diff --git a/lib/lib.es2015.symbol.d.ts b/lib/lib.es2015.symbol.d.ts index 3776a44670d77..f1a87d316a0a5 100644 --- a/lib/lib.es2015.symbol.d.ts +++ b/lib/lib.es2015.symbol.d.ts @@ -23,7 +23,7 @@ interface Symbol { toString(): string; /** Returns the primitive value of the specified object. */ - valueOf(): Object; + valueOf(): symbol; } interface SymbolConstructor { diff --git a/lib/lib.es2015.symbol.wellknown.d.ts b/lib/lib.es2015.symbol.wellknown.d.ts index e95f324131aad..4668862af5f90 100644 --- a/lib/lib.es2015.symbol.wellknown.d.ts +++ b/lib/lib.es2015.symbol.wellknown.d.ts @@ -130,7 +130,7 @@ interface Map { readonly [Symbol.toStringTag]: "Map"; } -interface WeakMap{ +interface WeakMap{ readonly [Symbol.toStringTag]: "WeakMap"; } @@ -344,4 +344,4 @@ interface Float32Array { */ interface Float64Array { readonly [Symbol.toStringTag]: "Float64Array"; -} \ No newline at end of file +} diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts index 2ce9151e289f5..549cfab154651 100644 --- a/lib/lib.es5.d.ts +++ b/lib/lib.es5.d.ts @@ -166,14 +166,14 @@ interface ObjectConstructor { * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null */ - create(o: T): T; + create(o: T): T; /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null * @param properties JavaScript object that contains one or more property descriptors. */ - create(o: any, properties: PropertyDescriptorMap): any; + create(o: object | null, properties: PropertyDescriptorMap): any; /** * Adds a property to an object, or modifies attributes of an existing property. diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 1c5224c0cc8e7..62d772aac48ee 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -166,14 +166,14 @@ interface ObjectConstructor { * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null */ - create(o: T): T; + create(o: T): T; /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null * @param properties JavaScript object that contains one or more property descriptors. */ - create(o: any, properties: PropertyDescriptorMap): any; + create(o: object | null, properties: PropertyDescriptorMap): any; /** * Adds a property to an object, or modifies attributes of an existing property. @@ -4523,7 +4523,7 @@ interface ObjectConstructor { * @param o The object to change its prototype. * @param proto The value of the new prototype or null. */ - setPrototypeOf(o: any, proto: any): any; + setPrototypeOf(o: any, proto: object | null): any; /** * Gets the own property descriptor of the specified object. @@ -4728,7 +4728,7 @@ interface Map { forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; get(key: K): V | undefined; has(key: K): boolean; - set(key: K, value?: V): this; + set(key: K, value: V): this; readonly size: number; } @@ -4746,16 +4746,16 @@ interface ReadonlyMap { readonly size: number; } -interface WeakMap { +interface WeakMap { delete(key: K): boolean; get(key: K): V | undefined; has(key: K): boolean; - set(key: K, value?: V): this; + set(key: K, value: V): this; } interface WeakMapConstructor { new (): WeakMap; - new (entries?: [K, V][]): WeakMap; + new (entries?: [K, V][]): WeakMap; readonly prototype: WeakMap; } declare var WeakMap: WeakMapConstructor; @@ -4911,10 +4911,10 @@ interface MapConstructor { new (iterable: Iterable<[K, V]>): Map; } -interface WeakMap { } +interface WeakMap { } interface WeakMapConstructor { - new (iterable: Iterable<[K, V]>): WeakMap; + new (iterable: Iterable<[K, V]>): WeakMap; } interface Set { @@ -5256,6 +5256,7 @@ interface Float64ArrayConstructor { from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } + /** * Represents the completion of an asynchronous operation */ @@ -5512,7 +5513,7 @@ interface PromiseConstructor { declare var Promise: PromiseConstructor; interface ProxyHandler { - getPrototypeOf? (target: T): {} | null; + getPrototypeOf? (target: T): object | null; setPrototypeOf? (target: T, v: any): boolean; isExtensible? (target: T): boolean; preventExtensions? (target: T): boolean; @@ -5525,7 +5526,7 @@ interface ProxyHandler { enumerate? (target: T): PropertyKey[]; ownKeys? (target: T): PropertyKey[]; apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, argArray: any, newTarget?: any): {}; + construct? (target: T, argArray: any, newTarget?: any): object } interface ProxyConstructor { @@ -5556,7 +5557,7 @@ interface Symbol { toString(): string; /** Returns the primitive value of the specified object. */ - valueOf(): Object; + valueOf(): symbol; } interface SymbolConstructor { @@ -5700,7 +5701,7 @@ interface Map { readonly [Symbol.toStringTag]: "Map"; } -interface WeakMap{ +interface WeakMap{ readonly [Symbol.toStringTag]: "WeakMap"; } @@ -5917,6 +5918,7 @@ interface Float64Array { } + ///////////////////////////// /// IE DOM APIs ///////////////////////////// diff --git a/lib/protocol.d.ts b/lib/protocol.d.ts index d6c0246af34c9..76c2f38338bd6 100644 --- a/lib/protocol.d.ts +++ b/lib/protocol.d.ts @@ -1798,9 +1798,10 @@ declare namespace ts.server.protocol { namespace JsxEmit { type None = "None"; type Preserve = "Preserve"; + type ReactNative = "ReactNative"; type React = "React"; } - type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React; + type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React | JsxEmit.ReactNative; namespace ModuleKind { type None = "None"; type CommonJS = "CommonJS"; @@ -1862,6 +1863,11 @@ declare namespace ts.server.protocol { isMixedContent: boolean; } + /** + * Type of objects whose values are all of the same type. + * The `in` and `for-in` operators can *not* be safely used, + * since `Object.prototype` may be modified by outside code. + */ interface MapLike { [index: string]: T; } diff --git a/lib/tsc.js b/lib/tsc.js index c1ab6d062f503..b0c9a58815c4d 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -88,32 +88,32 @@ var ts; var measures; function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } performance.mark = mark; function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; function enable() { @@ -135,19 +135,93 @@ var ts; ts.version = "2.2.0"; })(ts || (ts = {})); (function (ts) { - var createObject = Object.create; - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + function createDictionaryObject() { + var map = Object.create(null); map["__"] = undefined; delete map["__"]; + return map; + } + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -160,32 +234,27 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -199,6 +268,10 @@ var ts; return getCanonicalFileName(nonCanonicalizedPath); } ts.toPath = toPath; + function length(array) { + return array ? array.length : 0; + } + ts.length = length; function forEach(array, callback) { if (array) { for (var i = 0; i < array.length; i++) { @@ -239,6 +312,15 @@ var ts; return undefined; } ts.find = find; + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; function findMap(array, callback) { for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); @@ -460,21 +542,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -758,38 +837,46 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + function arrayFrom(iterator) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + ts.arrayFrom = arrayFrom; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } } - return false; + return undefined; + var _b; } - ts.someProperties = someProperties; - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; + ts.forEachEntry = forEachEntry; + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } } + return undefined; + var _b; } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachKey = forEachKey; + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); } - ts.appendProperty = appendProperty; + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -805,14 +892,6 @@ var ts; return t; } ts.assign = assign; - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -837,23 +916,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -880,27 +950,32 @@ var ts; return result; } ts.extend = extend; - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; function isArray(value) { return Array.isArray ? Array.isArray(value) : value instanceof Array; } @@ -1078,8 +1153,10 @@ var ts; if (b === undefined) return 1; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); return result < 0 ? -1 : result > 0 ? 1 : 0; } a = a.toUpperCase(); @@ -1461,36 +1538,26 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } var replaceWildcardCharacter = usage === "files" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther; var singleAsteriskRegexFragment = usage === "files" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther; var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; function isImplicitGlob(lastPathComponent) { return !/[.*?]/.test(lastPathComponent); } @@ -1560,6 +1627,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -1572,34 +1640,48 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } + } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -1615,14 +1697,14 @@ var ts; includeBasePaths.push(getIncludeBasePath(absolute)); } includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } }; for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -2069,32 +2151,32 @@ var ts; var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; function createWatchedFileSet() { var dirWatchers = ts.createMap(); - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -2106,16 +2188,19 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { var fileName = typeof relativeFileName !== "string" ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } @@ -2180,10 +2265,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -2860,6 +2945,7 @@ var ts; Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2870,6 +2956,7 @@ 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_2607", message: "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_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other 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_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -2918,6 +3005,7 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, @@ -3042,7 +3130,7 @@ var ts; Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'" }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -3057,6 +3145,7 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, @@ -3090,7 +3179,7 @@ var ts; Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'" }, File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, @@ -3224,9 +3313,10 @@ var ts; Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: {0}" }, Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, @@ -3242,7 +3332,7 @@ var ts; return token >= 70; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ + var textToToken = ts.createMapFromTemplate({ "abstract": 116, "any": 118, "as": 117, @@ -3266,7 +3356,7 @@ var ts; "false": 85, "finally": 86, "for": 87, - "from": 138, + "from": 139, "function": 88, "get": 124, "if": 89, @@ -3284,27 +3374,28 @@ var ts; "new": 93, "null": 94, "number": 132, + "object": 133, "package": 110, "private": 111, "protected": 112, "public": 113, "readonly": 130, "require": 131, - "global": 139, + "global": 140, "return": 95, - "set": 133, + "set": 134, "static": 114, - "string": 134, + "string": 135, "super": 96, "switch": 97, - "symbol": 135, + "symbol": 136, "this": 98, "throw": 99, "true": 100, "try": 101, - "type": 136, + "type": 137, "typeof": 102, - "undefined": 137, + "undefined": 138, "var": 103, "void": 104, "while": 105, @@ -3312,7 +3403,7 @@ var ts; "yield": 115, "async": 119, "await": 120, - "of": 140, + "of": 141, "{": 16, "}": 17, "(": 18, @@ -3407,9 +3498,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; - } + source.forEach(function (value, name) { + result[value] = name; + }); return result; } var tokenStrings = makeReverseMap(textToToken); @@ -3418,7 +3509,7 @@ var ts; } ts.tokenToString = tokenToString; function stringToToken(s) { - return textToToken[s]; + return textToToken.get(s); } ts.stringToToken = stringToToken; function computeLineStarts(text) { @@ -3478,7 +3569,6 @@ var ts; return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -4137,8 +4227,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= 97 && ch <= 122) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = 70; @@ -4840,25 +4933,25 @@ var ts; } ts.getFullWidth = getFullWidth; function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); } ts.hasResolvedModule = hasResolvedModule; function getResolvedModule(sourceFile, moduleNameText) { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; } ts.getResolvedModule = getResolvedModule; function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = ts.createMap(); } - sourceFile.resolvedModules[moduleNameText] = resolvedModule; + sourceFile.resolvedModules.set(moduleNameText, resolvedModule); } ts.setResolvedModule = setResolvedModule; function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { if (!sourceFile.resolvedTypeReferenceDirectiveNames) { sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap(); } - sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective); } ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; function moduleResolutionIsEqualTo(oldResolution, newResolution) { @@ -4877,7 +4970,7 @@ var ts; } for (var i = 0; i < names.length; i++) { var newResolution = newResolutions[i]; - var oldResolution = oldResolutions && oldResolutions[names[i]]; + var oldResolution = oldResolutions && oldResolutions.get(names[i]); var changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; @@ -4904,7 +4997,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 262) { + while (node && node.kind !== 263) { node = node.parent; } return node; @@ -4912,11 +5005,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 205: - case 233: - case 212: + case 206: + case 234: case 213: case 214: + case 215: return true; } return false; @@ -4981,18 +5074,18 @@ var ts; if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 293 && node._children.length > 0) { + if (node.kind === 294 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 263 && node.kind <= 289; + return node.kind >= 264 && node.kind <= 293; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 279 && node.kind <= 292; + return node.kind >= 280 && node.kind <= 293; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -5052,18 +5145,36 @@ var ts; } ts.getLiteralText = getLiteralText; function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 && text.length > 1) { + return node.kind === 8 + && (getNumericLiteralFlags(text, 6) & 6) !== 0; + } + ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; + function getNumericLiteralFlags(text, hint) { + if (text.length > 1) { switch (text.charCodeAt(1)) { case 98: case 66: + return 2; case 111: case 79: - return true; + return 4; + case 120: + case 88: + return 1; + } + if (hint & 8) { + for (var i = text.length - 1; i >= 0; i--) { + switch (text.charCodeAt(i)) { + case 101: + case 69: + return 8; + } + } } } - return false; + return 0; } - ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; + ts.getNumericLiteralFlags = getNumericLiteralFlags; function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; } @@ -5086,11 +5197,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 224 && node.parent.kind === 257; + return node.kind === 225 && node.parent.kind === 258; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 231 && + return node && node.kind === 232 && (node.name.kind === 9 || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -5099,11 +5210,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return node.kind === 231 && (!node.body); + return node && node.kind === 232 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 262 || - node.kind === 231 || + return node.kind === 263 || + node.kind === 232 || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -5116,9 +5227,9 @@ var ts; return false; } switch (node.parent.kind) { - case 262: + case 263: return ts.isExternalModule(node.parent); - case 232: + case 233: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -5130,22 +5241,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 262: - case 233: - case 257: - case 231: - case 212: + case 263: + case 234: + case 258: + case 232: case 213: case 214: - case 150: - case 149: + case 215: case 151: + case 150: case 152: - case 226: - case 184: + case 153: + case 227: case 185: + case 186: return true; - case 205: + case 206: return parentNode && !isFunctionLike(parentNode); } return false; @@ -5172,7 +5283,7 @@ var ts; case 9: case 8: return name.text; - case 142: + case 143: if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } @@ -5184,9 +5295,9 @@ var ts; switch (name.kind) { case 70: return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name); - case 141: + case 142: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 177: + case 178: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -5223,7 +5334,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 205) { + if (node.body && node.body.kind === 206) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -5235,29 +5346,29 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 262: + case 263: 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 224: - case 174: - case 227: - case 197: + case 225: + case 175: case 228: + case 198: + case 229: + case 232: case 231: - case 230: - case 261: - case 226: - case 184: - case 149: - case 151: + case 262: + case 227: + case 185: + case 150: case 152: - case 229: + case 153: + case 230: errorNode = node.name; break; - case 185: + case 186: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -5278,7 +5389,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 230 && isConst(node); + return node.kind === 231 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -5291,11 +5402,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 179 && n.expression.kind === 96; + return n.kind === 180 && n.expression.kind === 96; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 208 + return node.kind === 209 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; @@ -5308,10 +5419,10 @@ var ts; } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 144 || - node.kind === 143 || - node.kind === 184 || - node.kind === 185) ? + var commentRanges = (node.kind === 145 || + node.kind === 144 || + node.kind === 185 || + node.kind === 186) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, function (comment) { @@ -5325,69 +5436,69 @@ var ts; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (156 <= node.kind && node.kind <= 171) { + if (157 <= node.kind && node.kind <= 172) { return true; } switch (node.kind) { case 118: case 132: - case 134: - case 121: case 135: - case 137: + case 121: + case 136: + case 138: case 129: return true; case 104: - return node.parent.kind !== 188; - case 199: + return node.parent.kind !== 189; + case 200: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 70: - if (node.parent.kind === 141 && node.parent.right === node) { + if (node.parent.kind === 142 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 177 && node.parent.name === node) { + else if (node.parent.kind === 178 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 70 || node.kind === 141 || node.kind === 177, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 141: - case 177: + ts.Debug.assert(node.kind === 70 || node.kind === 142 || node.kind === 178, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 142: + case 178: case 98: - var parent_1 = node.parent; - if (parent_1.kind === 160) { + var parent = node.parent; + if (parent.kind === 161) { return false; } - if (156 <= parent_1.kind && parent_1.kind <= 171) { + if (157 <= parent.kind && parent.kind <= 172) { return true; } - switch (parent_1.kind) { - case 199: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 143: - return node === parent_1.constraint; - case 147: - case 146: + switch (parent.kind) { + case 200: + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 144: - case 224: - return node === parent_1.type; - case 226: - case 184: + return node === parent.constraint; + case 148: + case 147: + case 145: + case 225: + return node === parent.type; + case 227: case 185: + case 186: + case 151: case 150: case 149: - case 148: - case 151: case 152: - return node === parent_1.type; case 153: + return node === parent.type; case 154: case 155: - return node === parent_1.type; - case 182: - return node === parent_1.type; - case 179: + case 156: + return node === parent.type; + case 183: + return node === parent.type; case 180: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; case 181: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 182: return false; } } @@ -5405,30 +5516,30 @@ var ts; } ts.isChildOfNodeWithKind = isChildOfNodeWithKind; function isPrefixUnaryExpression(node) { - return node.kind === 190; + return node.kind === 191; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 217: + case 218: return visitor(node); - case 233: - case 205: - case 209: + case 234: + case 206: case 210: case 211: case 212: case 213: case 214: - case 218: + case 215: case 219: - case 254: - case 255: case 220: - case 222: - case 257: + case 255: + case 256: + case 221: + case 223: + case 258: return ts.forEachChild(node, traverse); } } @@ -5438,24 +5549,24 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 195: + case 196: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 230: - case 228: case 231: case 229: - case 227: - case 197: + case 232: + case 230: + case 228: + case 198: return; default: if (isFunctionLike(node)) { - var name_5 = node.name; - if (name_5 && name_5.kind === 142) { - traverse(name_5.expression); + var name = node.name; + if (name && name.kind === 143) { + traverse(name.expression); return; } } @@ -5467,10 +5578,10 @@ var ts; } ts.forEachYieldExpression = forEachYieldExpression; function getRestParameterElementType(node) { - if (node && node.kind === 162) { + if (node && node.kind === 163) { return node.elementType; } - else if (node && node.kind === 157) { + else if (node && node.kind === 158) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -5481,14 +5592,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 174: - case 261: - case 144: - case 258: - case 147: - case 146: + case 175: + case 262: + case 145: case 259: - case 224: + case 148: + case 147: + case 260: + case 225: return true; } } @@ -5496,11 +5607,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 151 || node.kind === 152); + return node && (node.kind === 152 || node.kind === 153); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 227 || node.kind === 197); + return node && (node.kind === 228 || node.kind === 198); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -5509,19 +5620,19 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 150: - case 184: - case 226: + case 151: case 185: + case 227: + case 186: + case 150: case 149: - case 148: - case 151: case 152: case 153: case 154: case 155: - case 158: + case 156: case 159: + case 160: return true; } return false; @@ -5529,13 +5640,13 @@ var ts; ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 226: - case 184: + case 153: + case 227: + case 185: return true; } return false; @@ -5543,13 +5654,13 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 212: case 213: case 214: - case 210: + case 215: case 211: + case 212: return true; - case 220: + case 221: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -5560,7 +5671,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 220) { + if (node.statement.kind !== 221) { return node.statement; } node = node.statement; @@ -5568,17 +5679,17 @@ var ts; } ts.unwrapInnermostStatmentOfLabel = unwrapInnermostStatmentOfLabel; function isFunctionBlock(node) { - return node && node.kind === 205 && isFunctionLike(node.parent); + return node && node.kind === 206 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 149 && node.parent.kind === 176; + return node && node.kind === 150 && node.parent.kind === 177; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { - return node.kind === 149 && - (node.parent.kind === 176 || - node.parent.kind === 197); + return node.kind === 150 && + (node.parent.kind === 177 || + node.parent.kind === 198); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -5614,39 +5725,39 @@ var ts; return undefined; } switch (node.kind) { - case 142: + case 143: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 185: + case 186: if (!includeArrowFunctions) { continue; } - case 226: - case 184: - case 231: - case 147: - case 146: - case 149: + case 227: + case 185: + case 232: case 148: + case 147: case 150: + case 149: case 151: case 152: case 153: case 154: case 155: - case 230: - case 262: + case 156: + case 231: + case 263: return node; } } @@ -5656,9 +5767,9 @@ var ts; var container = getThisContainer(node, false); if (container) { switch (container.kind) { - case 150: - case 226: - case 184: + case 151: + case 227: + case 185: return container; } } @@ -5672,25 +5783,25 @@ var ts; return node; } switch (node.kind) { - case 142: + case 143: node = node.parent; break; - case 226: - case 184: + case 227: case 185: + case 186: if (!stopOnFunctions) { continue; } - case 147: - case 146: - case 149: case 148: + case 147: case 150: + case 149: case 151: case 152: + case 153: return node; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { @@ -5702,36 +5813,36 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 184 || func.kind === 185) { + if (func.kind === 185 || func.kind === 186) { var prev = func; - var parent_2 = func.parent; - while (parent_2.kind === 183) { - prev = parent_2; - parent_2 = parent_2.parent; + var parent = func.parent; + while (parent.kind === 184) { + prev = parent; + parent = parent.parent; } - if (parent_2.kind === 179 && parent_2.expression === prev) { - return parent_2; + if (parent.kind === 180 && parent.expression === prev) { + return parent; } } } ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; function isSuperProperty(node) { var kind = node.kind; - return (kind === 177 || kind === 178) + return (kind === 178 || kind === 179) && node.expression.kind === 96; } ts.isSuperProperty = isSuperProperty; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 157: - case 273: + case 158: + case 274: return node.typeName; - case 199: + case 200: return isEntityNameExpression(node.expression) ? node.expression : undefined; case 70: - case 141: + case 142: return node; } return undefined; @@ -5739,10 +5850,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function isCallLikeExpression(node) { switch (node.kind) { - case 179: case 180: case 181: - case 145: + case 182: + case 146: return true; default: return false; @@ -5750,7 +5861,7 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function getInvokedExpression(node) { - if (node.kind === 181) { + if (node.kind === 182) { return node.tag; } return node.expression; @@ -5758,21 +5869,21 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 227: + case 228: return true; - case 147: - return node.parent.kind === 227; - case 151: + case 148: + return node.parent.kind === 228; case 152: - case 149: + case 153: + case 150: return node.body !== undefined - && node.parent.kind === 227; - case 144: + && node.parent.kind === 228; + case 145: return node.parent.body !== undefined - && (node.parent.kind === 150 - || node.parent.kind === 149 - || node.parent.kind === 152) - && node.parent.parent.kind === 227; + && (node.parent.kind === 151 + || node.parent.kind === 150 + || node.parent.kind === 153) + && node.parent.parent.kind === 228; } return false; } @@ -5788,19 +5899,19 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 227: + case 228: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 149: - case 152: + case 150: + case 153: return ts.forEach(node.parameters, nodeIsDecorated); } } ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 249 || - parent.kind === 248 || - parent.kind === 250) { + if (parent.kind === 250 || + parent.kind === 249 || + parent.kind === 251) { return parent.tagName === node; } return false; @@ -5814,96 +5925,96 @@ var ts; case 100: case 85: case 11: - case 175: case 176: case 177: case 178: case 179: case 180: case 181: - case 200: case 182: case 201: case 183: + case 202: case 184: - case 197: case 185: - case 188: + case 198: case 186: + case 189: case 187: - case 190: + case 188: case 191: case 192: case 193: - case 196: case 194: + case 197: + case 195: case 12: - case 198: - case 247: + case 199: case 248: - case 195: - case 189: - case 202: + case 249: + case 196: + case 190: + case 203: return true; - case 141: - while (node.parent.kind === 141) { + case 142: + while (node.parent.kind === 142) { node = node.parent; } - return node.parent.kind === 160 || isJSXTagName(node); + return node.parent.kind === 161 || isJSXTagName(node); case 70: - if (node.parent.kind === 160 || isJSXTagName(node)) { + if (node.parent.kind === 161 || isJSXTagName(node)) { return true; } case 8: case 9: case 98: - var parent_3 = node.parent; - switch (parent_3.kind) { - case 224: - case 144: + var parent = node.parent; + switch (parent.kind) { + case 225: + case 145: + case 148: case 147: - case 146: - case 261: - case 258: - case 174: - return parent_3.initializer === node; - case 208: + case 262: + case 259: + case 175: + return parent.initializer === node; case 209: case 210: case 211: - case 217: + case 212: case 218: case 219: - case 254: - case 221: - case 219: - return parent_3.expression === node; - case 212: - var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 225) || + case 220: + case 255: + case 222: + case 220: + return parent.expression === node; + case 213: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 226) || forStatement.condition === node || forStatement.incrementor === node; - case 213: case 214: - var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 225) || + case 215: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 226) || forInStatement.expression === node; - case 182: - case 200: - return node === parent_3.expression; - case 203: - return node === parent_3.expression; - case 142: - return node === parent_3.expression; - case 145: + case 183: + case 201: + return node === parent.expression; + case 204: + return node === parent.expression; + case 143: + return node === parent.expression; + case 146: + case 254: case 253: - case 252: - case 260: + case 261: return true; - case 199: - return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); + case 200: + return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: - if (isPartOfExpression(parent_3)) { + if (isPartOfExpression(parent)) { return true; } } @@ -5918,7 +6029,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 235 && node.moduleReference.kind === 246; + return node.kind === 236 && node.moduleReference.kind === 247; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5927,7 +6038,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 235 && node.moduleReference.kind !== 246; + return node.kind === 236 && node.moduleReference.kind !== 247; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -5939,7 +6050,7 @@ var ts; } ts.isInJavaScriptFile = isInJavaScriptFile; function isRequireCall(expression, checkArgumentIsStringLiteral) { - var isRequire = expression.kind === 179 && + var isRequire = expression.kind === 180 && expression.expression.kind === 70 && expression.expression.text === "require" && expression.arguments.length === 1; @@ -5951,9 +6062,9 @@ var ts; } ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 224) { + if (s.valueDeclaration && s.valueDeclaration.kind === 225) { var declaration = s.valueDeclaration; - return declaration.initializer && declaration.initializer.kind === 184; + return declaration.initializer && declaration.initializer.kind === 185; } return false; } @@ -5962,11 +6073,11 @@ var ts; if (!isInJavaScriptFile(expression)) { return 0; } - if (expression.kind !== 192) { + if (expression.kind !== 193) { return 0; } var expr = expression; - if (expr.operatorToken.kind !== 57 || expr.left.kind !== 177) { + if (expr.operatorToken.kind !== 57 || expr.left.kind !== 178) { return 0; } var lhs = expr.left; @@ -5982,7 +6093,7 @@ var ts; else if (lhs.expression.kind === 98) { return 4; } - else if (lhs.expression.kind === 177) { + else if (lhs.expression.kind === 178) { var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 70) { var innerPropertyAccessIdentifier = innerPropertyAccess.expression; @@ -5998,35 +6109,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 236) { + if (node.kind === 237) { return node.moduleSpecifier; } - if (node.kind === 235) { + if (node.kind === 236) { var reference = node.moduleReference; - if (reference.kind === 246) { + if (reference.kind === 247) { return reference.expression; } } - if (node.kind === 242) { + if (node.kind === 243) { return node.moduleSpecifier; } - if (node.kind === 231 && node.name.kind === 9) { + if (node.kind === 232 && node.name.kind === 9) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 235) { + if (node.kind === 236) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 238) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 239) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 236 + return node.kind === 237 && node.importClause && !!node.importClause.name; } @@ -6034,13 +6145,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 144: + case 145: + case 150: case 149: - case 148: + case 260: case 259: - case 258: + case 148: case 147: - case 146: return node.questionToken !== undefined; } } @@ -6048,9 +6159,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 275 && + return node.kind === 276 && node.parameters.length > 0 && - node.parameters[0].type.kind === 277; + node.parameters[0].type.kind === 278; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { @@ -6063,7 +6174,7 @@ var ts; var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 282) { + if (doc.kind === 283) { if (doc.kind === kind) { result.push(doc); } @@ -6089,9 +6200,9 @@ var ts; var parent = node.parent; var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 206; + parent.parent.parent.kind === 207; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 206; + parent.parent.kind === 207; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -6099,19 +6210,19 @@ var ts; getJSDocsWorker(variableStatementNode); } var isSourceOfAssignmentExpressionStatement = parent && parent.parent && - parent.kind === 192 && + parent.kind === 193 && parent.operatorToken.kind === 57 && - parent.parent.kind === 208; + parent.parent.kind === 209; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 231 && - parent && parent.kind === 231; - var isPropertyAssignmentExpression = parent && parent.kind === 258; + var isModuleDeclaration = node.kind === 232 && + parent && parent.kind === 232; + var isPropertyAssignmentExpression = parent && parent.kind === 259; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } - if (node.kind === 144) { + if (node.kind === 145) { cache = ts.concatenate(cache, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { @@ -6125,17 +6236,17 @@ var ts; return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 282); + var tags = getJSDocTags(func, 283); if (!param.name) { var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 282; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 283; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70) { - var name_6 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 282 && tag.parameterName.text === name_6; }); + var name_1 = param.name.text; + return ts.filter(tags, function (tag) { return tag.kind === 283 && tag.parameterName.text === name_1; }); } else { return undefined; @@ -6143,8 +6254,8 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 284); - if (!tag && node.kind === 144) { + var tag = getFirstJSDocTag(node, 285); + if (!tag && node.kind === 145) { var paramTags = getJSDocParameterTags(node); if (paramTags) { tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); @@ -6154,15 +6265,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 281); + return getFirstJSDocTag(node, 282); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 283); + return getFirstJSDocTag(node, 284); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 285); + return getFirstJSDocTag(node, 286); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -6175,8 +6286,8 @@ var ts; ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { if (node && (node.flags & 65536)) { - if (node.type && node.type.kind === 276 || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 276; })) { + if (node.type && node.type.kind === 277 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 277; })) { return true; } } @@ -6191,28 +6302,33 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 192: + case 193: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 57 ? 1 : 2 : 0; - case 190: case 191: + case 192: var unaryOperator = parent.operator; return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0; - case 213: case 214: + case 215: return parent.initializer === node ? 1 : 0; - case 183: - case 175: - case 196: + case 184: + case 176: + case 197: node = parent; break; - case 259: + case 260: if (parent.name !== node) { return 0; } - case 258: + node = parent.parent; + break; + case 259: + if (parent.name === node) { + return 0; + } node = parent.parent; break; default: @@ -6227,14 +6343,14 @@ var ts; } ts.isAssignmentTarget = isAssignmentTarget; function isDeleteTarget(node) { - if (node.kind !== 177 && node.kind !== 178) { + if (node.kind !== 178 && node.kind !== 179) { return false; } node = node.parent; - while (node && node.kind === 183) { + while (node && node.kind === 184) { node = node.parent; } - return node && node.kind === 186; + return node && node.kind === 187; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -6248,7 +6364,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2) || (node.kind === 262 && node.isDeclarationFile)) { + if (hasModifier(node, 2) || (node.kind === 263 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -6261,7 +6377,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 240 || parent.kind === 244) { + if (parent.kind === 241 || parent.kind === 245) { if (parent.propertyName) { return true; } @@ -6274,48 +6390,48 @@ var ts; ts.isDeclarationName = isDeclarationName; function isLiteralComputedPropertyDeclarationName(node) { return (node.kind === 9 || node.kind === 8) && - node.parent.kind === 142 && + node.parent.kind === 143 && isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { + case 148: case 147: - case 146: + case 150: case 149: - case 148: - case 151: case 152: - case 261: - case 258: - case 177: + case 153: + case 262: + case 259: + case 178: return parent.name === node; - case 141: + case 142: if (parent.right === node) { - while (parent.kind === 141) { + while (parent.kind === 142) { parent = parent.parent; } - return parent.kind === 160; + return parent.kind === 161; } return false; - case 174: - case 240: + case 175: + case 241: return parent.propertyName === node; - case 244: + case 245: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 235 || - node.kind === 234 || - node.kind === 237 && !!node.name || - node.kind === 238 || - node.kind === 240 || - node.kind === 244 || - node.kind === 241 && exportAssignmentIsAlias(node); + return node.kind === 236 || + node.kind === 235 || + node.kind === 238 && !!node.name || + node.kind === 239 || + node.kind === 241 || + node.kind === 245 || + node.kind === 242 && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -6401,7 +6517,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 71 <= token && token <= 140; + return 71 <= token && token <= 141; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -6423,7 +6539,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 142 && + return name.kind === 143 && !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } @@ -6433,10 +6549,10 @@ var ts; } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 144) { + if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 145) { return name.text; } - if (name.kind === 142) { + if (name.kind === 143) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -6481,11 +6597,11 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 144; + return root.kind === 145; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 174) { + while (node.kind === 175) { node = node.parent.parent; } return node; @@ -6493,15 +6609,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 150 - || kind === 184 - || kind === 226 + return kind === 151 || kind === 185 - || kind === 149 - || kind === 151 + || kind === 227 + || kind === 186 + || kind === 150 || kind === 152 - || kind === 231 - || kind === 262; + || kind === 153 + || kind === 232 + || kind === 263; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -6552,23 +6668,23 @@ var ts; ts.getOriginalNodeId = getOriginalNodeId; function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 180: + case 181: return hasArguments ? 0 : 1; - case 190: - case 187: + case 191: case 188: - case 186: case 189: - case 193: - case 195: + case 187: + case 190: + case 194: + case 196: return 1; - case 192: + case 193: switch (operator) { case 39: case 57: @@ -6592,15 +6708,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 192) { + if (expression.kind === 193) { return expression.operatorToken.kind; } - else if (expression.kind === 190 || expression.kind === 191) { + else if (expression.kind === 191 || expression.kind === 192) { return expression.operator; } else { @@ -6618,36 +6734,36 @@ var ts; case 85: case 8: case 9: - case 175: case 176: - case 184: + case 177: case 185: - case 197: - case 247: + case 186: + case 198: case 248: + case 249: case 11: case 12: - case 194: - case 183: - case 198: + case 195: + case 184: + case 199: return 19; - case 181: - case 177: + case 182: case 178: + case 179: return 18; - case 180: + case 181: return hasArguments ? 18 : 17; - case 179: + case 180: return 17; - case 191: + case 192: return 16; - case 190: - case 187: + case 191: case 188: - case 186: case 189: + case 187: + case 190: return 15; - case 192: + case 193: switch (operatorKind) { case 50: case 51: @@ -6705,11 +6821,11 @@ var ts; default: return -1; } - case 193: + case 194: return 4; - case 195: - return 2; case 196: + return 2; + case 197: return 1; default: return -1; @@ -6732,21 +6848,15 @@ var ts; return modificationCount; } function reattachFileDiagnostics(newFile) { - if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { - return; - } - for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { - var diagnostic = _a[_i]; - diagnostic.file = newFile; - } + ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } function add(diagnostic) { var diagnostics; if (diagnostic.file) { - diagnostics = fileDiagnostics[diagnostic.file.fileName]; + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); if (!diagnostics) { diagnostics = []; - fileDiagnostics[diagnostic.file.fileName] = diagnostics; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); } } else { @@ -6763,16 +6873,16 @@ var ts; function getDiagnostics(fileName) { sortAndDeduplicate(); if (fileName) { - return fileDiagnostics[fileName] || []; + return fileDiagnostics.get(fileName) || []; } var allDiagnostics = []; function pushDiagnostic(d) { allDiagnostics.push(d); } ts.forEach(nonFileDiagnostics, pushDiagnostic); - for (var key in fileDiagnostics) { - ts.forEach(fileDiagnostics[key], pushDiagnostic); - } + fileDiagnostics.forEach(function (diagnostics) { + ts.forEach(diagnostics, pushDiagnostic); + }); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function sortAndDeduplicate() { @@ -6781,14 +6891,14 @@ var ts; } diagnosticsModified = false; nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (var key in fileDiagnostics) { - fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); - } + fileDiagnostics.forEach(function (diagnostics, key) { + fileDiagnostics.set(key, ts.sortAndDeduplicateDiagnostics(diagnostics)); + }); } } ts.createDiagnosticCollection = createDiagnosticCollection; var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = ts.createMap({ + var escapedCharsMap = ts.createMapFromTemplate({ "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -6807,7 +6917,7 @@ var ts; } ts.escapeString = escapeString; function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); @@ -6951,129 +7061,62 @@ var ts; ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; function getSourceFilesToEmit(host, targetSourceFile) { var options = host.getCompilerOptions(); + var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); }; if (options.outFile || options.out) { var moduleKind = ts.getEmitModuleKind(options); - var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; - var sourceFiles = getAllEmittableSourceFiles(); - return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule); + var moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; + return ts.filter(host.getSourceFiles(), function (sourceFile) { + return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); + }); } else { - var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile]; - return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); }); - } - function getAllEmittableSourceFiles() { - return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles(); + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); }); } } ts.getSourceFilesToEmit = getSourceFilesToEmit; - function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) { - return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); }); - } - ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory; - function isNonDeclarationFile(sourceFile) { - return !isDeclarationFile(sourceFile); - } - function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) { - return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); + function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) { + return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !isDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); } - function isBundleEmitNonExternalModule(sourceFile) { - return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile); - } - function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) { + ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted; + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { + var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); var options = host.getCompilerOptions(); if (options.outFile || options.out) { - onBundledEmit(sourceFiles); + if (sourceFiles.length) { + var jsFilePath = options.outFile || options.out; + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFiles, true, emitOnlyDtsFiles); + } } else { for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { var sourceFile = sourceFiles_2[_i]; - if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { - onSingleFileEmit(host, sourceFile); - } - } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], false); - } - function onBundledEmit(sourceFiles) { - if (sourceFiles.length) { - var jsFilePath = options.outFile || options.out; + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, true); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, [sourceFile], false, emitOnlyDtsFiles); } } } - ts.forEachTransformedEmitFile = forEachTransformedEmitFile; + ts.forEachEmittedFile = forEachEmittedFile; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) { - var options = host.getCompilerOptions(); - if (options.outFile || options.out) { - onBundledEmit(host); - } - else { - var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile]; - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; - if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) { - onSingleFileEmit(host, sourceFile); + function getOutputExtension(sourceFile, options) { + if (options.jsx === 1) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + return ".jsx"; } } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: declarationFilePath - }; - action(emitFileNames, [sourceFile], false, emitOnlyDtsFiles); - } - function onBundledEmit(host) { - var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) && - !host.isSourceFileFromExternalLibrary(sourceFile) && - (!ts.isExternalModule(sourceFile) || - !!ts.getEmitModuleKind(options)); }); - if (bundledSources.length) { - var jsFilePath = options.outFile || options.out; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined - }; - action(emitFileNames, bundledSources, true, emitOnlyDtsFiles); + else if (sourceFile.languageVariant === 1) { + return ".jsx"; } } + return ".js"; } - ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); var commonSourceDirectory = host.getCommonSourceDirectory(); @@ -7098,7 +7141,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 150 && nodeIsPresent(member.body)) { + if (member.kind === 151 && nodeIsPresent(member.body)) { return member; } }); @@ -7139,10 +7182,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 151) { + if (accessor.kind === 152) { getAccessor = accessor; } - else if (accessor.kind === 152) { + else if (accessor.kind === 153) { setAccessor = accessor; } else { @@ -7151,7 +7194,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 151 || member.kind === 152) + if ((member.kind === 152 || member.kind === 153) && hasModifier(member, 32) === hasModifier(accessor, 32)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -7162,10 +7205,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 151 && !getAccessor) { + if (member.kind === 152 && !getAccessor) { getAccessor = member; } - if (member.kind === 152 && !setAccessor) { + if (member.kind === 153 && !setAccessor) { setAccessor = member; } } @@ -7383,7 +7426,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 199 && + if (node.kind === 200 && node.parent.token === 84 && isClassLike(node.parent.parent)) { return node.parent.parent; @@ -7401,8 +7444,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, true)) { var kind = node.left.kind; - return kind === 176 - || kind === 175; + return kind === 177 + || kind === 176; } return false; } @@ -7428,29 +7471,33 @@ var ts; ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isEntityNameExpression(node) { return node.kind === 70 || - node.kind === 177 && isEntityNameExpression(node.expression); + node.kind === 178 && isEntityNameExpression(node.expression); } ts.isEntityNameExpression = isEntityNameExpression; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 141 && node.parent.right === node) || - (node.parent.kind === 177 && node.parent.name === node); + return (node.parent.kind === 142 && node.parent.right === node) || + (node.parent.kind === 178 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 176) { + if (kind === 177) { return expression.properties.length === 0; } - if (kind === 175) { + if (kind === 176) { return expression.elements.length === 0; } return false; } ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512) ? symbol.valueDeclaration.localSymbol : undefined; + return isExportDefaultSymbol(symbol) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function isExportDefaultSymbol(symbol) { + return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512); + } + ts.isExportDefaultSymbol = isExportDefaultSymbol; function tryExtractTypeScriptExtension(fileName) { return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); } @@ -7542,39 +7589,39 @@ var ts; || kind === 94) { return true; } - else if (kind === 177) { + else if (kind === 178) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 178) { + else if (kind === 179) { return isSimpleExpressionWorker(node.expression, depth + 1) && isSimpleExpressionWorker(node.argumentExpression, depth + 1); } - else if (kind === 190 - || kind === 191) { + else if (kind === 191 + || kind === 192) { return isSimpleExpressionWorker(node.operand, depth + 1); } - else if (kind === 192) { + else if (kind === 193) { return node.operatorToken.kind !== 39 && isSimpleExpressionWorker(node.left, depth + 1) && isSimpleExpressionWorker(node.right, depth + 1); } - else if (kind === 193) { + else if (kind === 194) { return isSimpleExpressionWorker(node.condition, depth + 1) && isSimpleExpressionWorker(node.whenTrue, depth + 1) && isSimpleExpressionWorker(node.whenFalse, depth + 1); } - else if (kind === 188 - || kind === 187 - || kind === 186) { + else if (kind === 189 + || kind === 188 + || kind === 187) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 175) { + else if (kind === 176) { return node.elements.length === 0; } - else if (kind === 176) { + else if (kind === 177) { return node.properties.length === 0; } - else if (kind === 179) { + else if (kind === 180) { if (!isSimpleExpressionWorker(node.expression, depth + 1)) { return false; } @@ -7589,16 +7636,19 @@ var ts; } return false; } - var syntaxKindCache = ts.createMap(); + var syntaxKindCache = []; function formatSyntaxKind(kind) { var syntaxKindEnum = ts.SyntaxKind; if (syntaxKindEnum) { - if (syntaxKindCache[kind]) { - return syntaxKindCache[kind]; + var cached = syntaxKindCache[kind]; + if (cached !== undefined) { + return cached; } - for (var name_7 in syntaxKindEnum) { - if (syntaxKindEnum[name_7] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name_7 + ")"; + for (var name in syntaxKindEnum) { + if (syntaxKindEnum[name] === kind) { + var result = kind + " (" + name + ")"; + syntaxKindCache[kind] = result; + return result; } } } @@ -7684,8 +7734,8 @@ var ts; var parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 230: case 231: + case 232: return parseNode === parseNode.parent.name; } } @@ -7703,7 +7753,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 && declaration !== node) { + if (declaration.kind === 228 && declaration !== node) { return true; } } @@ -7755,7 +7805,7 @@ var ts; } ts.isIdentifier = isIdentifier; function isVoidExpression(node) { - return node.kind === 188; + return node.kind === 189; } ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { @@ -7767,16 +7817,16 @@ var ts; } ts.isModifier = isModifier; function isQualifiedName(node) { - return node.kind === 141; + return node.kind === 142; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 142; + return node.kind === 143; } ts.isComputedPropertyName = isComputedPropertyName; function isEntityName(node) { var kind = node.kind; - return kind === 141 + return kind === 142 || kind === 70; } ts.isEntityName = isEntityName; @@ -7785,7 +7835,7 @@ var ts; return kind === 70 || kind === 9 || kind === 8 - || kind === 142; + || kind === 143; } ts.isPropertyName = isPropertyName; function isModuleName(node) { @@ -7797,101 +7847,101 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 70 - || kind === 172 - || kind === 173; + || kind === 173 + || kind === 174; } ts.isBindingName = isBindingName; function isTypeParameter(node) { - return node.kind === 143; + return node.kind === 144; } ts.isTypeParameter = isTypeParameter; function isParameter(node) { - return node.kind === 144; + return node.kind === 145; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 145; + return node.kind === 146; } ts.isDecorator = isDecorator; function isMethodDeclaration(node) { - return node.kind === 149; + return node.kind === 150; } ts.isMethodDeclaration = isMethodDeclaration; function isClassElement(node) { var kind = node.kind; - return kind === 150 - || kind === 147 - || kind === 149 - || kind === 151 + return kind === 151 + || kind === 148 + || kind === 150 || kind === 152 - || kind === 155 - || kind === 204; + || kind === 153 + || kind === 156 + || kind === 205; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 258 - || kind === 259 + return kind === 259 || kind === 260 - || kind === 149 - || kind === 151 + || kind === 261 + || kind === 150 || kind === 152 - || kind === 245; + || kind === 153 + || kind === 246; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNodeKind(kind) { - return (kind >= 156 && kind <= 171) + return (kind >= 157 && kind <= 172) || kind === 118 || kind === 132 || kind === 121 - || kind === 134 || kind === 135 + || kind === 136 || kind === 104 || kind === 129 - || kind === 199; + || kind === 200; } function isTypeNode(node) { return isTypeNodeKind(node.kind); } ts.isTypeNode = isTypeNode; function isArrayBindingPattern(node) { - return node.kind === 173; + return node.kind === 174; } ts.isArrayBindingPattern = isArrayBindingPattern; function isObjectBindingPattern(node) { - return node.kind === 172; + return node.kind === 173; } ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 173 - || kind === 172; + return kind === 174 + || kind === 173; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 175 - || kind === 176; + return kind === 176 + || kind === 177; } ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { - return node.kind === 174; + return node.kind === 175; } ts.isBindingElement = isBindingElement; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 174 - || kind === 198; + return kind === 175 + || kind === 199; } ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 224: - case 144: - case 174: + case 225: + case 145: + case 175: return true; } return false; @@ -7904,8 +7954,8 @@ var ts; ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 172: - case 176: + case 173: + case 177: return true; } return false; @@ -7913,94 +7963,94 @@ var ts; ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 173: - case 175: + case 174: + case 176: return true; } return false; } ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; function isArrayLiteralExpression(node) { - return node.kind === 175; + return node.kind === 176; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 176; + return node.kind === 177; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 177; + return node.kind === 178; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 178; + return node.kind === 179; } ts.isElementAccessExpression = isElementAccessExpression; function isBinaryExpression(node) { - return node.kind === 192; + return node.kind === 193; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 193; + return node.kind === 194; } ts.isConditionalExpression = isConditionalExpression; function isCallExpression(node) { - return node.kind === 179; + return node.kind === 180; } ts.isCallExpression = isCallExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 194 + return kind === 195 || kind === 12; } ts.isTemplateLiteral = isTemplateLiteral; function isSpreadExpression(node) { - return node.kind === 196; + return node.kind === 197; } ts.isSpreadExpression = isSpreadExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 199; + return node.kind === 200; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isLeftHandSideExpressionKind(kind) { - return kind === 177 - || kind === 178 - || kind === 180 + return kind === 178 || kind === 179 - || kind === 247 - || kind === 248 || kind === 181 - || kind === 175 - || kind === 183 + || kind === 180 + || kind === 248 + || kind === 249 + || kind === 182 || kind === 176 - || kind === 197 || kind === 184 + || kind === 177 + || kind === 198 + || kind === 185 || kind === 70 || kind === 11 || kind === 8 || kind === 9 || kind === 12 - || kind === 194 + || kind === 195 || kind === 85 || kind === 94 || kind === 98 || kind === 100 || kind === 96 - || kind === 201 - || kind === 202; + || kind === 202 + || kind === 203; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isUnaryExpressionKind(kind) { - return kind === 190 - || kind === 191 - || kind === 186 + return kind === 191 + || kind === 192 || kind === 187 || kind === 188 || kind === 189 - || kind === 182 + || kind === 190 + || kind === 183 || isLeftHandSideExpressionKind(kind); } function isUnaryExpression(node) { @@ -8008,13 +8058,13 @@ var ts; } ts.isUnaryExpression = isUnaryExpression; function isExpressionKind(kind) { - return kind === 193 - || kind === 195 - || kind === 185 - || kind === 192 + return kind === 194 || kind === 196 - || kind === 200 - || kind === 198 + || kind === 186 + || kind === 193 + || kind === 197 + || kind === 201 + || kind === 199 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -8023,16 +8073,16 @@ var ts; ts.isExpression = isExpression; function isAssertionExpression(node) { var kind = node.kind; - return kind === 182 - || kind === 200; + return kind === 183 + || kind === 201; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 295; + return node.kind === 296; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 294; + return node.kind === 295; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -8041,15 +8091,15 @@ var ts; } ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isOmittedExpression(node) { - return node.kind === 198; + return node.kind === 199; } ts.isOmittedExpression = isOmittedExpression; function isTemplateSpan(node) { - return node.kind === 203; + return node.kind === 204; } ts.isTemplateSpan = isTemplateSpan; function isBlock(node) { - return node.kind === 205; + return node.kind === 206; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -8067,121 +8117,121 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 224; + return node.kind === 225; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 225; + return node.kind === 226; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 233; + return node.kind === 234; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 232 - || kind === 231; + return kind === 233 + || kind === 232; } ts.isModuleBody = isModuleBody; function isImportEqualsDeclaration(node) { - return node.kind === 235; + return node.kind === 236; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 237; + return node.kind === 238; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 239 - || kind === 238; + return kind === 240 + || kind === 239; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 240; + return node.kind === 241; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 243; + return node.kind === 244; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 244; + return node.kind === 245; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 231 || node.kind === 230; + return node.kind === 232 || node.kind === 231; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 185 - || kind === 174 + return kind === 186 + || kind === 175 + || kind === 228 + || kind === 198 + || kind === 151 + || kind === 231 + || kind === 262 + || kind === 245 || kind === 227 - || kind === 197 + || kind === 185 + || kind === 152 + || kind === 238 + || kind === 236 + || kind === 241 + || kind === 229 || kind === 150 - || kind === 230 - || kind === 261 - || kind === 244 - || kind === 226 - || kind === 184 - || kind === 151 - || kind === 237 - || kind === 235 - || kind === 240 - || kind === 228 || kind === 149 + || kind === 232 + || kind === 235 + || kind === 239 + || kind === 145 + || kind === 259 || kind === 148 - || kind === 231 - || kind === 234 - || kind === 238 - || kind === 144 - || kind === 258 || kind === 147 - || kind === 146 - || kind === 152 - || kind === 259 - || kind === 229 - || kind === 143 - || kind === 224 - || kind === 286; + || kind === 153 + || kind === 260 + || kind === 230 + || kind === 144 + || kind === 225 + || kind === 287; } function isDeclarationStatementKind(kind) { - return kind === 226 - || kind === 245 - || kind === 227 + return kind === 227 + || kind === 246 || kind === 228 || kind === 229 || kind === 230 || kind === 231 + || kind === 232 + || kind === 237 || kind === 236 - || kind === 235 + || kind === 243 || kind === 242 - || kind === 241 - || kind === 234; + || kind === 235; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 216 + return kind === 217 + || kind === 216 + || kind === 224 + || kind === 211 + || kind === 209 + || kind === 208 + || kind === 214 || kind === 215 - || kind === 223 + || kind === 213 || kind === 210 - || kind === 208 + || kind === 221 + || kind === 218 + || kind === 220 + || kind === 222 + || kind === 223 || kind === 207 - || kind === 213 - || kind === 214 || kind === 212 - || kind === 209 - || kind === 220 - || kind === 217 || kind === 219 - || kind === 221 - || kind === 222 - || kind === 206 - || kind === 211 - || kind === 218 - || kind === 294 - || kind === 297 - || kind === 296; + || kind === 295 + || kind === 298 + || kind === 297; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -8199,87 +8249,87 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 205; + || kind === 206; } ts.isStatement = isStatement; function isModuleReference(node) { var kind = node.kind; - return kind === 246 - || kind === 141 + return kind === 247 + || kind === 142 || kind === 70; } ts.isModuleReference = isModuleReference; function isJsxOpeningElement(node) { - return node.kind === 249; + return node.kind === 250; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 250; + return node.kind === 251; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { var kind = node.kind; return kind === 98 || kind === 70 - || kind === 177; + || kind === 178; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 247 - || kind === 253 - || kind === 248 + return kind === 248 + || kind === 254 + || kind === 249 || kind === 10; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 251 - || kind === 252; + return kind === 252 + || kind === 253; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 252; + return node.kind === 253; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 251; + return node.kind === 252; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 253; + || kind === 254; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 254 - || kind === 255; + return kind === 255 + || kind === 256; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 256; + return node.kind === 257; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 257; + return node.kind === 258; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 258; + return node.kind === 259; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 259; + return node.kind === 260; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isEnumMember(node) { - return node.kind === 261; + return node.kind === 262; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 262; + return node.kind === 263; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -8418,9 +8468,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 143) { + if (d && d.kind === 144) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 228) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 229) { return current; } } @@ -8428,11 +8478,11 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return ts.hasModifier(node, 92) && node.parent.kind === 150 && ts.isClassLike(node.parent.parent); + return ts.hasModifier(node, 92) && node.parent.kind === 151 && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 174 || ts.isBindingPattern(node))) { + while (node && (node.kind === 175 || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -8440,14 +8490,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 224) { + if (node.kind === 225) { node = node.parent; } - if (node && node.kind === 225) { + if (node && node.kind === 226) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 206) { + if (node && node.kind === 207) { flags |= ts.getModifierFlags(node); } return flags; @@ -8456,14 +8506,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 224) { + if (node.kind === 225) { node = node.parent; } - if (node && node.kind === 225) { + if (node && node.kind === 226) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 206) { + if (node && node.kind === 207) { flags |= node.flags; } return flags; @@ -8522,7 +8572,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, location, flags) { - var ConstructorForKind = kind === 262 + var ConstructorForKind = kind === 263 ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); var node = location @@ -8692,7 +8742,7 @@ var ts; } ts.createNull = createNull; function createComputedPropertyName(expression, location) { - var node = createNode(142, location); + var node = createNode(143, location); node.expression = expression; return node; } @@ -8705,7 +8755,7 @@ var ts; } ts.updateComputedPropertyName = updateComputedPropertyName; function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) { - var node = createNode(144, location, flags); + var node = createNode(145, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.dotDotDotToken = dotDotDotToken; @@ -8724,7 +8774,7 @@ var ts; } ts.updateParameter = updateParameter; function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) { - var node = createNode(147, location); + var node = createNode(148, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -8742,7 +8792,7 @@ var ts; } ts.updateProperty = updateProperty; function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(149, location, flags); + var node = createNode(150, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -8762,7 +8812,7 @@ var ts; } ts.updateMethod = updateMethod; function createConstructor(decorators, modifiers, parameters, body, location, flags) { - var node = createNode(150, location, flags); + var node = createNode(151, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.typeParameters = undefined; @@ -8780,7 +8830,7 @@ var ts; } ts.updateConstructor = updateConstructor; function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) { - var node = createNode(151, location, flags); + var node = createNode(152, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -8799,7 +8849,7 @@ var ts; } ts.updateGetAccessor = updateGetAccessor; function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) { - var node = createNode(152, location, flags); + var node = createNode(153, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -8817,7 +8867,7 @@ var ts; } ts.updateSetAccessor = updateSetAccessor; function createObjectBindingPattern(elements, location) { - var node = createNode(172, location); + var node = createNode(173, location); node.elements = createNodeArray(elements); return node; } @@ -8830,7 +8880,7 @@ var ts; } ts.updateObjectBindingPattern = updateObjectBindingPattern; function createArrayBindingPattern(elements, location) { - var node = createNode(173, location); + var node = createNode(174, location); node.elements = createNodeArray(elements); return node; } @@ -8843,7 +8893,7 @@ var ts; } ts.updateArrayBindingPattern = updateArrayBindingPattern; function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) { - var node = createNode(174, location); + var node = createNode(175, location); node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; node.dotDotDotToken = dotDotDotToken; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -8859,7 +8909,7 @@ var ts; } ts.updateBindingElement = updateBindingElement; function createArrayLiteral(elements, location, multiLine) { - var node = createNode(175, location); + var node = createNode(176, location); node.elements = parenthesizeListElements(createNodeArray(elements)); if (multiLine) { node.multiLine = true; @@ -8875,7 +8925,7 @@ var ts; } ts.updateArrayLiteral = updateArrayLiteral; function createObjectLiteral(properties, location, multiLine) { - var node = createNode(176, location); + var node = createNode(177, location); node.properties = createNodeArray(properties); if (multiLine) { node.multiLine = true; @@ -8891,7 +8941,7 @@ var ts; } ts.updateObjectLiteral = updateObjectLiteral; function createPropertyAccess(expression, name, location, flags) { - var node = createNode(177, location, flags); + var node = createNode(178, location, flags); node.expression = parenthesizeForAccess(expression); (node.emitNode || (node.emitNode = {})).flags |= 65536; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -8908,7 +8958,7 @@ var ts; } ts.updatePropertyAccess = updatePropertyAccess; function createElementAccess(expression, index, location) { - var node = createNode(178, location); + var node = createNode(179, location); node.expression = parenthesizeForAccess(expression); node.argumentExpression = typeof index === "number" ? createLiteral(index) : index; return node; @@ -8922,7 +8972,7 @@ var ts; } ts.updateElementAccess = updateElementAccess; function createCall(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(179, location, flags); + var node = createNode(180, location, flags); node.expression = parenthesizeForAccess(expression); if (typeArguments) { node.typeArguments = createNodeArray(typeArguments); @@ -8939,7 +8989,7 @@ var ts; } ts.updateCall = updateCall; function createNew(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(180, location, flags); + var node = createNode(181, location, flags); node.expression = parenthesizeForNew(expression); node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; @@ -8954,7 +9004,7 @@ var ts; } ts.updateNew = updateNew; function createTaggedTemplate(tag, template, location) { - var node = createNode(181, location); + var node = createNode(182, location); node.tag = parenthesizeForAccess(tag); node.template = template; return node; @@ -8968,7 +9018,7 @@ var ts; } ts.updateTaggedTemplate = updateTaggedTemplate; function createParen(expression, location) { - var node = createNode(183, location); + var node = createNode(184, location); node.expression = expression; return node; } @@ -8981,7 +9031,7 @@ var ts; } ts.updateParen = updateParen; function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(184, location, flags); + var node = createNode(185, location, flags); node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -9000,7 +9050,7 @@ var ts; } ts.updateFunctionExpression = updateFunctionExpression; function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) { - var node = createNode(185, location, flags); + var node = createNode(186, location, flags); node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; node.parameters = createNodeArray(parameters); @@ -9018,7 +9068,7 @@ var ts; } ts.updateArrowFunction = updateArrowFunction; function createDelete(expression, location) { - var node = createNode(186, location); + var node = createNode(187, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -9031,7 +9081,7 @@ var ts; } ts.updateDelete = updateDelete; function createTypeOf(expression, location) { - var node = createNode(187, location); + var node = createNode(188, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -9044,7 +9094,7 @@ var ts; } ts.updateTypeOf = updateTypeOf; function createVoid(expression, location) { - var node = createNode(188, location); + var node = createNode(189, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -9057,7 +9107,7 @@ var ts; } ts.updateVoid = updateVoid; function createAwait(expression, location) { - var node = createNode(189, location); + var node = createNode(190, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -9070,7 +9120,7 @@ var ts; } ts.updateAwait = updateAwait; function createPrefix(operator, operand, location) { - var node = createNode(190, location); + var node = createNode(191, location); node.operator = operator; node.operand = parenthesizePrefixOperand(operand); return node; @@ -9084,7 +9134,7 @@ var ts; } ts.updatePrefix = updatePrefix; function createPostfix(operand, operator, location) { - var node = createNode(191, location); + var node = createNode(192, location); node.operand = parenthesizePostfixOperand(operand); node.operator = operator; return node; @@ -9100,7 +9150,7 @@ var ts; function createBinary(left, operator, right, location) { var operatorToken = typeof operator === "number" ? createToken(operator) : operator; var operatorKind = operatorToken.kind; - var node = createNode(192, location); + var node = createNode(193, location); node.left = parenthesizeBinaryOperand(operatorKind, left, true, undefined); node.operatorToken = operatorToken; node.right = parenthesizeBinaryOperand(operatorKind, right, false, node.left); @@ -9115,7 +9165,7 @@ var ts; } ts.updateBinary = updateBinary; function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { - var node = createNode(193, whenFalse ? location : colonTokenOrLocation); + var node = createNode(194, whenFalse ? location : colonTokenOrLocation); node.condition = parenthesizeForConditionalHead(condition); if (whenFalse) { node.questionToken = questionTokenOrWhenTrue; @@ -9140,7 +9190,7 @@ var ts; } ts.updateConditional = updateConditional; function createTemplateExpression(head, templateSpans, location) { - var node = createNode(194, location); + var node = createNode(195, location); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; @@ -9154,7 +9204,7 @@ var ts; } ts.updateTemplateExpression = updateTemplateExpression; function createYield(asteriskToken, expression, location) { - var node = createNode(195, location); + var node = createNode(196, location); node.asteriskToken = asteriskToken; node.expression = expression; return node; @@ -9168,7 +9218,7 @@ var ts; } ts.updateYield = updateYield; function createSpread(expression, location) { - var node = createNode(196, location); + var node = createNode(197, location); node.expression = parenthesizeExpressionForList(expression); return node; } @@ -9181,7 +9231,7 @@ var ts; } ts.updateSpread = updateSpread; function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(197, location); + var node = createNode(198, location); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -9199,12 +9249,12 @@ var ts; } ts.updateClassExpression = updateClassExpression; function createOmittedExpression(location) { - var node = createNode(198, location); + var node = createNode(199, location); return node; } ts.createOmittedExpression = createOmittedExpression; function createExpressionWithTypeArguments(typeArguments, expression, location) { - var node = createNode(199, location); + var node = createNode(200, location); node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; node.expression = parenthesizeForAccess(expression); return node; @@ -9218,7 +9268,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createTemplateSpan(expression, literal, location) { - var node = createNode(203, location); + var node = createNode(204, location); node.expression = expression; node.literal = literal; return node; @@ -9232,7 +9282,7 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createBlock(statements, location, multiLine, flags) { - var block = createNode(205, location, flags); + var block = createNode(206, location, flags); block.statements = createNodeArray(statements); if (multiLine) { block.multiLine = true; @@ -9248,7 +9298,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(206, location, flags); + var node = createNode(207, location, flags); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -9263,7 +9313,7 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(225, location, flags); + var node = createNode(226, location, flags); node.declarations = createNodeArray(declarations); return node; } @@ -9276,7 +9326,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(224, location, flags); + var node = createNode(225, location, flags); node.name = typeof name === "string" ? createIdentifier(name) : name; node.type = type; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -9291,11 +9341,11 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createEmptyStatement(location) { - return createNode(207, location); + return createNode(208, location); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression, location, flags) { - var node = createNode(208, location, flags); + var node = createNode(209, location, flags); node.expression = parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -9308,7 +9358,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(209, location); + var node = createNode(210, location); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -9323,7 +9373,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression, location) { - var node = createNode(210, location); + var node = createNode(211, location); node.statement = statement; node.expression = expression; return node; @@ -9337,7 +9387,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement, location) { - var node = createNode(211, location); + var node = createNode(212, location); node.expression = expression; node.statement = statement; return node; @@ -9351,7 +9401,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(212, location, undefined); + var node = createNode(213, location, undefined); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -9367,7 +9417,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement, location) { - var node = createNode(213, location); + var node = createNode(214, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -9382,7 +9432,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(initializer, expression, statement, location) { - var node = createNode(214, location); + var node = createNode(215, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -9397,7 +9447,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label, location) { - var node = createNode(215, location); + var node = createNode(216, location); if (label) { node.label = label; } @@ -9412,7 +9462,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label, location) { - var node = createNode(216, location); + var node = createNode(217, location); if (label) { node.label = label; } @@ -9427,7 +9477,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression, location) { - var node = createNode(217, location); + var node = createNode(218, location); node.expression = expression; return node; } @@ -9440,7 +9490,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement, location) { - var node = createNode(218, location); + var node = createNode(219, location); node.expression = expression; node.statement = statement; return node; @@ -9454,7 +9504,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock, location) { - var node = createNode(219, location); + var node = createNode(220, location); node.expression = parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -9468,7 +9518,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement, location) { - var node = createNode(220, location); + var node = createNode(221, location); node.label = typeof label === "string" ? createIdentifier(label) : label; node.statement = statement; return node; @@ -9482,7 +9532,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression, location) { - var node = createNode(221, location); + var node = createNode(222, location); node.expression = expression; return node; } @@ -9495,7 +9545,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(222, location); + var node = createNode(223, location); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -9510,7 +9560,7 @@ var ts; } ts.updateTry = updateTry; function createCaseBlock(clauses, location) { - var node = createNode(233, location); + var node = createNode(234, location); node.clauses = createNodeArray(clauses); return node; } @@ -9523,7 +9573,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(226, location, flags); + var node = createNode(227, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -9543,7 +9593,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(227, location); + var node = createNode(228, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -9561,7 +9611,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(236, location); + var node = createNode(237, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.importClause = importClause; @@ -9577,7 +9627,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings, location) { - var node = createNode(237, location); + var node = createNode(238, location); node.name = name; node.namedBindings = namedBindings; return node; @@ -9591,7 +9641,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name, location) { - var node = createNode(238, location); + var node = createNode(239, location); node.name = name; return node; } @@ -9604,7 +9654,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements, location) { - var node = createNode(239, location); + var node = createNode(240, location); node.elements = createNodeArray(elements); return node; } @@ -9617,7 +9667,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name, location) { - var node = createNode(240, location); + var node = createNode(241, location); node.propertyName = propertyName; node.name = name; return node; @@ -9631,7 +9681,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(241, location); + var node = createNode(242, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.isExportEquals = isExportEquals; @@ -9647,7 +9697,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(242, location); + var node = createNode(243, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.exportClause = exportClause; @@ -9663,7 +9713,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements, location) { - var node = createNode(243, location); + var node = createNode(244, location); node.elements = createNodeArray(elements); return node; } @@ -9676,7 +9726,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(name, propertyName, location) { - var node = createNode(244, location); + var node = createNode(245, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; return node; @@ -9690,7 +9740,7 @@ var ts; } ts.updateExportSpecifier = updateExportSpecifier; function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(247, location); + var node = createNode(248, location); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -9705,7 +9755,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(248, location); + var node = createNode(249, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -9719,7 +9769,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(249, location); + var node = createNode(250, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -9733,7 +9783,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName, location) { - var node = createNode(250, location); + var node = createNode(251, location); node.tagName = tagName; return node; } @@ -9746,7 +9796,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxAttribute(name, initializer, location) { - var node = createNode(251, location); + var node = createNode(252, location); node.name = name; node.initializer = initializer; return node; @@ -9760,7 +9810,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxSpreadAttribute(expression, location) { - var node = createNode(252, location); + var node = createNode(253, location); node.expression = expression; return node; } @@ -9773,7 +9823,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(expression, dotDotDotToken, location) { - var node = createNode(253, location); + var node = createNode(254, location); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -9787,7 +9837,7 @@ var ts; } ts.updateJsxExpression = updateJsxExpression; function createHeritageClause(token, types, location) { - var node = createNode(256, location); + var node = createNode(257, location); node.token = token; node.types = createNodeArray(types); return node; @@ -9801,7 +9851,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCaseClause(expression, statements, location) { - var node = createNode(254, location); + var node = createNode(255, location); node.expression = parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -9815,7 +9865,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements, location) { - var node = createNode(255, location); + var node = createNode(256, location); node.statements = createNodeArray(statements); return node; } @@ -9828,7 +9878,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createCatchClause(variableDeclaration, block, location) { - var node = createNode(257, location); + var node = createNode(258, location); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -9842,7 +9892,7 @@ var ts; } ts.updateCatchClause = updateCatchClause; function createPropertyAssignment(name, initializer, location) { - var node = createNode(258, location); + var node = createNode(259, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.questionToken = undefined; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -9857,14 +9907,14 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(259, location); + var node = createNode(260, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; function createSpreadAssignment(expression, location) { - var node = createNode(260, location); + var node = createNode(261, location); node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; return node; } @@ -9885,7 +9935,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(262, node, node.flags); + var updated = createNode(263, node, node.flags); updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -9945,27 +9995,27 @@ var ts; } ts.updateSourceFileNode = updateSourceFileNode; function createNotEmittedStatement(original) { - var node = createNode(294, original); + var node = createNode(295, original); node.original = original; return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(297); + var node = createNode(298); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(296); + var node = createNode(297); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(295, location || original); + var node = createNode(296, location || original); node.expression = expression; node.original = original; return node; @@ -10145,7 +10195,7 @@ var ts; if (!outermostLabeledStatement) { return node; } - var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 220 + var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 221 ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); if (afterRestoreLabelCallback) { @@ -10163,13 +10213,13 @@ var ts; case 8: case 9: return false; - case 175: + case 176: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 176: + case 177: return target.properties.length > 0; default: return true; @@ -10189,7 +10239,7 @@ var ts; } else { switch (callee.kind) { - case 177: { + case 178: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = createTempVariable(recordTempVariable); target = createPropertyAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.name, callee); @@ -10200,7 +10250,7 @@ var ts; } break; } - case 178: { + case 179: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = createTempVariable(recordTempVariable); target = createElementAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.argumentExpression, callee); @@ -10250,14 +10300,14 @@ var ts; ts.createExpressionForPropertyName = createExpressionForPropertyName; function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { - case 151: case 152: + case 153: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 258: - return createExpressionForPropertyAssignment(property, receiver); case 259: + return createExpressionForPropertyAssignment(property, receiver); + case 260: return createExpressionForShorthandPropertyAssignment(property, receiver); - case 149: + case 150: return createExpressionForMethodDeclaration(property, receiver); } } @@ -10320,15 +10370,15 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_8 = getMutableClone(node.name); + var name = getMutableClone(node.name); emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) emitFlags |= 48; if (!allowComments) emitFlags |= 1536; if (emitFlags) - setEmitFlags(name_8, emitFlags); - return name_8; + setEmitFlags(name, emitFlags); + return name; } return getGeneratedNameForNode(node); } @@ -10423,7 +10473,7 @@ var ts; ts.ensureUseStrict = ensureUseStrict; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 183) { + if (skipped.kind === 184) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -10432,15 +10482,15 @@ var ts; } ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var binaryOperatorPrecedence = ts.getOperatorPrecedence(192, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(192, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(193, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(193, binaryOperator); var emittedOperand = skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { case -1: if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 - && operand.kind === 195) { + && operand.kind === 196) { return false; } return true; @@ -10479,7 +10529,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 192 && node.operatorToken.kind === 36) { + if (node.kind === 193 && node.operatorToken.kind === 36) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -10494,7 +10544,7 @@ var ts; return 0; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(193, 54); + var conditionalPrecedence = ts.getOperatorPrecedence(194, 54); var emittedCondition = skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { @@ -10504,16 +10554,16 @@ var ts; } ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; function parenthesizeSubexpressionOfConditionalExpression(e) { - return e.kind === 192 && e.operatorToken.kind === 25 + return e.kind === 193 && e.operatorToken.kind === 25 ? createParen(e) : e; } function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { - case 179: - return createParen(expression); case 180: + return createParen(expression); + case 181: return emittedExpression.arguments ? expression : createParen(expression); @@ -10524,7 +10574,7 @@ var ts; function parenthesizeForAccess(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 180 || emittedExpression.arguments) + && (emittedExpression.kind !== 181 || emittedExpression.arguments) && emittedExpression.kind !== 8) { return expression; } @@ -10562,7 +10612,7 @@ var ts; function parenthesizeExpressionForList(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(192, 25); + var commaPrecedence = ts.getOperatorPrecedence(193, 25); return expressionPrecedence > commaPrecedence ? expression : createParen(expression, expression); @@ -10573,7 +10623,7 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 184 || kind === 185) { + if (kind === 185 || kind === 186) { var mutableCall = getMutableClone(emittedExpression); mutableCall.expression = createParen(callee, callee); return recreatePartiallyEmittedExpressions(expression, mutableCall); @@ -10581,7 +10631,7 @@ var ts; } else { var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; - if (leftmostExpressionKind === 176 || leftmostExpressionKind === 184) { + if (leftmostExpressionKind === 177 || leftmostExpressionKind === 185) { return createParen(expression, expression); } } @@ -10599,21 +10649,21 @@ var ts; function getLeftmostExpression(node) { while (true) { switch (node.kind) { - case 191: + case 192: node = node.operand; continue; - case 192: + case 193: node = node.left; continue; - case 193: + case 194: node = node.condition; continue; + case 180: case 179: case 178: - case 177: node = node.expression; continue; - case 295: + case 296: node = node.expression; continue; } @@ -10622,7 +10672,7 @@ var ts; } function parenthesizeConciseBody(body) { var emittedBody = skipPartiallyEmittedExpressions(body); - if (emittedBody.kind === 176) { + if (emittedBody.kind === 177) { return createParen(body, body); } return body; @@ -10647,7 +10697,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipParentheses(node) { - while (node.kind === 183) { + while (node.kind === 184) { node = node.expression; } return node; @@ -10661,7 +10711,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 295) { + while (node.kind === 296) { node = node.expression; } return node; @@ -10702,8 +10752,10 @@ var ts; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { if (!destRanges) - destRanges = ts.createMap(); - ts.copyProperties(sourceRanges, destRanges); + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } return destRanges; } function disposeEmitNodes(sourceFile) { @@ -10721,7 +10773,7 @@ var ts; function getOrCreateEmitNode(node) { if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 262) { + if (node.kind === 263) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -10760,7 +10812,7 @@ var ts; ts.getTokenSourceMapRange = getTokenSourceMapRange; function setTokenSourceMapRange(node, token, range) { var emitNode = getOrCreateEmitNode(node); - var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); tokenSourceMapRanges[token] = range; return node; } @@ -10909,13 +10961,13 @@ var ts; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_9 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name) ? name : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 236 && node.importClause) { + if (node.kind === 237 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 242 && node.moduleSpecifier) { + if (node.kind === 243 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } return undefined; @@ -10932,10 +10984,8 @@ var ts; } ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral; function tryRenameExternalModule(moduleName, sourceFile) { - if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) { - return createLiteral(sourceFile.renamedDependencies[moduleName.text]); - } - return undefined; + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && createLiteral(rename); } function tryGetModuleNameFromFile(file, host, options) { if (!file) { @@ -10979,11 +11029,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 258: - return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 259: - return bindingElement.name; + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 260: + return bindingElement.name; + case 261: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -10999,11 +11049,11 @@ var ts; ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 144: - case 174: + case 145: + case 175: return bindingElement.dotDotDotToken; - case 196: - case 260: + case 197: + case 261: return bindingElement; } return undefined; @@ -11011,7 +11061,7 @@ var ts; ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 174: + case 175: if (bindingElement.propertyName) { var propertyName = bindingElement.propertyName; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -11019,7 +11069,7 @@ var ts; : propertyName; } break; - case 258: + case 259: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -11027,7 +11077,7 @@ var ts; : propertyName; } break; - case 260: + case 261: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -11041,11 +11091,11 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 172: case 173: - case 175: - return name.elements; + case 174: case 176: + return name.elements; + case 177: return name.properties; } } @@ -11082,11 +11132,11 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 173: - case 175: - return convertToArrayAssignmentPattern(node); - case 172: + case 174: case 176: + return convertToArrayAssignmentPattern(node); + case 173: + case 177: return convertToObjectAssignmentPattern(node); } } @@ -11117,8 +11167,8 @@ var ts; ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); + var exportSpecifiers = ts.createMultiMap(); + var exportedBindings = []; var uniqueExports = ts.createMap(); var exportedNames; var hasExportDefault = false; @@ -11132,15 +11182,15 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 236: + case 237: externalImports.push(node); break; - case 235: - if (node.moduleReference.kind === 246) { + case 236: + if (node.moduleReference.kind === 247) { externalImports.push(node); } break; - case 242: + case 243: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -11153,26 +11203,26 @@ var ts; else { for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_10 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_10.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_10) - || resolver.getReferencedValueDeclaration(name_10); + if (!uniqueExports.get(specifier.name.text)) { + var name = specifier.propertyName || specifier.name; + exportSpecifiers.add(name.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); if (decl) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); } - uniqueExports[specifier.name.text] = true; + uniqueExports.set(specifier.name.text, true); exportedNames = ts.append(exportedNames, specifier.name); } } } break; - case 241: + case 242: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 206: + case 207: if (ts.hasModifier(node, 1)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -11180,38 +11230,38 @@ var ts; } } break; - case 226: + case 227: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_11 = node.name; - if (!uniqueExports[name_11.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11); - uniqueExports[name_11.text] = true; - exportedNames = ts.append(exportedNames, name_11); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } break; - case 227: + case 228: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_12 = node.name; - if (!uniqueExports[name_12.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12); - uniqueExports[name_12.text] = true; - exportedNames = ts.append(exportedNames, name_12); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } @@ -11231,13 +11281,23 @@ var ts; } } else if (!ts.isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = true; + if (!uniqueExports.get(decl.name.text)) { + uniqueExports.set(decl.name.text, true); exportedNames = ts.append(exportedNames, decl.name); } } return exportedNames; } + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } })(ts || (ts = {})); var ts; (function (ts) { @@ -11246,13 +11306,13 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 262) { + if (kind === 263) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } - else if (kind < 141) { + else if (kind < 142) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end); } else { @@ -11288,28 +11348,28 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 141: + case 142: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 143: + case 144: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 259: + case 260: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 260: + case 261: return visitNode(cbNode, node.expression); - case 144: + case 145: + case 148: case 147: - case 146: - case 258: - case 224: - case 174: + case 259: + case 225: + case 175: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -11318,24 +11378,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 158: case 159: - case 153: + case 160: case 154: case 155: + case 156: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 184: - case 226: + case 153: case 185: + case 227: + case 186: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -11346,323 +11406,323 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 157: + case 158: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 156: + case 157: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 160: - return visitNode(cbNode, node.exprName); case 161: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 162: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 163: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 164: + return visitNodes(cbNodes, node.elementTypes); case 165: - return visitNodes(cbNodes, node.types); case 166: - case 168: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); + case 167: case 169: + return visitNode(cbNode, node.type); + case 170: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); - case 170: + case 171: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); - case 171: - return visitNode(cbNode, node.literal); case 172: + return visitNode(cbNode, node.literal); case 173: - return visitNodes(cbNodes, node.elements); - case 175: + case 174: return visitNodes(cbNodes, node.elements); case 176: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 177: + return visitNodes(cbNodes, node.properties); + case 178: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 178: + case 179: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 179: case 180: + case 181: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 181: + case 182: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 182: + case 183: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 183: - return visitNode(cbNode, node.expression); - case 186: + case 184: return visitNode(cbNode, node.expression); case 187: return visitNode(cbNode, node.expression); case 188: return visitNode(cbNode, node.expression); - case 190: - return visitNode(cbNode, node.operand); - case 195: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 189: return visitNode(cbNode, node.expression); case 191: return visitNode(cbNode, node.operand); + case 196: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 190: + return visitNode(cbNode, node.expression); case 192: + return visitNode(cbNode, node.operand); + case 193: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 200: + case 201: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 201: - return visitNode(cbNode, node.expression); case 202: + return visitNode(cbNode, node.expression); + case 203: return visitNode(cbNode, node.name); - case 193: + case 194: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 196: + case 197: return visitNode(cbNode, node.expression); - case 205: - case 232: + case 206: + case 233: return visitNodes(cbNodes, node.statements); - case 262: + case 263: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 206: + case 207: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 225: + case 226: return visitNodes(cbNodes, node.declarations); - case 208: - return visitNode(cbNode, node.expression); case 209: + return visitNode(cbNode, node.expression); + case 210: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 210: + case 211: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 211: + case 212: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 212: + case 213: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 213: + case 214: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214: + case 215: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 215: case 216: - return visitNode(cbNode, node.label); case 217: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.label); case 218: + return visitNode(cbNode, node.expression); + case 219: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 219: + case 220: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 233: + case 234: return visitNodes(cbNodes, node.clauses); - case 254: + case 255: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 255: + case 256: return visitNodes(cbNodes, node.statements); - case 220: + case 221: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 221: - return visitNode(cbNode, node.expression); case 222: + return visitNode(cbNode, node.expression); + case 223: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 257: + case 258: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 145: + case 146: return visitNode(cbNode, node.expression); - case 227: - case 197: + case 228: + case 198: 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 228: + case 229: 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 229: + case 230: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 230: + case 231: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 261: + case 262: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 231: + case 232: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 235: + case 236: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 236: + case 237: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 237: + case 238: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 234: - return visitNode(cbNode, node.name); - case 238: + case 235: return visitNode(cbNode, node.name); case 239: - case 243: + return visitNode(cbNode, node.name); + case 240: + case 244: return visitNodes(cbNodes, node.elements); - case 242: + case 243: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 240: - case 244: + case 241: + case 245: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 241: + case 242: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 194: + case 195: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 203: + case 204: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 142: + case 143: return visitNode(cbNode, node.expression); - case 256: + case 257: return visitNodes(cbNodes, node.types); - case 199: + case 200: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 246: + case 247: return visitNode(cbNode, node.expression); - case 245: + case 246: return visitNodes(cbNodes, node.decorators); - case 247: + case 248: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 248: case 249: + case 250: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 251: + case 252: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 252: - return visitNode(cbNode, node.expression); case 253: + return visitNode(cbNode, node.expression); + case 254: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 250: + case 251: return visitNode(cbNode, node.tagName); - case 263: + case 264: return visitNode(cbNode, node.type); - case 267: - return visitNodes(cbNodes, node.types); case 268: return visitNodes(cbNodes, node.types); - case 266: + case 269: + return visitNodes(cbNodes, node.types); + case 267: return visitNode(cbNode, node.elementType); - case 270: + case 271: return visitNode(cbNode, node.type); - case 269: + case 270: return visitNode(cbNode, node.type); - case 271: + case 272: return visitNode(cbNode, node.literal); - case 273: + case 274: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 274: - return visitNode(cbNode, node.type); case 275: + return visitNode(cbNode, node.type); + case 276: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 276: - return visitNode(cbNode, node.type); case 277: return visitNode(cbNode, node.type); case 278: return visitNode(cbNode, node.type); - case 272: + case 279: + return visitNode(cbNode, node.type); + case 273: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 279: + case 280: return visitNodes(cbNodes, node.tags); - case 282: + case 283: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 283: - return visitNode(cbNode, node.typeExpression); case 284: return visitNode(cbNode, node.typeExpression); - case 281: - return visitNode(cbNode, node.typeExpression); case 285: - return visitNodes(cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 282: + return visitNode(cbNode, node.typeExpression); case 286: + return visitNodes(cbNodes, node.typeParameters); + case 287: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 288: + case 289: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 287: + case 288: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 295: + case 296: return visitNode(cbNode, node.expression); - case 289: + case 290: return visitNode(cbNode, node.literal); } } @@ -11826,7 +11886,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(262, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(263, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -12053,7 +12113,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return kind >= 141 ? new NodeConstructor(kind, pos, pos) : + return kind >= 142 ? new NodeConstructor(kind, pos, pos) : kind === 70 ? new IdentifierConstructor(kind, pos, pos) : new TokenConstructor(kind, pos, pos); } @@ -12090,7 +12150,11 @@ var ts; } function internIdentifier(text) { text = ts.escapeIdentifier(text); - return identifiers[text] || (identifiers[text] = text); + var identifier = identifiers.get(text); + if (identifier === undefined) { + identifiers.set(text, identifier = text); + } + return identifier; } function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; @@ -12135,7 +12199,7 @@ var ts; return token() === 9 || token() === 8 || ts.tokenIsIdentifierOrKeyword(token()); } function parseComputedPropertyName() { - var node = createNode(142); + var node = createNode(143); parseExpected(20); node.expression = allowInAnd(parseExpression); parseExpected(21); @@ -12440,14 +12504,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 150: - case 155: case 151: + case 156: case 152: - case 147: - case 204: + case 153: + case 148: + case 205: return true; - case 149: + case 150: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 70 && methodDeclaration.name.originalKeywordKind === 122; @@ -12459,8 +12523,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 254: case 255: + case 256: return true; } } @@ -12469,65 +12533,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 226: + case 227: + case 207: case 206: - case 205: + case 210: case 209: - case 208: - case 221: + case 222: + case 218: + case 220: case 217: - case 219: case 216: + case 214: case 215: case 213: - case 214: case 212: - case 211: - case 218: - case 207: - case 222: - case 220: - case 210: + case 219: + case 208: case 223: + case 221: + case 211: + case 224: + case 237: case 236: - case 235: + case 243: case 242: - case 241: - case 231: - case 227: + case 232: case 228: - case 230: case 229: + case 231: + case 230: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 261; + return node.kind === 262; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 154: - case 148: case 155: - case 146: - case 153: + case 149: + case 156: + case 147: + case 154: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 224) { + if (node.kind !== 225) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 144) { + if (node.kind !== 145) { return false; } var parameter = node; @@ -12623,7 +12687,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(22)) { - var node = createNode(141, entity.pos); + var node = createNode(142, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -12640,7 +12704,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(194); + var template = createNode(195); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 13, "Template head has wrong token kind"); var templateSpans = createNodeArray(); @@ -12652,7 +12716,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(203); + var span = createNode(204); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17) { @@ -12700,7 +12764,7 @@ var ts; } function parseTypeReference() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - var node = createNode(157, typeName.pos); + var node = createNode(158, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); @@ -12709,24 +12773,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(156, lhs.pos); + var node = createNode(157, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(167); + var node = createNode(168); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(160); + var node = createNode(161); parseExpected(102); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); if (parseOptional(84)) { if (isStartOfType() || !isStartOfExpression()) { @@ -12753,7 +12817,7 @@ var ts; return token() === 23 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 || token() === 98; } function parseParameter() { - var node = createNode(144); + var node = createNode(145); if (token() === 98) { node.name = createIdentifier(true, undefined); node.type = parseParameterType(); @@ -12813,7 +12877,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 154) { + if (kind === 155) { parseExpected(93); } fillSignature(55, false, false, false, node); @@ -12853,7 +12917,7 @@ var ts; return token() === 55 || token() === 25 || token() === 21; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(155, fullStart); + var node = createNode(156, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.parameters = parseBracketedList(16, parseParameter, 20, 21); @@ -12865,7 +12929,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(54); if (token() === 18 || token() === 26) { - var method = createNode(148, fullStart); + var method = createNode(149, fullStart); method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; @@ -12874,7 +12938,7 @@ var ts; return addJSDocComment(finishNode(method)); } else { - var property = createNode(146, fullStart); + var property = createNode(147, fullStart); property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; @@ -12914,10 +12978,10 @@ var ts; } function parseTypeMember() { if (token() === 18 || token() === 26) { - return parseSignatureMember(153); + return parseSignatureMember(154); } if (token() === 93 && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(154); + return parseSignatureMember(155); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -12931,7 +12995,7 @@ var ts; return token() === 18 || token() === 26; } function parseTypeLiteral() { - var node = createNode(161); + var node = createNode(162); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -12954,14 +13018,14 @@ var ts; return token() === 20 && nextTokenIsIdentifier() && nextToken() === 91; } function parseMappedTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); parseExpected(91); node.constraint = parseType(); return finishNode(node); } function parseMappedType() { - var node = createNode(170); + var node = createNode(171); parseExpected(16); node.readonlyToken = parseOptionalToken(130); parseExpected(20); @@ -12974,12 +13038,12 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(163); + var node = createNode(164); node.elementTypes = parseBracketedList(20, parseType, 20, 21); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(166); + var node = createNode(167); parseExpected(18); node.type = parseType(); parseExpected(19); @@ -12987,7 +13051,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 159) { + if (kind === 160) { parseExpected(93); } fillSignature(35, false, false, false, node); @@ -12998,7 +13062,7 @@ var ts; return token() === 22 ? undefined : node; } function parseLiteralTypeNode() { - var node = createNode(171); + var node = createNode(172); node.literal = parseSimpleUnaryExpression(); finishNode(node); return node; @@ -13009,12 +13073,13 @@ var ts; function parseNonArrayType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: - case 137: + case 136: + case 138: case 129: + case 133: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 9: @@ -13051,12 +13116,12 @@ var ts; function isStartOfType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: - case 137: + case 138: case 94: case 98: case 102: @@ -13071,6 +13136,7 @@ var ts; case 8: case 100: case 85: + case 133: return true; case 37: return lookAhead(nextTokenIsNumericLiteral); @@ -13088,14 +13154,14 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(20)) { if (isStartOfType()) { - var node = createNode(169, type.pos); + var node = createNode(170, type.pos); node.objectType = type; node.indexType = parseType(); parseExpected(21); type = finishNode(node); } else { - var node = createNode(162, type.pos); + var node = createNode(163, type.pos); node.elementType = type; parseExpected(21); type = finishNode(node); @@ -13104,7 +13170,7 @@ var ts; return type; } function parseTypeOperator(operator) { - var node = createNode(168); + var node = createNode(169); parseExpected(operator); node.operator = operator; node.type = parseTypeOperatorOrHigher(); @@ -13133,10 +13199,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(165, parseTypeOperatorOrHigher, 47); + return parseUnionOrIntersectionType(166, parseTypeOperatorOrHigher, 47); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(164, parseIntersectionTypeOrHigher, 48); + return parseUnionOrIntersectionType(165, parseIntersectionTypeOrHigher, 48); } function isStartOfFunctionType() { if (token() === 26) { @@ -13182,7 +13248,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(156, typePredicateVariable.pos); + var node = createNode(157, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -13203,10 +13269,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(158); + return parseFunctionOrConstructorType(159); } if (token() === 93) { - return parseFunctionOrConstructorType(159); + return parseFunctionOrConstructorType(160); } return parseUnionTypeOrHigher(); } @@ -13325,7 +13391,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(195); + var node = createNode(196); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token() === 38 || isStartOfExpression())) { @@ -13341,13 +13407,13 @@ var ts; ts.Debug.assert(token() === 35, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(185, asyncModifier.pos); + node = createNode(186, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(185, identifier.pos); + node = createNode(186, identifier.pos); } - var parameter = createNode(144, identifier.pos); + var parameter = createNode(145, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = createNodeArray([parameter], parameter.pos); @@ -13481,7 +13547,7 @@ var ts; return 0; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(185); + var node = createNode(186); node.modifiers = parseModifiersForArrowFunction(); var isAsync = !!(ts.getModifierFlags(node) & 256); fillSignature(55, false, isAsync, !allowAmbiguity, node); @@ -13513,7 +13579,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(193, leftOperand.pos); + var node = createNode(194, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -13526,7 +13592,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 91 || t === 140; + return t === 91 || t === 141; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -13604,39 +13670,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(192, left.pos); + var node = createNode(193, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(200, left.pos); + var node = createNode(201, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(186); + var node = createNode(187); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(187); + var node = createNode(188); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(188); + var node = createNode(189); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -13651,7 +13717,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(189); + var node = createNode(190); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -13667,7 +13733,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token() === 39) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 182) { + if (simpleUnaryExpression.kind === 183) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -13720,7 +13786,7 @@ var ts; } function parseIncrementExpression() { if (token() === 42 || token() === 43) { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -13732,7 +13798,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 42 || token() === 43) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(191, expression.pos); + var node = createNode(192, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -13755,7 +13821,7 @@ var ts; if (token() === 18 || token() === 22 || token() === 20) { return expression; } - var node = createNode(177, expression.pos); + var node = createNode(178, expression.pos); node.expression = expression; parseExpectedToken(22, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -13777,8 +13843,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 249) { - var node = createNode(247, opening.pos); + if (opening.kind === 250) { + var node = createNode(248, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -13788,14 +13854,14 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 248); + ts.Debug.assert(opening.kind === 249); result = opening; } if (inExpressionContext && token() === 26) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(192, result.pos); + var badNode = createNode(193, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -13848,7 +13914,7 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token() === 28) { - node = createNode(249, fullStart); + node = createNode(250, fullStart); scanJsxText(); } else { @@ -13860,7 +13926,7 @@ var ts; parseExpected(28, undefined, false); scanJsxText(); } - node = createNode(248, fullStart); + node = createNode(249, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -13871,7 +13937,7 @@ var ts; var expression = token() === 98 ? parseTokenNode() : parseIdentifierName(); while (parseOptional(22)) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -13879,7 +13945,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(253); + var node = createNode(254); parseExpected(16); if (token() !== 17) { node.dotDotDotToken = parseOptionalToken(23); @@ -13899,7 +13965,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(251); + var node = createNode(252); node.name = parseIdentifierName(); if (token() === 57) { switch (scanJsxAttributeValue()) { @@ -13914,7 +13980,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(252); + var node = createNode(253); parseExpected(16); parseExpected(23); node.expression = parseExpression(); @@ -13922,7 +13988,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(250); + var node = createNode(251); parseExpected(27); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -13935,7 +14001,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(182); + var node = createNode(183); parseExpected(26); node.type = parseType(); parseExpected(28); @@ -13946,7 +14012,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(22); if (dotToken) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -13954,13 +14020,13 @@ var ts; } if (token() === 50 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(201, expression.pos); + var nonNullExpression = createNode(202, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } if (!inDecoratorContext() && parseOptional(20)) { - var indexedAccess = createNode(178, expression.pos); + var indexedAccess = createNode(179, expression.pos); indexedAccess.expression = expression; if (token() !== 21) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -13974,7 +14040,7 @@ var ts; continue; } if (token() === 12 || token() === 13) { - var tagExpression = createNode(181, expression.pos); + var tagExpression = createNode(182, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 12 ? parseLiteralNode() @@ -13993,7 +14059,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -14001,7 +14067,7 @@ var ts; continue; } else if (token() === 18) { - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -14096,28 +14162,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(183); + var node = createNode(184); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); return finishNode(node); } function parseSpreadElement() { - var node = createNode(196); + var node = createNode(197); parseExpected(23); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 23 ? parseSpreadElement() : - token() === 25 ? createNode(198) : + token() === 25 ? createNode(199) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(175); + var node = createNode(176); parseExpected(20); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14128,18 +14194,18 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(124)) { - return parseAccessorDeclaration(151, fullStart, decorators, modifiers); - } - else if (parseContextualModifier(133)) { return parseAccessorDeclaration(152, fullStart, decorators, modifiers); } + else if (parseContextualModifier(134)) { + return parseAccessorDeclaration(153, fullStart, decorators, modifiers); + } return undefined; } function parseObjectLiteralElement() { var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23); if (dotDotDotToken) { - var spreadElement = createNode(260, fullStart); + var spreadElement = createNode(261, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -14158,7 +14224,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(259, fullStart); + var shorthandDeclaration = createNode(260, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57); @@ -14169,7 +14235,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(258, fullStart); + var propertyAssignment = createNode(259, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -14179,7 +14245,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(176); + var node = createNode(177); parseExpected(16); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14193,7 +14259,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(184); + var node = createNode(185); node.modifiers = parseModifiers(); parseExpected(88); node.asteriskToken = parseOptionalToken(38); @@ -14218,12 +14284,12 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(93); if (parseOptional(22)) { - var node_1 = createNode(202, fullStart); + var node_1 = createNode(203, fullStart); node_1.keywordToken = 93; node_1.name = parseIdentifierName(); return finishNode(node_1); } - var node = createNode(180, fullStart); + var node = createNode(181, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18) { @@ -14232,7 +14298,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(205); + var node = createNode(206); if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14263,12 +14329,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(207); + var node = createNode(208); parseExpected(24); return finishNode(node); } function parseIfStatement() { - var node = createNode(209); + var node = createNode(210); parseExpected(89); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -14278,7 +14344,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(210); + var node = createNode(211); parseExpected(80); node.statement = parseStatement(); parseExpected(105); @@ -14289,7 +14355,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(211); + var node = createNode(212); parseExpected(105); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -14312,21 +14378,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(91)) { - var forInStatement = createNode(213, pos); + var forInStatement = createNode(214, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(19); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(140)) { - var forOfStatement = createNode(214, pos); + else if (parseOptional(141)) { + var forOfStatement = createNode(215, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(212, pos); + var forStatement = createNode(213, pos); forStatement.initializer = initializer; parseExpected(24); if (token() !== 24 && token() !== 19) { @@ -14344,7 +14410,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 216 ? 71 : 76); + parseExpected(kind === 217 ? 71 : 76); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -14352,7 +14418,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(217); + var node = createNode(218); parseExpected(95); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -14361,7 +14427,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(218); + var node = createNode(219); parseExpected(106); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -14370,7 +14436,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(254); + var node = createNode(255); parseExpected(72); node.expression = allowInAnd(parseExpression); parseExpected(55); @@ -14378,7 +14444,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(255); + var node = createNode(256); parseExpected(78); parseExpected(55); node.statements = parseList(3, parseStatement); @@ -14388,12 +14454,12 @@ var ts; return token() === 72 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(219); + var node = createNode(220); parseExpected(97); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); - var caseBlock = createNode(233, scanner.getStartPos()); + var caseBlock = createNode(234, scanner.getStartPos()); parseExpected(16); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(17); @@ -14401,14 +14467,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(221); + var node = createNode(222); parseExpected(99); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(222); + var node = createNode(223); parseExpected(101); node.tryBlock = parseBlock(false); node.catchClause = token() === 73 ? parseCatchClause() : undefined; @@ -14419,7 +14485,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(257); + var result = createNode(258); parseExpected(73); if (parseExpected(18)) { result.variableDeclaration = parseVariableDeclaration(); @@ -14429,7 +14495,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(223); + var node = createNode(224); parseExpected(77); parseSemicolon(); return finishNode(node); @@ -14438,13 +14504,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 && parseOptional(55)) { - var labeledStatement = createNode(220, fullStart); + var labeledStatement = createNode(221, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(208, fullStart); + var expressionStatement = createNode(209, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -14473,7 +14539,7 @@ var ts; case 82: return true; case 108: - case 136: + case 137: return nextTokenIsIdentifierOnSameLine(); case 127: case 128: @@ -14490,7 +14556,7 @@ var ts; return false; } continue; - case 139: + case 140: nextToken(); return token() === 16 || token() === 70 || token() === 83; case 90: @@ -14550,8 +14616,8 @@ var ts; case 108: case 127: case 128: - case 136: - case 139: + case 137: + case 140: return true; case 113: case 111: @@ -14596,9 +14662,9 @@ var ts; case 87: return parseForOrForInOrForOfStatement(); case 76: - return parseBreakOrContinueStatement(215); - case 71: return parseBreakOrContinueStatement(216); + case 71: + return parseBreakOrContinueStatement(217); case 95: return parseReturnStatement(); case 106: @@ -14617,7 +14683,7 @@ var ts; return parseDeclaration(); case 119: case 108: - case 136: + case 137: case 127: case 128: case 123: @@ -14631,7 +14697,7 @@ var ts; case 116: case 114: case 130: - case 139: + case 140: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -14654,11 +14720,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 108: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 136: + case 137: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 82: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 139: + case 140: case 127: case 128: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -14677,7 +14743,7 @@ var ts; } default: if (decorators || modifiers) { - var node = createMissingNode(245, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(246, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -14698,16 +14764,16 @@ var ts; } function parseArrayBindingElement() { if (token() === 25) { - return createNode(198); + return createNode(199); } - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -14723,14 +14789,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(172); + var node = createNode(173); parseExpected(16); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(17); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(173); + var node = createNode(174); parseExpected(20); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(21); @@ -14749,7 +14815,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(224); + var node = createNode(225); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -14758,7 +14824,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(225); + var node = createNode(226); switch (token()) { case 103: break; @@ -14772,7 +14838,7 @@ var ts; ts.Debug.fail(); } nextToken(); - if (token() === 140 && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 141 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -14787,7 +14853,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(206, fullStart); + var node = createNode(207, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(false); @@ -14795,7 +14861,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(226, fullStart); + var node = createNode(227, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88); @@ -14808,7 +14874,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(150, pos); + var node = createNode(151, pos); node.decorators = decorators; node.modifiers = modifiers; parseExpected(122); @@ -14817,7 +14883,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(149, fullStart); + var method = createNode(150, fullStart); method.decorators = decorators; method.modifiers = modifiers; method.asteriskToken = asteriskToken; @@ -14830,7 +14896,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(147, fullStart); + var property = createNode(148, fullStart); property.decorators = decorators; property.modifiers = modifiers; property.name = name; @@ -14900,7 +14966,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 133 || idToken === 124) { + if (!ts.isKeyword(idToken) || idToken === 134 || idToken === 124) { return true; } switch (token()) { @@ -14923,7 +14989,7 @@ var ts; if (!parseOptional(56)) { break; } - var decorator = createNode(145, decoratorStart); + var decorator = createNode(146, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); finishNode(decorator); if (!decorators) { @@ -14980,7 +15046,7 @@ var ts; } function parseClassElement() { if (token() === 24) { - var result = createNode(204); + var result = createNode(205); nextToken(); return finishNode(result); } @@ -15005,16 +15071,16 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_13 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, undefined); + var name = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 197); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 198); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 227); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 228); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -15049,7 +15115,7 @@ var ts; } function parseHeritageClause() { if (token() === 84 || token() === 107) { - var node = createNode(256); + var node = createNode(257); node.token = token(); nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -15058,7 +15124,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(199); + var node = createNode(200); node.expression = parseLeftHandSideExpressionOrHigher(); if (token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); @@ -15072,7 +15138,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228, fullStart); + var node = createNode(229, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108); @@ -15083,10 +15149,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229, fullStart); + var node = createNode(230, fullStart); node.decorators = decorators; node.modifiers = modifiers; - parseExpected(136); + parseExpected(137); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(57); @@ -15095,13 +15161,13 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(261, scanner.getStartPos()); + var node = createNode(262, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230, fullStart); + var node = createNode(231, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82); @@ -15116,7 +15182,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(232, scanner.getStartPos()); + var node = createNode(233, scanner.getStartPos()); if (parseExpected(16)) { node.statements = parseList(1, parseStatement); parseExpected(17); @@ -15127,7 +15193,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(231, fullStart); + var node = createNode(232, fullStart); var namespaceFlag = flags & 16; node.decorators = decorators; node.modifiers = modifiers; @@ -15139,10 +15205,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(231, fullStart); + var node = createNode(232, fullStart); node.decorators = decorators; node.modifiers = modifiers; - if (token() === 139) { + if (token() === 140) { node.name = parseIdentifier(); node.flags |= 512; } @@ -15159,7 +15225,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = 0; - if (token() === 139) { + if (token() === 140) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } else if (parseOptional(128)) { @@ -15184,7 +15250,7 @@ var ts; return nextToken() === 40; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(234, fullStart); + var exportDeclaration = createNode(235, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117); @@ -15199,8 +15265,8 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 25 && token() !== 138) { - var importEqualsDeclaration = createNode(235, fullStart); + if (token() !== 25 && token() !== 139) { + var importEqualsDeclaration = createNode(236, fullStart); importEqualsDeclaration.decorators = decorators; importEqualsDeclaration.modifiers = modifiers; importEqualsDeclaration.name = identifier; @@ -15210,27 +15276,27 @@ var ts; return addJSDocComment(finishNode(importEqualsDeclaration)); } } - var importDeclaration = createNode(236, fullStart); + var importDeclaration = createNode(237, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; if (identifier || token() === 38 || token() === 16) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(138); + parseExpected(139); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(237, fullStart); + var importClause = createNode(238, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(25)) { - importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(239); + importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(240); } return finishNode(importClause); } @@ -15240,7 +15306,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(246); + var node = createNode(247); parseExpected(131); parseExpected(18); node.expression = parseModuleSpecifier(); @@ -15258,7 +15324,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(238); + var namespaceImport = createNode(239); parseExpected(38); parseExpected(117); namespaceImport.name = parseIdentifier(); @@ -15266,14 +15332,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 239 ? parseImportSpecifier : parseExportSpecifier, 16, 17); + node.elements = parseBracketedList(22, kind === 240 ? parseImportSpecifier : parseExportSpecifier, 16, 17); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(244); + return parseImportOrExportSpecifier(245); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(240); + return parseImportOrExportSpecifier(241); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -15292,23 +15358,23 @@ var ts; else { node.name = identifierName; } - if (kind === 240 && checkIdentifierIsKeyword) { + if (kind === 241 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(242, fullStart); + var node = createNode(243, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38)) { - parseExpected(138); + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(243); - if (token() === 138 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(138); + node.exportClause = parseNamedImportsOrExports(244); + if (token() === 139 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -15316,7 +15382,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(241, fullStart); + var node = createNode(242, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57)) { @@ -15395,10 +15461,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 235 && node.moduleReference.kind === 246 - || node.kind === 236 - || node.kind === 241 + || node.kind === 236 && node.moduleReference.kind === 247 + || node.kind === 237 || node.kind === 242 + || node.kind === 243 ? node : undefined; }); @@ -15434,7 +15500,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression() { - var result = createNode(263, scanner.getTokenPos()); + var result = createNode(264, scanner.getTokenPos()); parseExpected(16); result.type = parseJSDocTopLevelType(); parseExpected(17); @@ -15445,12 +15511,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48) { - var unionType = createNode(267, type.pos); + var unionType = createNode(268, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57) { - var optionalType = createNode(274, type.pos); + var optionalType = createNode(275, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -15461,20 +15527,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20) { - var arrayType = createNode(266, type.pos); + var arrayType = createNode(267, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21); type = finishNode(arrayType); } else if (token() === 54) { - var nullableType = createNode(269, type.pos); + var nullableType = createNode(270, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50) { - var nonNullableType = createNode(270, type.pos); + var nonNullableType = createNode(271, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -15508,14 +15574,15 @@ var ts; case 98: return parseJSDocThisType(); case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: case 94: - case 137: + case 138: case 129: + case 133: return parseTokenNode(); case 9: case 8: @@ -15526,27 +15593,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(278); + var result = createNode(279); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(277); + var result = createNode(278); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(276); + var result = createNode(277); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(275); + var result = createNode(276); nextToken(); parseExpected(18); result.parameters = parseDelimitedList(23, parseJSDocParameter); @@ -15559,7 +15626,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(144); + var parameter = createNode(145); parameter.type = parseJSDocType(); if (parseOptional(57)) { parameter.questionToken = createNode(57); @@ -15567,7 +15634,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(273); + var result = createNode(274); result.name = parseSimplePropertyName(); if (token() === 26) { result.typeArguments = parseTypeArguments(); @@ -15601,24 +15668,24 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(141, left.pos); + var result = createNode(142, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(271); + var result = createNode(272); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(270); + var result = createNode(271); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(268); + var result = createNode(269); nextToken(); result.types = parseDelimitedList(26, parseJSDocType); checkForTrailingComma(result.types); @@ -15632,7 +15699,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(267); + var result = createNode(268); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19); @@ -15648,12 +15715,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(264); + var result = createNode(265); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(289); + var result = createNode(290); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -15666,11 +15733,11 @@ var ts; token() === 28 || token() === 57 || token() === 48) { - var result = createNode(265, pos); + var result = createNode(266, pos); return finishNode(result); } else { - var result = createNode(269, pos); + var result = createNode(270, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -15814,7 +15881,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(279, start); + var result = createNode(280, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -15924,7 +15991,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(280, atToken.pos); + var result = createNode(281, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -15979,7 +16046,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(282, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -15990,20 +16057,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(284, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -16018,7 +16085,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(287, atToken.pos); + var result = createNode(288, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -16027,7 +16094,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(281, atToken.pos); + var result = createNode(282, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -16036,25 +16103,28 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(286, atToken.pos); + var typedefTag = createNode(287, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); if (typedefTag.fullName) { var rightNode = typedefTag.fullName; - while (rightNode.kind !== 70) { + while (true) { + if (rightNode.kind === 70 || !rightNode.body) { + typedefTag.name = rightNode.kind === 70 ? rightNode : rightNode.name; + break; + } rightNode = rightNode.body; } - typedefTag.name = rightNode; } typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 273) { + if (typeExpression.type.kind === 274) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { - var name_14 = jsDocTypeReference.name; - if (name_14.text === "Object") { + var name = jsDocTypeReference.name; + if (name.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -16068,7 +16138,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(288, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(289, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -16109,7 +16179,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22)) { - var jsDocNamespaceNode = createNode(231, pos); + var jsDocNamespaceNode = createNode(232, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -16153,19 +16223,19 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 285; })) { + if (ts.forEach(tags, function (t) { return t.kind === 286; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); while (true) { - var name_15 = parseJSDocIdentifierName(); + var name = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_15) { + if (!name) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143, name_15.pos); - typeParameter.name = name_15; + var typeParameter = createNode(144, name.pos); + typeParameter.name = name; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25) { @@ -16176,7 +16246,7 @@ var ts; break; } } - var result = createNode(285, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -16495,16 +16565,16 @@ var ts; var ts; (function (ts) { function getModuleInstanceState(node) { - if (node.kind === 228 || node.kind === 229) { + if (node.kind === 229 || node.kind === 230) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 236 || node.kind === 235) && !(ts.hasModifier(node, 1))) { + else if ((node.kind === 237 || node.kind === 236) && !(ts.hasModifier(node, 1))) { return 0; } - else if (node.kind === 232) { + else if (node.kind === 233) { var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -16520,7 +16590,7 @@ var ts; }); return state_1; } - else if (node.kind === 231) { + else if (node.kind === 232) { var body = node.body; return body ? getModuleInstanceState(body) : 1; } @@ -16629,7 +16699,7 @@ var ts; if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 231)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 232)) { symbol.valueDeclaration = node; } } @@ -16639,7 +16709,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 142) { + if (node.name.kind === 143) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; @@ -16650,21 +16720,21 @@ var ts; return node.name.text; } switch (node.kind) { - case 150: + case 151: return "__constructor"; - case 158: - case 153: - return "__call"; case 159: case 154: - return "__new"; + return "__call"; + case 160: case 155: + return "__new"; + case 156: return "__index"; - case 242: + case 243: return "__export"; - case 241: + case 242: return node.isExportEquals ? "export=" : "default"; - case 192: + case 193: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2: return "export="; @@ -16676,20 +16746,20 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 226: case 227: + case 228: return ts.hasModifier(node, 512) ? "default" : undefined; - case 275: + case 276: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 144: - ts.Debug.assert(node.parent.kind === 275); + case 145: + ts.Debug.assert(node.parent.kind === 276); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 286: + case 287: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 206) { + if (parentNode && parentNode.kind === 207) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -16712,13 +16782,16 @@ var ts; symbol = createSymbol(0, "__missing"); } else { - symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0, name)); + symbol = symbolTable.get(name); + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(0, name)); + } if (name && (includes & 788448)) { - classifiableNames[name] = name; + classifiableNames.set(name, name); } if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { - symbol = symbolTable[name] = createSymbol(0, name); + symbolTable.set(name, symbol = createSymbol(0, name)); } else { if (node.name) { @@ -16733,7 +16806,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 241 && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 242 && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -16753,7 +16826,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 244 || (node.kind === 235 && hasExportModifier)) { + if (node.kind === 245 || (node.kind === 236 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -16761,7 +16834,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 286 && + var isJSDocTypedefInJSDocNamespace = node.kind === 287 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -16822,7 +16895,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 262) { + if (node.kind === 263) { node.flags |= emitFlags; } if (isIIFE) { @@ -16898,64 +16971,64 @@ var ts; return; } switch (node.kind) { - case 211: + case 212: bindWhileStatement(node); break; - case 210: + case 211: bindDoStatement(node); break; - case 212: + case 213: bindForStatement(node); break; - case 213: case 214: + case 215: bindForInOrForOfStatement(node); break; - case 209: + case 210: bindIfStatement(node); break; - case 217: - case 221: + case 218: + case 222: bindReturnOrThrow(node); break; + case 217: case 216: - case 215: bindBreakOrContinueStatement(node); break; - case 222: + case 223: bindTryStatement(node); break; - case 219: + case 220: bindSwitchStatement(node); break; - case 233: + case 234: bindCaseBlock(node); break; - case 254: + case 255: bindCaseClause(node); break; - case 220: + case 221: bindLabeledStatement(node); break; - case 190: + case 191: bindPrefixUnaryExpressionFlow(node); break; - case 191: + case 192: bindPostfixUnaryExpressionFlow(node); break; - case 192: + case 193: bindBinaryExpressionFlow(node); break; - case 186: + case 187: bindDeleteExpressionFlow(node); break; - case 193: + case 194: bindConditionalExpressionFlow(node); break; - case 224: + case 225: bindVariableDeclarationFlow(node); break; - case 179: + case 180: bindCallExpressionFlow(node); break; default: @@ -16967,15 +17040,15 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 178: return isNarrowableReference(expr); - case 179: + case 180: return hasNarrowableArgument(expr); - case 183: + case 184: return isNarrowingExpression(expr.expression); - case 192: + case 193: return isNarrowingBinaryExpression(expr); - case 190: + case 191: return expr.operator === 50 && isNarrowingExpression(expr.operand); } return false; @@ -16983,7 +17056,7 @@ var ts; function isNarrowableReference(expr) { return expr.kind === 70 || expr.kind === 98 || - expr.kind === 177 && isNarrowableReference(expr.expression); + expr.kind === 178 && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -16994,14 +17067,14 @@ var ts; } } } - if (expr.expression.kind === 177 && + if (expr.expression.kind === 178 && isNarrowableReference(expr.expression.expression)) { return true; } return false; } function isNarrowingTypeofOperands(expr1, expr2) { - return expr1.kind === 187 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; + return expr1.kind === 188 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { @@ -17022,9 +17095,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 183: + case 184: return isNarrowableOperand(expr.expression); - case 192: + case 193: switch (expr.operatorToken.kind) { case 57: return isNarrowableOperand(expr.left); @@ -17118,33 +17191,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 209: - case 211: case 210: - return parent.expression === node; case 212: - case 193: + case 211: + return parent.expression === node; + case 213: + case 194: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 183) { + if (node.kind === 184) { node = node.expression; } - else if (node.kind === 190 && node.operator === 50) { + else if (node.kind === 191 && node.operator === 50) { node = node.operand; } else { - return node.kind === 192 && (node.operatorToken.kind === 52 || + return node.kind === 193 && (node.operatorToken.kind === 52 || node.operatorToken.kind === 53); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 183 || - node.parent.kind === 190 && + while (node.parent.kind === 184 || + node.parent.kind === 191 && node.parent.operator === 50) { node = node.parent; } @@ -17186,7 +17259,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 220 + var enclosingLabeledStatement = node.parent.kind === 221 ? ts.lastOrUndefined(activeLabels) : undefined; var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); @@ -17221,7 +17294,7 @@ var ts; bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 225) { + if (node.initializer.kind !== 226) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -17243,7 +17316,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 217) { + if (node.kind === 218) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -17263,7 +17336,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 216 ? breakTarget : continueTarget; + var flowLabel = node.kind === 217 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -17320,7 +17393,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 255; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 256; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -17385,13 +17458,13 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 210) { + if (!node.statement || node.statement.kind !== 211) { addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 192 && node.operatorToken.kind === 57) { + if (node.kind === 193 && node.operatorToken.kind === 57) { bindAssignmentTargetFlow(node.left); } else { @@ -17402,10 +17475,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 175) { + else if (node.kind === 176) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 196) { + if (e.kind === 197) { bindAssignmentTargetFlow(e.expression); } else { @@ -17413,16 +17486,16 @@ var ts; } } } - else if (node.kind === 176) { + else if (node.kind === 177) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 258) { + if (p.kind === 259) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 259) { + else if (p.kind === 260) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 260) { + else if (p.kind === 261) { bindAssignmentTargetFlow(p.expression); } } @@ -17478,7 +17551,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 57 && node.left.kind === 178) { + if (operator === 57 && node.left.kind === 179) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -17489,7 +17562,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { bindAssignmentTargetFlow(node.expression); } } @@ -17522,16 +17595,16 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 213 || node.parent.parent.kind === 214) { + if (node.initializer || node.parent.parent.kind === 214 || node.parent.parent.kind === 215) { bindInitializedVariableFlow(node); } } function bindCallExpressionFlow(node) { var expr = node.expression; - while (expr.kind === 183) { + while (expr.kind === 184) { expr = expr.expression; } - if (expr.kind === 184 || expr.kind === 185) { + if (expr.kind === 185 || expr.kind === 186) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -17539,7 +17612,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -17548,52 +17621,52 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 197: - case 227: - case 230: - case 176: - case 161: - case 288: - case 271: - return 1; + case 198: case 228: - return 1 | 64; - case 275: case 231: + case 177: + case 162: + case 289: + case 272: + return 1; case 229: - case 170: + return 1 | 64; + case 276: + case 232: + case 230: + case 171: return 1 | 32; - case 262: + case 263: return 1 | 4 | 32; - case 149: + case 150: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 | 4 | 32 | 8 | 128; } - case 150: - case 226: - case 148: case 151: + case 227: + case 149: case 152: case 153: case 154: case 155: - case 158: + case 156: case 159: + case 160: return 1 | 4 | 32 | 8; - case 184: case 185: + case 186: return 1 | 4 | 32 | 8 | 16; - case 232: + case 233: return 4; - case 147: + case 148: return node.initializer ? 4 : 0; - case 257: - case 212: + case 258: case 213: case 214: - case 233: + case 215: + case 234: return 2; - case 205: + case 206: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -17609,37 +17682,37 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 231: + case 232: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 262: + case 263: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 197: - case 227: + case 198: + case 228: return declareClassMember(node, symbolFlags, symbolExcludes); - case 230: + case 231: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 161: - case 176: - case 228: - case 271: - case 288: + case 162: + case 177: + case 229: + case 272: + case 289: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 158: case 159: - case 153: + case 160: case 154: case 155: - case 149: - case 148: + case 156: case 150: + case 149: case 151: case 152: - case 226: - case 184: + case 153: + case 227: case 185: - case 275: - case 229: - case 170: + case 186: + case 276: + case 230: + case 171: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -17654,11 +17727,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 262 ? node : node.body; - if (body && (body.kind === 262 || body.kind === 232)) { + var body = node.kind === 263 ? node : node.body; + if (body && (body.kind === 263 || body.kind === 233)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 242 || stat.kind === 241) { + if (stat.kind === 243 || stat.kind === 242) { return true; } } @@ -17680,7 +17753,7 @@ var ts; errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (ts.isExternalModuleAugmentation(node)) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); + declareModuleSymbol(node); } else { var pattern = void 0; @@ -17700,12 +17773,8 @@ var ts; } } else { - var state = getModuleInstanceState(node); - if (state === 0) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); - } - else { - declareSymbolAndAddToSymbolTable(node, 512, 106639); + var state = declareModuleSymbol(node); + if (state !== 0) { if (node.symbol.flags & (16 | 32 | 256)) { node.symbol.constEnumOnlyModule = false; } @@ -17721,29 +17790,35 @@ var ts; } } } + function declareModuleSymbol(node) { + var state = getModuleInstanceState(node); + var instantiated = state !== 0; + declareSymbolAndAddToSymbolTable(node, instantiated ? 512 : 1024, instantiated ? 106639 : 0); + return state; + } function bindFunctionOrConstructorType(node) { var symbol = createSymbol(131072, getDeclarationName(node)); addDeclarationToSymbol(symbol, node, 131072); var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048); typeLiteralSymbol.members = ts.createMap(); - typeLiteralSymbol.members[symbol.name] = symbol; + typeLiteralSymbol.members.set(symbol.name, symbol); } function bindObjectLiteralExpression(node) { if (inStrictMode) { var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 260 || prop.name.kind !== 70) { + if (prop.kind === 261 || prop.name.kind !== 70) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 258 || prop.kind === 259 || prop.kind === 149 + var currentKind = prop.kind === 259 || prop.kind === 260 || prop.kind === 150 ? 1 : 2; - var existingKind = seen[identifier.text]; + var existingKind = seen.get(identifier.text); if (!existingKind) { - seen[identifier.text] = currentKind; + seen.set(identifier.text, currentKind); continue; } if (currentKind === 1 && existingKind === 1) { @@ -17760,10 +17835,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 231: + case 232: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 262: + case 263: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -17853,8 +17928,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 262 && - blockScopeContainer.kind !== 231 && + if (blockScopeContainer.kind !== 263 && + blockScopeContainer.kind !== 232 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -17897,7 +17972,7 @@ var ts; node.parent = parent; var saveInStrictMode = inStrictMode; bindWorker(node); - if (node.kind > 140) { + if (node.kind > 141) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -17937,23 +18012,23 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 286) { + while (parentNode && parentNode.kind !== 287) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); break; } case 98: - if (currentFlow && (ts.isExpression(node) || parent.kind === 259)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 260)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 177: + case 178: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } break; - case 192: + case 193: if (ts.isInJavaScriptFile(node)) { var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { @@ -17976,48 +18051,48 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 257: + case 258: return checkStrictModeCatchClause(node); - case 186: + case 187: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 191: + case 192: return checkStrictModePostfixUnaryExpression(node); - case 190: + case 191: return checkStrictModePrefixUnaryExpression(node); - case 218: + case 219: return checkStrictModeWithStatement(node); - case 167: + case 168: seenThisKeyword = true; return; - case 156: + case 157: return checkTypePredicate(node); - case 143: - return declareSymbolAndAddToSymbolTable(node, 262144, 530920); case 144: + return declareSymbolAndAddToSymbolTable(node, 262144, 530920); + case 145: return bindParameter(node); - case 224: - case 174: + case 225: + case 175: return bindVariableDeclarationOrBindingElement(node); + case 148: case 147: - case 146: - case 272: + case 273: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 287: + case 288: return bindJSDocProperty(node); - case 258: case 259: + case 260: return bindPropertyOrMethodOrAccessor(node, 4, 0); - case 261: + case 262: return bindPropertyOrMethodOrAccessor(node, 8, 900095); - case 260: - case 252: + case 261: + case 253: var root = container; var hasRest = false; while (root.parent) { - if (root.kind === 176 && - root.parent.kind === 192 && + if (root.kind === 177 && + root.parent.kind === 193 && root.parent.operatorToken.kind === 57 && root.parent.left === root) { hasRest = true; @@ -18026,78 +18101,78 @@ var ts; root = root.parent; } return; - case 153: case 154: case 155: + case 156: return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 150: case 149: - case 148: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); - case 226: + case 227: return bindFunctionDeclaration(node); - case 150: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 151: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 152: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 153: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 158: case 159: - case 275: + case 160: + case 276: return bindFunctionOrConstructorType(node); - case 161: - case 170: - case 288: - case 271: + case 162: + case 171: + case 289: + case 272: return bindAnonymousDeclaration(node, 2048, "__type"); - case 176: + case 177: return bindObjectLiteralExpression(node); - case 184: case 185: + case 186: return bindFunctionExpression(node); - case 179: + case 180: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 197: - case 227: + case 198: + case 228: inStrictMode = true; return bindClassLikeDeclaration(node); - case 228: + case 229: return bindBlockScopedDeclaration(node, 64, 792968); - case 286: + case 287: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } break; - case 229: - return bindBlockScopedDeclaration(node, 524288, 793064); case 230: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 524288, 793064); case 231: + return bindEnumDeclaration(node); + case 232: return bindModuleDeclaration(node); - case 235: - case 238: - case 240: - case 244: + case 236: + case 239: + case 241: + case 245: return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 234: + case 235: return bindNamespaceExportDeclaration(node); - case 237: + case 238: return bindImportClause(node); - case 242: + case 243: return bindExportDeclaration(node); - case 241: + case 242: return bindExportAssignment(node); - case 262: + case 263: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 205: + case 206: if (!ts.isFunctionLike(node.parent)) { return; } - case 232: + case 233: return updateStrictModeStatementList(node.statements); } } @@ -18106,7 +18181,7 @@ var ts; if (parameterName && parameterName.kind === 70) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 167) { + if (parameterName && parameterName.kind === 168) { seenThisKeyword = true; } bind(type); @@ -18125,7 +18200,7 @@ var ts; bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } else { - var flags = node.kind === 241 && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 242 && ts.exportAssignmentIsAlias(node) ? 8388608 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16); @@ -18135,17 +18210,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 262) { + if (node.parent.kind !== 263) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_4 = node.parent; - if (!ts.isExternalModule(parent_4)) { + var parent_1 = node.parent; + if (!ts.isExternalModule(parent_1)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_4.isDeclarationFile) { + if (!parent_1.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -18184,11 +18259,11 @@ var ts; } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); - if (container.kind === 226 || container.kind === 184) { + if (container.kind === 227 || container.kind === 185) { container.symbol.members = container.symbol.members || ts.createMap(); declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); } - else if (container.kind === 150) { + else if (container.kind === 151) { var saveContainer = container; container = container.parent; var symbol = bindPropertyOrMethodOrAccessor(node, 4, 0); @@ -18205,7 +18280,7 @@ var ts; leftSideOfAssignment.parent = node; constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - var funcSymbol = container.locals[constructorFunction.text]; + var funcSymbol = container.locals.get(constructorFunction.text); if (!funcSymbol || !(funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) { return; } @@ -18220,25 +18295,26 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 227) { + if (node.kind === 228) { bindBlockScopedDeclaration(node, 32, 899519); } else { var bindingName = node.name ? node.name.text : "__class"; bindAnonymousDeclaration(node, 32, bindingName); if (node.name) { - classifiableNames[node.name.text] = node.name.text; + classifiableNames.set(node.name.text, node.name.text); } } var symbol = node.symbol; var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); - if (symbol.exports[prototypeSymbol.name]) { + var symbolExport = symbol.exports.get(prototypeSymbol.name); + if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; + symbol.exports.set(prototypeSymbol.name, prototypeSymbol); prototypeSymbol.parent = symbol; } function bindEnumDeclaration(node) { @@ -18330,15 +18406,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 207) || - node.kind === 227 || - (node.kind === 231 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 230 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 208) || + node.kind === 228 || + (node.kind === 232 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 231 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 206 || + (node.kind !== 207 || ts.getCombinedNodeFlags(node.declarationList) & 3 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -18352,56 +18428,56 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 179: - return computeCallExpression(node, subtreeFlags); case 180: + return computeCallExpression(node, subtreeFlags); + case 181: return computeNewExpression(node, subtreeFlags); - case 231: + case 232: return computeModuleDeclaration(node, subtreeFlags); - case 183: + case 184: return computeParenthesizedExpression(node, subtreeFlags); - case 192: + case 193: return computeBinaryExpression(node, subtreeFlags); - case 208: + case 209: return computeExpressionStatement(node, subtreeFlags); - case 144: + case 145: return computeParameter(node, subtreeFlags); - case 185: + case 186: return computeArrowFunction(node, subtreeFlags); - case 184: + case 185: return computeFunctionExpression(node, subtreeFlags); - case 226: + case 227: return computeFunctionDeclaration(node, subtreeFlags); - case 224: - return computeVariableDeclaration(node, subtreeFlags); case 225: + return computeVariableDeclaration(node, subtreeFlags); + case 226: return computeVariableDeclarationList(node, subtreeFlags); - case 206: + case 207: return computeVariableStatement(node, subtreeFlags); - case 220: + case 221: return computeLabeledStatement(node, subtreeFlags); - case 227: + case 228: return computeClassDeclaration(node, subtreeFlags); - case 197: + case 198: return computeClassExpression(node, subtreeFlags); - case 256: - return computeHeritageClause(node, subtreeFlags); case 257: + return computeHeritageClause(node, subtreeFlags); + case 258: return computeCatchClause(node, subtreeFlags); - case 199: + case 200: return computeExpressionWithTypeArguments(node, subtreeFlags); - case 150: + case 151: return computeConstructor(node, subtreeFlags); - case 147: + case 148: return computePropertyDeclaration(node, subtreeFlags); - case 149: + case 150: return computeMethod(node, subtreeFlags); - case 151: case 152: + case 153: return computeAccessor(node, subtreeFlags); - case 235: + case 236: return computeImportEquals(node, subtreeFlags); - case 177: + case 178: return computePropertyAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -18426,8 +18502,8 @@ var ts; switch (kind) { case 96: return true; - case 177: case 178: + case 179: var expression = node.expression; var expressionKind = expression.kind; return expressionKind === 96; @@ -18449,10 +18525,10 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 57 && leftKind === 176) { + if (operatorTokenKind === 57 && leftKind === 177) { transformFlags |= 8 | 192 | 3072; } - else if (operatorTokenKind === 57 && leftKind === 175) { + else if (operatorTokenKind === 57 && leftKind === 176) { transformFlags |= 192 | 3072; } else if (operatorTokenKind === 39 @@ -18491,8 +18567,8 @@ var ts; var expression = node.expression; var expressionKind = expression.kind; var expressionTransformFlags = expression.transformFlags; - if (expressionKind === 200 - || expressionKind === 182) { + if (expressionKind === 201 + || expressionKind === 183) { transformFlags |= 3; } if (expressionTransformFlags & 1024) { @@ -18778,7 +18854,7 @@ var ts; var excludeFlags = 536872257; switch (kind) { case 119: - case 189: + case 190: transformFlags |= 16; break; case 113: @@ -18787,51 +18863,51 @@ var ts; case 116: case 123: case 75: - case 230: - case 261: - case 182: - case 200: + case 231: + case 262: + case 183: case 201: + case 202: case 130: transformFlags |= 3; break; - case 247: case 248: case 249: - case 10: case 250: + case 10: case 251: case 252: case 253: + case 254: transformFlags |= 4; break; - case 214: + case 215: transformFlags |= 8; case 12: case 13: case 14: case 15: - case 194: - case 181: - case 259: + case 195: + case 182: + case 260: case 114: - case 202: + case 203: transformFlags |= 192; break; - case 195: + case 196: transformFlags |= 192 | 16777216; break; case 118: case 132: case 129: - case 134: - case 121: + case 133: case 135: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: case 156: @@ -18845,26 +18921,27 @@ var ts; case 164: case 165: case 166: - case 228: - case 229: case 167: + case 229: + case 230: case 168: case 169: case 170: case 171: + case 172: transformFlags = 3; excludeFlags = -3; break; - case 142: + case 143: transformFlags |= 2097152; if (subtreeFlags & 16384) { transformFlags |= 65536; } break; - case 196: + case 197: transformFlags |= 192 | 524288; break; - case 260: + case 261: transformFlags |= 8 | 1048576; break; case 96: @@ -18873,27 +18950,27 @@ var ts; case 98: transformFlags |= 16384; break; - case 172: + case 173: transformFlags |= 192 | 8388608; if (subtreeFlags & 524288) { transformFlags |= 8 | 1048576; } excludeFlags = 537396545; break; - case 173: + case 174: transformFlags |= 192 | 8388608; excludeFlags = 537396545; break; - case 174: + case 175: transformFlags |= 192; if (node.dotDotDotToken) { transformFlags |= 524288; } break; - case 145: + case 146: transformFlags |= 3 | 4096; break; - case 176: + case 177: excludeFlags = 540087617; if (subtreeFlags & 2097152) { transformFlags |= 192; @@ -18905,29 +18982,29 @@ var ts; transformFlags |= 8; } break; - case 175: - case 180: + case 176: + case 181: excludeFlags = 537396545; if (subtreeFlags & 524288) { transformFlags |= 192; } break; - case 210: case 211: case 212: case 213: + case 214: if (subtreeFlags & 4194304) { transformFlags |= 192; } break; - case 262: + case 263: if (subtreeFlags & 32768) { transformFlags |= 192; } break; - case 217: - case 215: + case 218: case 216: + case 217: transformFlags |= 33554432; break; } @@ -18935,56 +19012,57 @@ var ts; return transformFlags & ~excludeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 156 && kind <= 171) { + if (kind >= 157 && kind <= 172) { return -3; } switch (kind) { - case 179: case 180: - case 175: + case 181: + case 176: return 537396545; - case 231: + case 232: return 574674241; - case 144: + case 145: return 536872257; - case 185: + case 186: return 601249089; - case 184: - case 226: + case 185: + case 227: return 601281857; - case 225: + case 226: return 546309441; - case 227: - case 197: + case 228: + case 198: return 539358529; - case 150: - return 601015617; - case 149: case 151: + return 601015617; + case 150: case 152: + case 153: return 601015617; case 118: case 132: case 129: - case 134: - case 121: case 135: + case 133: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: - case 228: + case 156: case 229: + case 230: return -3; - case 176: + case 177: return 540087617; - case 257: + case 258: return 537920833; - case 172: case 173: + case 174: return 537396545; default: return 536872257; @@ -19228,9 +19306,10 @@ var ts; if (!moduleHasNonRelativeName(nonRelativeModuleName)) { return undefined; } - var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); if (!perModuleNameCache) { - moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); } return perModuleNameCache; } @@ -19250,12 +19329,12 @@ var ts; var commonPrefix = getCommonPrefix(path, resolvedFileName); var current = path; while (true) { - var parent_5 = ts.getDirectoryPath(current); - if (parent_5 === current || directoryPathMap.contains(parent_5)) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { break; } - directoryPathMap.set(parent_5, result); - current = parent_5; + directoryPathMap.set(parent, result); + current = parent; if (current == commonPrefix) { break; } @@ -19286,7 +19365,7 @@ var ts; } var containingDirectory = ts.getDirectoryPath(containingFile); var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); - var result = perFolderCache && perFolderCache[moduleName]; + var result = perFolderCache && perFolderCache.get(moduleName); if (result) { if (traceEnabled) { trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); @@ -19314,7 +19393,7 @@ var ts; break; } if (perFolderCache) { - perFolderCache[moduleName] = result; + perFolderCache.set(moduleName, result); var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); if (perModuleNameCache) { perModuleNameCache.set(containingDirectory, result); @@ -19809,6 +19888,7 @@ var ts; getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, getTypeFromTypeNode: getTypeFromTypeNode, + getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, @@ -19833,6 +19913,7 @@ var ts; getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule, getAmbientModules: getAmbientModules, getJsxElementAttributesType: getJsxElementAttributesType, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, @@ -19868,6 +19949,7 @@ var ts; var voidType = createIntrinsicType(1024, "void"); var neverType = createIntrinsicType(8192, "never"); var silentNeverType = createIntrinsicType(8192, "never"); + var nonPrimitiveType = createIntrinsicType(16777216, "object"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); @@ -19877,6 +19959,7 @@ var ts; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); @@ -19938,7 +20021,7 @@ var ts; var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); - var typeofEQFacts = ts.createMap({ + var typeofEQFacts = ts.createMapFromTemplate({ "string": 1, "number": 2, "boolean": 4, @@ -19947,7 +20030,7 @@ var ts; "object": 16, "function": 32 }); - var typeofNEFacts = ts.createMap({ + var typeofNEFacts = ts.createMapFromTemplate({ "string": 128, "number": 256, "boolean": 512, @@ -19956,7 +20039,7 @@ var ts; "object": 2048, "function": 4096 }); - var typeofTypesByName = ts.createMap({ + var typeofTypesByName = ts.createMapFromTemplate({ "string": stringType, "number": numberType, "boolean": booleanType, @@ -19983,7 +20066,7 @@ var ts; var enumRelation = ts.createMap(); var _displayBuilder; var builtinGlobals = ts.createMap(); - builtinGlobals[undefinedSymbol.name] = undefinedSymbol; + builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); initializeTypeChecker(); return checker; function getJsxNamespace() { @@ -20081,7 +20164,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 231 && source.valueDeclaration.kind !== 231))) { + (target.valueDeclaration.kind === 232 && source.valueDeclaration.kind !== 232))) { target.valueDeclaration = source.valueDeclaration; } ts.addRange(target.declarations, source.declarations); @@ -20097,6 +20180,9 @@ var ts; } recordMergedSymbol(target, source); } + else if (target.flags & 1024) { + error(source.valueDeclaration.name, ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } else { var message_2 = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; @@ -20109,18 +20195,19 @@ var ts; } } function mergeSymbolTable(target, source) { - for (var id in source) { - var targetSymbol = target[id]; + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); if (!targetSymbol) { - target[id] = source[id]; + target.set(id, sourceSymbol); } else { if (!(targetSymbol.flags & 33554432)) { - target[id] = targetSymbol = cloneSymbol(targetSymbol); + targetSymbol = cloneSymbol(targetSymbol); + target.set(id, targetSymbol); } - mergeSymbol(targetSymbol, source[id]); + mergeSymbol(targetSymbol, sourceSymbol); } - } + }); } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; @@ -20150,14 +20237,15 @@ var ts; } } function addToSymbolTable(target, source, message) { - for (var id in source) { - if (target[id]) { - ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); + if (targetSymbol) { + ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); } else { - target[id] = source[id]; + target.set(id, sourceSymbol); } - } + }); function addDeclarationDiagnostic(id, message) { return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; } @@ -20176,11 +20264,11 @@ var ts; return type.flags & 32768 ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 262 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 263 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { - var symbol = symbols[name]; + var symbol = symbols.get(name); if (symbol) { ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { @@ -20220,15 +20308,15 @@ var ts; return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - if (declaration.kind === 174) { - var errorBindingElement = ts.getAncestor(usage, 174); + if (declaration.kind === 175) { + var errorBindingElement = ts.getAncestor(usage, 175); if (errorBindingElement) { return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || declaration.pos < errorBindingElement.pos; } - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 224), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 225), usage); } - else if (declaration.kind === 224) { + else if (declaration.kind === 225) { return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } return true; @@ -20238,17 +20326,17 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 206: - case 212: - case 214: + case 207: + case 213: + case 215: if (isSameScopeDescendentOf(usage, declaration, container)) { return true; } break; } switch (declaration.parent.parent.kind) { - case 213: case 214: + case 215: if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; } @@ -20265,7 +20353,7 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 147 && + current.parent.kind === 148 && (ts.getModifierFlags(current.parent) & 32) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { @@ -20297,18 +20385,18 @@ var ts; if (result = getSymbol(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 279) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 280) { useResult = result.flags & 262144 ? lastLocation === location.type || - lastLocation.kind === 144 || - lastLocation.kind === 143 + lastLocation.kind === 145 || + lastLocation.kind === 144 : false; } if (meaning & 107455 && result.flags & 1) { useResult = - lastLocation.kind === 144 || + lastLocation.kind === 145 || (lastLocation === location.type && - result.valueDeclaration.kind === 144); + result.valueDeclaration.kind === 145); } } if (useResult) { @@ -20320,23 +20408,24 @@ var ts; } } switch (location.kind) { - case 262: + case 263: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 231: + case 232: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 262 || ts.isAmbientModule(location)) { - if (result = moduleExports["default"]) { + if (location.kind === 263 || ts.isAmbientModule(location)) { + if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; } - if (moduleExports[name] && - moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 244)) { + var moduleExport = moduleExports.get(name); + if (moduleExport && + moduleExport.flags === 8388608 && + ts.getDeclarationOfKind(moduleExport, 245)) { break; } } @@ -20344,13 +20433,13 @@ var ts; break loop; } break; - case 230: + case 231: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 148: case 147: - case 146: if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -20360,9 +20449,9 @@ var ts; } } break; - case 227: - case 197: case 228: + case 198: + case 229: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) { if (lastLocation && ts.getModifierFlags(lastLocation) & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -20370,7 +20459,7 @@ var ts; } break loop; } - if (location.kind === 197 && meaning & 32) { + if (location.kind === 198 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -20378,28 +20467,28 @@ var ts; } } break; - case 142: + case 143: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 228) { + if (ts.isClassLike(grandparent) || grandparent.kind === 229) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 226: - case 185: + case 153: + case 227: + case 186: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 184: + case 185: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -20412,8 +20501,8 @@ var ts; } } break; - case 145: - if (location.parent && location.parent.kind === 144) { + case 146: + if (location.parent && location.parent.kind === 145) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -20456,7 +20545,7 @@ var ts; } if (result && isInExternalModule && (meaning & 107455) === 107455) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 234) { + if (decls && decls.length === 1 && decls[0].kind === 235) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } @@ -20503,9 +20592,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 70: - case 177: + case 178: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 199: + case 200: ts.Debug.assert(ts.isEntityNameExpression(node.expression)); return node.expression; default: @@ -20553,10 +20642,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 235) { + if (node.kind === 236) { return node; } - while (node && node.kind !== 236) { + while (node && node.kind !== 237) { node = node.parent; } return node; @@ -20566,7 +20655,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 246) { + if (node.moduleReference.kind === 247) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); @@ -20574,11 +20663,16 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ? - moduleSymbol : - moduleSymbol.exports["export="] ? - getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : - resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = void 0; + if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } + else { + var exportValue = moduleSymbol.exports.get("export="); + exportDefaultSymbol = exportValue + ? getPropertyOfType(getTypeOfSymbol(exportValue), "default") + : resolveSymbol(moduleSymbol.exports.get("default")); + } if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } @@ -20609,7 +20703,7 @@ var ts; } function getExportOfModule(symbol, name) { if (symbol.flags & 1536) { - var exportedSymbol = getExportsOfSymbol(symbol)[name]; + var exportedSymbol = getExportsOfSymbol(symbol).get(name); if (exportedSymbol) { return resolveSymbol(exportedSymbol); } @@ -20627,28 +20721,28 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_16 = specifier.propertyName || specifier.name; - if (name_16.text) { + var name = specifier.propertyName || specifier.name; + if (name.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; - if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text); + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); } symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_16.text); - if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") { + var symbolFromModule = getExportOfModule(targetSymbol, name.text); + if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16)); + error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); } return symbol; } @@ -20670,19 +20764,19 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 235: + case 236: return getTargetOfImportEqualsDeclaration(node); - case 237: - return getTargetOfImportClause(node); case 238: + return getTargetOfImportClause(node); + case 239: return getTargetOfNamespaceImport(node); - case 240: + case 241: return getTargetOfImportSpecifier(node); - case 244: + case 245: return getTargetOfExportSpecifier(node); - case 241: + case 242: return getTargetOfExportAssignment(node); - case 234: + case 235: return getTargetOfNamespaceExportDeclaration(node); } } @@ -20726,10 +20820,10 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 241) { + if (node.kind === 242) { checkExpressionCached(node.expression); } - else if (node.kind === 244) { + else if (node.kind === 245) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -20741,11 +20835,11 @@ var ts; if (entityName.kind === 70 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 70 || entityName.parent.kind === 141) { + if (entityName.kind === 70 || entityName.parent.kind === 142) { return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 235); + ts.Debug.assert(entityName.parent.kind === 236); return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias); } } @@ -20764,9 +20858,9 @@ var ts; return undefined; } } - else if (name.kind === 141 || name.kind === 177) { - var left = name.kind === 141 ? name.left : name.expression; - var right = name.kind === 141 ? name.right : name.name; + else if (name.kind === 142 || name.kind === 178) { + var left = name.kind === 142 ? name.left : name.expression; + var right = name.kind === 142 ? name.right : name.name; var namespace = resolveEntityName(left, 1920, ignoreErrors, false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -20856,7 +20950,7 @@ var ts; return undefined; } function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="))) || moduleSymbol; } function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { var symbol = resolveExternalModuleSymbol(moduleSymbol); @@ -20867,15 +20961,23 @@ var ts; return symbol; } function hasExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="] !== undefined; + return moduleSymbol.exports.get("export=") !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function getExportsAndPropertiesOfModule(moduleSymbol) { + var exports = getExportsOfModuleAsArray(moduleSymbol); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + ts.addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))); + } + return exports; + } function tryGetMemberInModuleExports(memberName, moduleSymbol) { var symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { - return symbolTable[memberName]; + return symbolTable.get(memberName); } } function getExportsOfSymbol(symbol) { @@ -20886,24 +20988,28 @@ var ts; return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } function extendExportSymbols(target, source, lookupTable, exportNode) { - for (var id in source) { - if (id !== "default" && !target[id]) { - target[id] = source[id]; + source && source.forEach(function (sourceSymbol, id) { + if (id === "default") + return; + var targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); if (lookupTable && exportNode) { - lookupTable[id] = { + lookupTable.set(id, { specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) - }; + }); } } - else if (lookupTable && exportNode && id !== "default" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { - if (!lookupTable[id].exportsWithDuplicate) { - lookupTable[id].exportsWithDuplicate = [exportNode]; + else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + var collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; } else { - lookupTable[id].exportsWithDuplicate.push(exportNode); + collisionTracker.exportsWithDuplicate.push(exportNode); } } - } + }); } function getExportsForModule(moduleSymbol) { var visitedSymbols = []; @@ -20915,26 +21021,26 @@ var ts; } visitedSymbols.push(symbol); var symbols = ts.cloneMap(symbol.exports); - var exportStars = symbol.exports["__export"]; + var exportStars = symbol.exports.get("__export"); if (exportStars) { var nestedSymbols = ts.createMap(); - var lookupTable = ts.createMap(); + var lookupTable_1 = ts.createMap(); for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); var exportedSymbols = visit(resolvedModule); - extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node); } - for (var id in lookupTable) { - var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; - if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) { - continue; + lookupTable_1.forEach(function (_a, id) { + var exportsWithDuplicate = _a.exportsWithDuplicate; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; } - for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { - var node = exportsWithDuplicate_1[_b]; - diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { + var node = exportsWithDuplicate_1[_i]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, id)); } - } + }); extendExportSymbols(symbols, nestedSymbols); } return symbols; @@ -20971,7 +21077,7 @@ var ts; var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 150 && ts.nodeIsPresent(member.body)) { + if (member.kind === 151 && ts.nodeIsPresent(member.body)) { return member; } } @@ -21007,16 +21113,15 @@ var ts; } function getNamedMembers(members) { var result; - for (var id in members) { + members.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { if (!result) result = []; - var symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } } - } + }); return result || emptyArray; } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { @@ -21035,19 +21140,19 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { - if (location_1.locals && !isGlobalSourceFile(location_1)) { - if (result = callback(location_1.locals)) { + for (var location = enclosingDeclaration; location; location = location.parent) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { return result; } } - switch (location_1.kind) { - case 262: - if (!ts.isExternalOrCommonJsModule(location_1)) { + switch (location.kind) { + case 263: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 231: - if (result = callback(getSymbolOfNode(location_1).exports)) { + case 232: + if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; @@ -21084,13 +21189,13 @@ var ts; } } function trySymbolTable(symbols) { - if (isAccessible(symbols[symbol.name])) { + if (isAccessible(symbols.get(symbol.name))) { return [symbol]; } - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { + return ts.forEachEntry(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -21115,14 +21220,14 @@ var ts; function needsQualification(symbol, enclosingDeclaration, meaning) { var qualify = false; forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { - var symbolFromSymbolTable = symbolTable[symbol.name]; + var symbolFromSymbolTable = symbolTable.get(symbol.name); if (!symbolFromSymbolTable) { return false; } if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -21136,10 +21241,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 147: - case 149: - case 151: + case 148: + case 150: case 152: + case 153: continue; default: return false; @@ -21195,7 +21300,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 262 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 263 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -21229,11 +21334,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 160 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === 161 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning = 107455 | 1048576; } - else if (entityName.kind === 141 || entityName.kind === 177 || - entityName.parent.kind === 235) { + else if (entityName.kind === 142 || entityName.kind === 178 || + entityName.parent.kind === 236) { meaning = 1920; } else { @@ -21325,10 +21430,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 166) { + while (node.kind === 167) { node = node.parent; } - if (node.kind === 229) { + if (node.kind === 230) { return getSymbolOfNode(node); } } @@ -21336,29 +21441,29 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 232 && + node.parent.kind === 233 && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { return type.flags & 32 ? "\"" + ts.escapeString(type.text) + "\"" : type.text; } - function getSymbolDisplayBuilder() { - function getNameOfSymbol(symbol) { - if (symbol.declarations && symbol.declarations.length) { - var declaration = symbol.declarations[0]; - if (declaration.name) { - return ts.declarationNameToString(declaration.name); - } - switch (declaration.kind) { - case 197: - return "(Anonymous class)"; - case 184: - case 185: - return "(Anonymous function)"; - } + function getNameOfSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + switch (declaration.kind) { + case 198: + return "(Anonymous class)"; + case 185: + case 186: + return "(Anonymous function)"; } - return symbol.name; } + return symbol.name; + } + function getSymbolDisplayBuilder() { function appendSymbolNameOnly(symbol, writer) { writer.writeSymbol(getNameOfSymbol(symbol), symbol); } @@ -21405,9 +21510,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_6) { - walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false); + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + walkSymbol(parent, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -21437,7 +21542,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { var nextFlags = flags & ~512; - if (type.flags & 16015) { + if (type.flags & 16793231) { writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type) ? "any" : type.intrinsicName); @@ -21540,12 +21645,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); + writeSymbolTypeReference(parent, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -21571,7 +21676,8 @@ var ts; function writeAnonymousType(type, flags) { var symbol = type.symbol; if (symbol) { - if (symbol.flags & (32 | 384 | 512)) { + if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 | 512)) { writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -21604,7 +21710,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 262 || declaration.parent.kind === 232; + return declaration.parent.kind === 263 || declaration.parent.kind === 233; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -21786,12 +21892,12 @@ var ts; buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { writePunctuation(writer, 16); buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 17); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { writePunctuation(writer, 20); var elements = bindingPattern.elements; buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); @@ -21805,7 +21911,7 @@ var ts; if (ts.isOmittedExpression(bindingElement)) { return; } - ts.Debug.assert(bindingElement.kind === 174); + ts.Debug.assert(bindingElement.kind === 175); if (bindingElement.propertyName) { writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55); @@ -21927,7 +22033,7 @@ var ts; writeKeyword(writer, 132); break; case 0: - writeKeyword(writer, 134); + writeKeyword(writer, 135); break; } writePunctuation(writer, 21); @@ -21963,63 +22069,63 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174: + case 175: return isDeclarationVisible(node.parent.parent); - case 224: + case 225: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 231: - case 227: + case 232: case 228: case 229: - case 226: case 230: - case 235: + case 227: + case 231: + case 236: if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_8 = getDeclarationContainer(node); + var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 235 && parent_8.kind !== 262 && ts.isInAmbientContext(parent_8))) { - return isGlobalSourceFile(parent_8); + !(node.kind !== 236 && parent.kind !== 263 && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent); } - return isDeclarationVisible(parent_8); + return isDeclarationVisible(parent); + case 148: case 147: - case 146: - case 151: case 152: + case 153: + case 150: case 149: - case 148: if (ts.getModifierFlags(node) & (8 | 16)) { return false; } - case 150: - case 154: - case 153: + case 151: case 155: - case 144: - case 232: - case 158: + case 154: + case 156: + case 145: + case 233: case 159: - case 161: - case 157: + case 160: case 162: + case 158: case 163: case 164: case 165: case 166: + case 167: return isDeclarationVisible(node.parent); - case 237: case 238: - case 240: + case 239: + case 241: return false; - case 143: - case 262: - case 234: + case 144: + case 263: + case 235: return true; - case 241: + case 242: return false; default: return false; @@ -22028,10 +22134,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 241) { + if (node.parent && node.parent.kind === 242) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 244) { + else if (node.parent.kind === 245) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -22109,12 +22215,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 224: case 225: + case 226: + case 241: case 240: case 239: case 238: - case 237: node = node.parent; break; default: @@ -22138,7 +22244,7 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); } function isComputedNonLiteralName(name) { - return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression); + return name.kind === 143 && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { source = filterType(source, function (t) { return !(t.flags & 6144); }); @@ -22151,17 +22257,16 @@ var ts; var members = ts.createMap(); var names = ts.createMap(); for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_17 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_17)] = true; + var name = properties_2[_i]; + names.set(ts.getTextOfPropertyName(name), true); } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; - var inNamesToRemove = prop.name in names; + var inNamesToRemove = names.has(prop.name); var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16); - var isMethod = prop.flags & 8192; var isSetOnlyAccessor = prop.flags & 65536 && !(prop.flags & 32768); - if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { - members[prop.name] = prop; + if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { + members.set(prop.name, prop); } } var stringIndexInfo = getIndexInfoOfType(source, 0); @@ -22181,7 +22286,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 172) { + if (pattern.kind === 173) { if (declaration.dotDotDotToken) { if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); @@ -22197,19 +22302,19 @@ var ts; type = getRestType(parentType, literalMembers, declaration.symbol); } else { - var name_18 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_18)) { + var name = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name)) { return anyType; } if (declaration.initializer) { getContextualType(declaration.initializer); } - var text = ts.getTextOfPropertyName(name_18); + var text = ts.getTextOfPropertyName(name); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } @@ -22255,7 +22360,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 175 && expr.elements.length === 0; + return expr.kind === 176 && expr.elements.length === 0; } function addOptionality(type, optional) { return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type; @@ -22267,11 +22372,11 @@ var ts; return type; } } - if (declaration.parent.parent.kind === 213) { + if (declaration.parent.parent.kind === 214) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 | 262144) ? indexType : stringType; } - if (declaration.parent.parent.kind === 214) { + if (declaration.parent.parent.kind === 215) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -22281,7 +22386,7 @@ var ts; return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); } if ((compilerOptions.noImplicitAny || declaration.flags & 65536) && - declaration.kind === 224 && !ts.isBindingPattern(declaration.name) && + declaration.kind === 225 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -22290,10 +22395,10 @@ var ts; return autoArrayType; } } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var func = declaration.parent; - if (func.kind === 152 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151); + if (func.kind === 153 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 152); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -22319,7 +22424,7 @@ var ts; var type = checkDeclarationInitializer(declaration); return addOptionality(type, declaration.questionToken && includeOptionality); } - if (declaration.kind === 259) { + if (declaration.kind === 260) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -22358,7 +22463,7 @@ var ts; var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members[symbol.name] = symbol; + members.set(symbol.name, symbol); }); var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { @@ -22384,7 +22489,7 @@ var ts; return result; } function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 172 + return pattern.kind === 173 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -22394,7 +22499,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 258) { + if (declaration.kind === 259) { return type; } return getWidenedType(type); @@ -22409,7 +22514,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 144 ? root.parent : root; + var memberDeclaration = root.kind === 145 ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol) { @@ -22422,25 +22527,25 @@ var ts; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } - if (declaration.kind === 241) { + if (declaration.kind === 242) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 65536 && declaration.kind === 287 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 288 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { return unknownType; } var type = void 0; - if (declaration.kind === 192 || - declaration.kind === 177 && declaration.parent.kind === 192) { + if (declaration.kind === 193 || + declaration.kind === 178 && declaration.parent.kind === 193) { if (declaration.flags & 65536) { var jsdocType = ts.getJSDocType(declaration.parent); if (jsdocType) { return links.type = getTypeFromTypeNode(jsdocType); } } - var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ? + var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 193 ? checkExpressionCached(decl.right) : checkExpressionCached(decl.parent.right); }); type = getUnionType(declaredTypes, true); @@ -22457,7 +22562,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 151) { + if (accessor.kind === 152) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -22477,8 +22582,8 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - var getter = ts.getDeclarationOfKind(symbol, 151); - var setter = ts.getDeclarationOfKind(symbol, 152); + var getter = ts.getDeclarationOfKind(symbol, 152); + var setter = ts.getDeclarationOfKind(symbol, 153); if (getter && getter.flags & 65536) { var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); if (jsDocType) { @@ -22519,7 +22624,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 151); + var getter_1 = ts.getDeclarationOfKind(symbol, 152); 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)); } } @@ -22527,6 +22632,10 @@ var ts; } return links.type; } + function getBaseTypeVariableOfClass(symbol) { + var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); + return baseConstructorType.flags & 540672 ? baseConstructorType : undefined; + } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -22535,8 +22644,13 @@ var ts; } else { var type = createObjectType(16, symbol); - links.type = strictNullChecks && symbol.flags & 536870912 ? - includeFalsyTypes(type, 2048) : type; + if (symbol.flags & 32) { + var baseTypeVariable = getBaseTypeVariableOfClass(symbol); + links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; + } + else { + links.type = strictNullChecks && symbol.flags & 536870912 ? includeFalsyTypes(type, 2048) : type; + } } } return links.type; @@ -22609,8 +22723,13 @@ var ts; function hasBaseType(type, checkBase) { return check(type); function check(type) { - var target = getTargetType(type); - return target === checkBase || ts.forEach(getBaseTypes(target), check); + if (getObjectFlags(type) & (3 | 4)) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(getBaseTypes(target), check); + } + else if (type.flags & 131072) { + return ts.forEach(type.types, check); + } } } function appendTypeParameters(typeParameters, declarations) { @@ -22632,9 +22751,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 227 || node.kind === 197 || - node.kind === 226 || node.kind === 184 || - node.kind === 149 || node.kind === 185) { + if (node.kind === 228 || node.kind === 198 || + node.kind === 227 || node.kind === 185 || + node.kind === 150 || node.kind === 186) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -22643,15 +22762,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 228); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 229); 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 === 228 || node.kind === 227 || - node.kind === 197 || node.kind === 229) { + if (node.kind === 229 || node.kind === 228 || + node.kind === 198 || node.kind === 230) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -22663,8 +22782,23 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); } + function isMixinConstructorType(type) { + var signatures = getSignaturesOfType(type, 1); + if (signatures.length === 1) { + var s = signatures[0]; + return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType; + } + return false; + } function isConstructorType(type) { - return type.flags & 32768 && getSignaturesOfType(type, 1).length > 0; + if (isValidBaseType(type) && getSignaturesOfType(type, 1).length > 0) { + return true; + } + if (type.flags & 540672) { + var constraint = getBaseConstraintOfType(type); + return isValidBaseType(constraint) && isMixinConstructorType(constraint); + } + return false; } function getBaseTypeNodeOfClass(type) { return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); @@ -22691,7 +22825,7 @@ var ts; return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072)) { resolveStructuredTypeMembers(baseConstructorType); } if (!popTypeResolution()) { @@ -22727,8 +22861,8 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseConstructorType = getBaseConstructorTypeOfClass(type); - if (!(baseConstructorType.flags & 32768)) { + var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); + if (!(baseConstructorType.flags & (32768 | 131072))) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -22756,7 +22890,7 @@ var ts; if (baseType === unknownType) { return; } - if (!(getObjectFlags(getTargetType(baseType)) & 3)) { + if (!isValidBaseType(baseType)) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); return; } @@ -22780,16 +22914,20 @@ var ts; } return true; } + function isValidBaseType(type) { + return type.flags & 32768 && !isGenericMappedType(type) || + type.flags & 131072 && !ts.forEach(type.types, function (t) { return !isValidBaseType(t); }); + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 228 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 229 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { - if (getObjectFlags(getTargetType(baseType)) & 3) { + if (isValidBaseType(baseType)) { if (type !== baseType && !hasBaseType(baseType, type)) { if (type.resolvedBaseTypes === emptyArray) { type.resolvedBaseTypes = [baseType]; @@ -22813,7 +22951,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 228) { + if (declaration.kind === 229) { if (declaration.flags & 64) { return false; } @@ -22846,7 +22984,7 @@ var ts; type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -22863,7 +23001,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 286); + var declaration = ts.getDeclarationOfKind(symbol, 287); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -22874,7 +23012,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 229); + declaration = ts.getDeclarationOfKind(symbol, 230); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -22882,7 +23020,7 @@ var ts; if (typeParameters) { links.typeParameters = typeParameters; links.instantiations = ts.createMap(); - links.instantiations[getTypeListId(typeParameters)] = type; + links.instantiations.set(getTypeListId(typeParameters), type); } } else { @@ -22899,14 +23037,14 @@ var ts; return !ts.isInAmbientContext(member); } return expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8 || - expr.kind === 70 && !!symbol.exports[expr.text]; + expr.kind === 70 && !!symbol.exports.get(expr.text); } function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 230) { + if (declaration.kind === 231) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -22931,10 +23069,10 @@ var ts; enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { var memberTypeList = []; - var memberTypes = ts.createMap(); + var memberTypes = []; for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 230) { + if (declaration.kind === 231) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -22951,7 +23089,7 @@ var ts; if (memberTypeList.length > 1) { enumType.flags |= 65536; enumType.types = memberTypeList; - unionTypes[getTypeListId(memberTypeList)] = enumType; + unionTypes.set(getTypeListId(memberTypeList), enumType); } } } @@ -22972,9 +23110,6 @@ var ts; if (!links.declaredType) { var type = createType(16384); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 143).constraint) { - type.constraint = noConstraintType; - } links.declaredType = type; } return links.declaredType; @@ -22987,7 +23122,6 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 16777216) === 0); if (symbol.flags & (32 | 64)) { return getDeclaredTypeOfClassOrInterface(symbol); } @@ -23022,19 +23156,20 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: + case 133: case 104: - case 137: + case 138: case 94: case 129: - case 171: + case 172: return true; - case 162: + case 163: return isIndependentType(node.elementType); - case 157: + case 158: return isIndependentTypeReference(node); } return false; @@ -23043,7 +23178,7 @@ var ts; return node.type && isIndependentType(node.type) || !node.type && !node.initializer; } function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 150 && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 151 && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -23059,12 +23194,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { + case 148: case 147: - case 146: return isIndependentVariableLikeDeclaration(declaration); - case 149: - case 148: case 150: + case 149: + case 151: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -23075,7 +23210,7 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; - result[symbol.name] = symbol; + result.set(symbol.name, symbol); } return result; } @@ -23083,15 +23218,15 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; - result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; - if (!symbols[s.name]) { - symbols[s.name] = s; + if (!symbols.has(s.name)) { + symbols.set(s.name, s); } } } @@ -23099,8 +23234,8 @@ var ts; if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get("__call")); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get("__new")); type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0); type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1); } @@ -23108,7 +23243,14 @@ var ts; } function getTypeWithThisArgument(type, thisArgument) { if (getObjectFlags(type) & 4) { - return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + var target = type.target; + var typeArguments = type.typeArguments; + if (ts.length(target.typeParameters) === ts.length(typeArguments)) { + return createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType])); + } + } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument); })); } return type; } @@ -23144,7 +23286,7 @@ var ts; for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0); @@ -23289,17 +23431,44 @@ var ts; function unionSpreadIndexInfos(info1, info2) { return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly); } + function includeMixinType(type, types, index) { + var mixedTypes = []; + for (var i = 0; i < types.length; i++) { + if (i === index) { + mixedTypes.push(type); + } + else if (isMixinConstructorType(types[i])) { + mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1)[0])); + } + } + return getIntersectionType(mixedTypes); + } function resolveIntersectionTypeMembers(type) { var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexInfo = undefined; - var numberIndexInfo = undefined; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; + var stringIndexInfo; + var numberIndexInfo; + var types = type.types; + var mixinCount = ts.countWhere(types, isMixinConstructorType); + var _loop_3 = function (i) { + var t = type.types[i]; + if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) { + var signatures = getSignaturesOfType(t, 1); + if (signatures.length && mixinCount > 0) { + signatures = ts.map(signatures, function (s) { + var clone = cloneSignature(s); + clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i); + return clone; + }); + } + constructSignatures = ts.concatenate(constructSignatures, signatures); + } callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1)); stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0)); numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1)); + }; + for (var i = 0; i < types.length; i++) { + _loop_3(i); } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } @@ -23315,8 +23484,8 @@ var ts; } else if (symbol.flags & 2048) { var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var callSignatures = getSignaturesOfSymbol(members.get("__call")); + var constructSignatures = getSignaturesOfSymbol(members.get("__new")); var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0); var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); @@ -23329,14 +23498,14 @@ var ts; } if (symbol.flags & 32) { var classType = getDeclaredTypeOfClassOrInterface(symbol); - constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); } var baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072 | 540672)) { members = createSymbolTable(getNamedMembers(members)); - addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); + addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); } } var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined; @@ -23356,8 +23525,11 @@ var ts; var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); var templateReadonly = !!type.declaration.readonlyToken; var templateOptional = !!type.declaration.questionToken; - if (type.declaration.typeParameter.constraint.kind === 168) { - forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + if (type.declaration.typeParameter.constraint.kind === 169) { + for (var _i = 0, _a = getPropertiesOfType(modifiersType); _i < _a.length; _i++) { + var propertySymbol = _a[_i]; + addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); + } if (getIndexInfoOfType(modifiersType, 0)) { addMemberForKeyType(stringType); } @@ -23368,8 +23540,8 @@ var ts; forEachType(iterationType, addMemberForKeyType); } setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); - function addMemberForKeyType(t) { - var iterationMapper = createUnaryTypeMapper(typeParameter, t); + function addMemberForKeyType(t, propertySymbol) { + var iterationMapper = createTypeMapper([typeParameter], [t]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); if (t.flags & 32) { @@ -23379,7 +23551,10 @@ var ts; var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName); prop.type = propType; prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); - members[propName] = prop; + if (propertySymbol) { + prop.mappedTypeOrigin = propertySymbol; + } + members.set(propName, prop); } else if (t.flags & 2) { stringIndexInfo = createIndexInfo(propType, templateReadonly); @@ -23403,7 +23578,7 @@ var ts; function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { var constraintDeclaration = type.declaration.typeParameter.constraint; - if (constraintDeclaration.kind === 168) { + if (constraintDeclaration.kind === 169) { type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); } else { @@ -23415,9 +23590,6 @@ var ts; } return type.modifiersType; } - function getErasedTemplateTypeFromMappedType(type) { - return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); - } function isGenericMappedType(type) { if (getObjectFlags(type) & 32) { var constraintType = getConstraintTypeFromMappedType(type); @@ -23459,35 +23631,33 @@ var ts; function getPropertyOfObjectType(type, name) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } } } function getPropertiesOfUnionOrIntersectionType(type) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var current = _a[_i]; - for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { - var prop = _c[_b]; - getUnionOrIntersectionProperty(type, prop.name); - } - if (type.flags & 65536) { - break; - } - } - var props = type.resolvedProperties; - if (props) { - var result = []; - for (var key in props) { - var prop = props[key]; - if (!(prop.flags & 268435456 && prop.isPartial)) { - result.push(prop); + if (!type.resolvedProperties) { + var members = ts.createMap(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.name)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.name); + if (combinedProp) { + members.set(prop.name, combinedProp); + } + } + } + if (type.flags & 65536) { + break; } } - return result; + type.resolvedProperties = getNamedMembers(members); } - return emptyArray; + return type.resolvedProperties; } function getPropertiesOfType(type) { type = getApparentType(type); @@ -23495,36 +23665,96 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } - function getApparentTypeOfTypeVariable(type) { - if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeVariable(type); - while (constraintType && constraintType.flags & 16384) { - constraintType = getConstraintOfTypeVariable(constraintType); + function getConstraintOfType(type) { + return type.flags & 16384 ? getConstraintOfTypeParameter(type) : getBaseConstraintOfType(type); + } + function getConstraintOfTypeParameter(typeParameter) { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; + } + function getBaseConstraintOfType(type) { + var constraint = getResolvedBaseConstraint(type); + return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined; + } + function hasNonCircularBaseConstraint(type) { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } + function getResolvedBaseConstraint(type) { + var typeStack; + var circular; + if (!type.resolvedBaseConstraint) { + typeStack = []; + var constraint = getBaseConstraint(type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + } + return type.resolvedBaseConstraint; + function getBaseConstraint(t) { + if (ts.contains(typeStack, t)) { + circular = true; + return undefined; + } + typeStack.push(t); + var result = computeBaseConstraint(t); + typeStack.pop(); + return result; + } + function computeBaseConstraint(t) { + if (t.flags & 16384) { + var constraint = getConstraintFromTypeParameter(t); + return t.isThisType ? constraint : + constraint ? getBaseConstraint(constraint) : undefined; + } + if (t.flags & 196608) { + var types = t.types; + var baseTypes = []; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var type_1 = types_2[_i]; + var baseType = getBaseConstraint(type_1); + if (baseType) { + baseTypes.push(baseType); + } + } + return t.flags & 65536 && baseTypes.length === types.length ? getUnionType(baseTypes) : + t.flags & 131072 && baseTypes.length ? getIntersectionType(baseTypes) : + undefined; + } + if (t.flags & 262144) { + return stringType; + } + if (t.flags & 524288) { + var baseObjectType = getBaseConstraint(t.objectType); + var baseIndexType = getBaseConstraint(t.indexType); + var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; + return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; } - type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + return t; } - return type.resolvedApparentType; + } + function getApparentTypeOfIntersectionType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type)); } function getApparentType(type) { - var t = type.flags & 540672 ? getApparentTypeOfTypeVariable(type) : type; - return t.flags & 262178 ? globalStringType : - t.flags & 340 ? globalNumberType : - t.flags & 136 ? globalBooleanType : - t.flags & 512 ? getGlobalESSymbolType() : - t; + var t = type.flags & 540672 ? getBaseConstraintOfType(type) || emptyObjectType : type; + return t.flags & 131072 ? getApparentTypeOfIntersectionType(t) : + t.flags & 262178 ? globalStringType : + t.flags & 340 ? globalNumberType : + t.flags & 136 ? globalBooleanType : + t.flags & 512 ? getGlobalESSymbolType() : + t.flags & 16777216 ? globalObjectType : + t; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; + var excludeModifiers = containingType.flags & 65536 ? 8 | 16 : 0; var props; var commonFlags = (containingType.flags & 131072) ? 536870912 : 0; var isReadonly = false; var isPartial = false; - for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { - var current = types_2[_i]; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var current = types_3[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16))) { + if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & excludeModifiers)) { commonFlags &= prop.flags; if (!props) { props = [prop]; @@ -23575,12 +23805,12 @@ var ts; return result; } function getUnionOrIntersectionProperty(type, name) { - var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap()); - var property = properties[name]; + var properties = type.propertyCache || (type.propertyCache = ts.createMap()); + var property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); if (property) { - properties[name] = property; + properties.set(name, property); } } return property; @@ -23593,7 +23823,7 @@ var ts; type = getApparentType(type); if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -23672,16 +23902,16 @@ var ts; } function symbolsToArray(symbols) { var result = []; - for (var id in symbols) { + symbols.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { - result.push(symbols[id]); + result.push(symbol); } - } + }); return result; } function isJSDocOptionalParameter(node) { if (node.flags & 65536) { - if (node.type && node.type.kind === 274) { + if (node.type && node.type.kind === 275) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -23692,7 +23922,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 274; + return paramTag.typeExpression.type.kind === 275; } } } @@ -23740,9 +23970,10 @@ var ts; if (!links.resolvedSignature) { var parameters = []; var hasLiteralTypes = false; - var minArgumentCount = -1; + var minArgumentCount = 0; var thisParameter = undefined; var hasThisParameter = void 0; + var iife = ts.getImmediatelyInvokedFunctionExpression(declaration); var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; @@ -23758,41 +23989,33 @@ var ts; else { parameters.push(paramSymbol); } - if (param.type && param.type.kind === 171) { + if (param.type && param.type.kind === 172) { hasLiteralTypes = true; } - if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { - if (minArgumentCount < 0) { - minArgumentCount = i - (hasThisParameter ? 1 : 0); - } - } - else { - minArgumentCount = -1; + var isOptionalParameter_1 = param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !param.type || + isJSDocOptionalParameter(param); + if (!isOptionalParameter_1) { + minArgumentCount = parameters.length; } } - if ((declaration.kind === 151 || declaration.kind === 152) && + if ((declaration.kind === 152 || declaration.kind === 153) && !ts.hasDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 151 ? 152 : 151; + var otherKind = declaration.kind === 152 ? 153 : 152; var other = ts.getDeclarationOfKind(declaration.symbol, otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); - } - if (isJSConstructSignature) { - minArgumentCount--; - } - var classType = declaration.kind === 150 ? + var classType = declaration.kind === 151 ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : getTypeParametersFromJSDocTemplate(declaration); var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType); - var typePredicate = declaration.type && declaration.type.kind === 156 ? + var typePredicate = declaration.type && declaration.type.kind === 157 ? createTypePredicateFromTypePredicateNode(declaration.type) : undefined; links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes); @@ -23815,8 +24038,8 @@ var ts; return type; } } - if (declaration.kind === 151 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 152); + if (declaration.kind === 152 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 153); return getAnnotatedAccessorType(setter); } if (ts.nodeIsMissing(declaration.body)) { @@ -23830,20 +24053,20 @@ var ts; for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 158: case 159: - case 226: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 275: + case 186: + case 276: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -23913,7 +24136,11 @@ var ts; function getSignatureInstantiation(signature, typeArguments) { var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()); var id = getTypeListId(typeArguments); - return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + var instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; } function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); @@ -23928,7 +24155,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 150 || signature.declaration.kind === 154; + var isConstructor = signature.declaration.kind === 151 || signature.declaration.kind === 155; var type = createObjectType(16); type.members = emptySymbols; type.properties = emptyArray; @@ -23939,10 +24166,10 @@ var ts; return signature.isolatedSignatureType; } function getIndexSymbol(symbol) { - return symbol.members["__index"]; + return symbol.members.get("__index"); } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 132 : 134; + var syntaxKind = kind === 1 ? 132 : 135; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -23969,21 +24196,9 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 143).constraint; - } - function hasConstraintReferenceTo(type, target) { - var checked; - while (type && type.flags & 16384 && !(type.isThisType) && !ts.contains(checked, type)) { - if (type === target) { - return true; - } - (checked || (checked = [])).push(type); - var constraintDeclaration = getConstraintDeclaration(type); - type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); - } - return false; + return ts.getDeclarationOfKind(type.symbol, 144).constraint; } - function getConstraintOfTypeParameter(typeParameter) { + function getConstraintFromTypeParameter(typeParameter) { if (!typeParameter.constraint) { if (typeParameter.target) { var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); @@ -23991,23 +24206,13 @@ var ts; } else { var constraintDeclaration = getConstraintDeclaration(typeParameter); - var constraint = getTypeFromTypeNode(constraintDeclaration); - if (hasConstraintReferenceTo(constraint, typeParameter)) { - error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); - constraint = unknownType; - } - typeParameter.constraint = constraint; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } - function getConstraintOfTypeVariable(type) { - return type.flags & 16384 ? getConstraintOfTypeParameter(type) : - type.flags & 524288 ? type.constraint : - undefined; - } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 144).parent); } function getTypeListId(types) { var result = ""; @@ -24034,8 +24239,8 @@ var ts; } function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; - for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { - var type = types_3[_i]; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var type = types_4[_i]; if (!(type.flags & excludeKinds)) { result |= type.flags; } @@ -24044,9 +24249,10 @@ var ts; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); - var type = target.instantiations[id]; + var type = target.instantiations.get(id); if (!type) { - type = target.instantiations[id] = createObjectType(4, target.symbol); + type = createObjectType(4, target.symbol); + target.instantiations.set(id, type); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -24085,7 +24291,11 @@ var ts; var links = getSymbolLinks(symbol); var typeParameters = links.typeParameters; var id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + var instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + } + return instantiation; } function getTypeFromTypeAliasReference(node, symbol) { var type = getDeclaredTypeOfSymbol(symbol); @@ -24113,11 +24323,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 157: + case 158: return node.typeName; - case 273: + case 274: return node.name; - case 199: + case 200: var expr = node.expression; if (ts.isEntityNameExpression(expr)) { return expr; @@ -24141,7 +24351,7 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 && node.kind === 273) { + if (symbol.flags & 107455 && node.kind === 274) { return getTypeOfSymbol(symbol); } return getTypeFromNonGenericTypeReference(node, symbol); @@ -24151,13 +24361,13 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 273) { + if (node.kind === 274) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(typeReferenceName); type = getTypeReferenceType(node, symbol); } else { - var typeNameOrExpression = node.kind === 157 + var typeNameOrExpression = node.kind === 158 ? node.typeName : ts.isEntityNameExpression(node.expression) ? node.expression @@ -24186,9 +24396,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 227: case 228: - case 230: + case 229: + case 231: return declaration; } } @@ -24265,7 +24475,7 @@ var ts; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -24347,14 +24557,14 @@ var ts; } } function addTypesToUnion(typeSet, types) { - for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { - var type = types_4[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; addTypeToUnion(typeSet, type); } } function containsIdenticalType(types, type) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var t = types_5[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -24362,8 +24572,8 @@ var ts; return false; } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var type = types_7[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } @@ -24442,10 +24652,11 @@ var ts; return types[0]; } var id = getTypeListId(types); - var type = unionTypes[id]; + var type = unionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, 6144); - type = unionTypes[id] = createType(65536 | propagatedFlags); + type = createType(65536 | propagatedFlags); + unionTypes.set(id, type); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -24474,8 +24685,8 @@ var ts; } } function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var type = types_8[_i]; addTypeToIntersection(typeSet, type); } } @@ -24497,10 +24708,11 @@ var ts; return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), false, aliasSymbol, aliasTypeArguments); } var id = getTypeListId(typeSet); - var type = intersectionTypes[id]; + var type = intersectionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 6144); - type = intersectionTypes[id] = createType(131072 | propagatedFlags); + type = createType(131072 | propagatedFlags); + intersectionTypes.set(id, type); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -24550,21 +24762,10 @@ var ts; var type = createType(524288); type.objectType = objectType; type.indexType = indexType; - if (type.objectType.flags & 229376) { - type.constraint = getIndexTypeOfType(type.objectType, 0); - } - else if (type.objectType.flags & 540672) { - var apparentType = getApparentTypeOfTypeVariable(type.objectType); - if (apparentType !== emptyObjectType) { - type.constraint = isTypeOfKind(type.indexType, 262178) ? - getIndexedAccessType(apparentType, type.indexType) : - getIndexTypeOfType(apparentType, 0); - } - } return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; var propName = indexType.flags & (32 | 64 | 256) ? indexType.text : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ? @@ -24612,7 +24813,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 178 ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 179 ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 | 64)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType)); } @@ -24626,33 +24827,31 @@ var ts; return unknownType; } function getIndexedAccessForMappedType(type, indexType, accessNode) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); return unknownType; } - var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } function getIndexedAccessType(objectType, indexType, accessNode) { if (maybeTypeOfKind(indexType, 540672 | 262144) || - maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 178) || + maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 179) || isGenericMappedType(objectType)) { if (objectType.flags & 1) { return objectType; } - if (accessNode) { - if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } - } if (isGenericMappedType(objectType)) { return getIndexedAccessForMappedType(objectType, indexType, accessNode); } var id = objectType.id + "," + indexType.id; - return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + var type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); + } + return type; } var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 && !(indexType.flags & 8190)) { @@ -24692,7 +24891,7 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { var aliasSymbol = getAliasSymbolForTypeNode(node); - if (ts.isEmpty(node.symbol.members) && !aliasSymbol) { + if (node.symbol.members.size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -24705,13 +24904,13 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 229 ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 230 ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; } - function getSpreadType(left, right, isFromObjectLiteral) { + function getSpreadType(left, right) { if (left.flags & 1 || right.flags & 1) { return anyType; } @@ -24724,10 +24923,13 @@ var ts; return left; } if (left.flags & 65536) { - return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); }); + return mapType(left, function (t) { return getSpreadType(t, right); }); } if (right.flags & 65536) { - return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); }); + return mapType(right, function (t) { return getSpreadType(left, t); }); + } + if (right.flags & 16777216) { + return emptyObjectType; } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); @@ -24743,23 +24945,23 @@ var ts; } for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { var rightProp = _a[_i]; - var isOwnProperty = !(rightProp.flags & 8192) || isFromObjectLiteral; var isSetterWithoutGetter = rightProp.flags & 65536 && !(rightProp.flags & 32768); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 | 16)) { - skippedPrivateMembers[rightProp.name] = true; + skippedPrivateMembers.set(rightProp.name, true); } - else if (isOwnProperty && !isSetterWithoutGetter) { - members[rightProp.name] = rightProp; + else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { + members.set(rightProp.name, rightProp); } } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (leftProp.flags & 65536 && !(leftProp.flags & 32768) - || leftProp.name in skippedPrivateMembers) { + || skippedPrivateMembers.has(leftProp.name) + || isClassMethod(leftProp)) { continue; } - if (leftProp.name in members) { - var rightProp = members[leftProp.name]; + if (members.has(leftProp.name)) { + var rightProp = members.get(leftProp.name); var rightType = getTypeOfSymbol(rightProp); if (maybeTypeOfKind(rightType, 2048) || rightProp.flags & 536870912) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); @@ -24770,15 +24972,18 @@ var ts; result.rightSpread = rightProp; result.declarations = declarations; result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); - members[leftProp.name] = result; + members.set(leftProp.name, result); } } else { - members[leftProp.name] = leftProp; + members.set(leftProp.name, leftProp); } } return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } + function isClassMethod(prop) { + return prop.flags & 8192 && ts.find(prop.declarations, function (decl) { return ts.isClassLike(decl.parent); }); + } function createLiteralType(flags, text) { var type = createType(flags); type.text = text; @@ -24800,7 +25005,11 @@ var ts; } function getLiteralTypeForText(flags, text) { var map = flags & 32 ? stringLiteralTypes : numericLiteralTypes; - return map[text] || (map[text] = createLiteralType(flags, text)); + var type = map.get(text); + if (!type) { + map.set(text, type = createLiteralType(flags, text)); + } + return type; } function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); @@ -24828,9 +25037,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 228)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 229)) { if (!(ts.getModifierFlags(container) & 32) && - (container.kind !== 150 || ts.isNodeDescendantOf(node, container.body))) { + (container.kind !== 151 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -24847,85 +25056,87 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118: - case 264: case 265: + case 266: return anyType; - case 134: + case 135: return stringType; case 132: return numberType; case 121: return booleanType; - case 135: + case 136: return esSymbolType; case 104: return voidType; - case 137: + case 138: return undefinedType; case 94: return nullType; case 129: return neverType; - case 290: - return nullType; + case 133: + return nonPrimitiveType; case 291: - return undefinedType; + return nullType; case 292: + return undefinedType; + case 293: return neverType; - case 167: + case 168: case 98: return getTypeFromThisTypeNode(node); - case 171: + case 172: return getTypeFromLiteralTypeNode(node); - case 289: + case 290: return getTypeFromLiteralTypeNode(node.literal); - case 157: - case 273: + case 158: + case 274: return getTypeFromTypeReference(node); - case 156: + case 157: return booleanType; - case 199: + case 200: return getTypeFromTypeReference(node); - case 160: + case 161: return getTypeFromTypeQueryNode(node); - case 162: - case 266: - return getTypeFromArrayTypeNode(node); case 163: - return getTypeFromTupleTypeNode(node); - case 164: case 267: - return getTypeFromUnionTypeNode(node); + return getTypeFromArrayTypeNode(node); + case 164: + return getTypeFromTupleTypeNode(node); case 165: - return getTypeFromIntersectionTypeNode(node); + case 268: + return getTypeFromUnionTypeNode(node); case 166: - case 269: + return getTypeFromIntersectionTypeNode(node); + case 167: case 270: - case 277: + case 271: case 278: - case 274: + case 279: + case 275: return getTypeFromTypeNode(node.type); - case 271: + case 272: return getTypeFromTypeNode(node.literal); - case 158: case 159: - case 161: - case 288: - case 275: + case 160: + case 162: + case 289: + case 276: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 168: - return getTypeFromTypeOperatorNode(node); case 169: - return getTypeFromIndexedAccessTypeNode(node); + return getTypeFromTypeOperatorNode(node); case 170: + return getTypeFromIndexedAccessTypeNode(node); + case 171: return getTypeFromMappedTypeNode(node); case 70: - case 141: + case 142: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 268: + case 269: return getTypeFromJSDocTupleType(node); - case 276: + case 277: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -24952,13 +25163,13 @@ var ts; var instantiations = mapper.instantiations || (mapper.instantiations = []); return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); } - function createUnaryTypeMapper(source, target) { + function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } - function createBinaryTypeMapper(source1, target1, source2, target2) { + function makeBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createArrayTypeMapper(sources, targets) { + function makeArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { @@ -24969,10 +25180,9 @@ var ts; }; } function createTypeMapper(sources, targets) { - var count = sources.length; - var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : - count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : - createArrayTypeMapper(sources, targets); + var mapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + makeArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; return mapper; } @@ -25002,7 +25212,12 @@ var ts; } function combineTypeMappers(mapper1, mapper2) { var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; - mapper.mappedTypes = mapper1.mappedTypes; + mapper.mappedTypes = ts.concatenate(mapper1.mappedTypes, mapper2.mappedTypes); + return mapper; + } + function createReplacementMapper(source, target, baseMapper) { + var mapper = function (t) { return t === source ? target : baseMapper(t); }; + mapper.mappedTypes = baseMapper.mappedTypes; return mapper; } function cloneTypeParameter(typeParameter) { @@ -25079,10 +25294,7 @@ var ts; if (typeVariable_1 !== mappedTypeVariable) { return mapType(mappedTypeVariable, function (t) { if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); + return instantiateMappedObjectType(type, createReplacementMapper(typeVariable_1, t, mapper)); } return t; }); @@ -25110,23 +25322,23 @@ var ts; var node = symbol.declarations[0]; while (node) { switch (node.kind) { - case 158: case 159: - case 226: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 227: - case 197: + case 186: case 228: + case 198: case 229: + case 230: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -25136,14 +25348,19 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 228) { + if (ts.isClassLike(node) || node.kind === 229) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 275: + case 171: + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)))) { + return true; + } + break; + case 276: var func = node; for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { var p = _c[_b]; @@ -25152,8 +25369,8 @@ var ts; } } break; - case 231: - case 262: + case 232: + case 263: return false; } node = node.parent; @@ -25163,7 +25380,7 @@ var ts; function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 262 || parentKind === 232; + return parentKind === 263 || parentKind === 233; } return false; } @@ -25215,27 +25432,27 @@ var ts; return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 184: case 185: + case 186: return isContextSensitiveFunctionLikeDeclaration(node); - case 176: + case 177: return ts.forEach(node.properties, isContextSensitive); - case 175: + case 176: return ts.forEach(node.elements, isContextSensitive); - case 193: + case 194: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 192: + case 193: return node.operatorToken.kind === 53 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 258: + case 259: return isContextSensitive(node.initializer); + case 150: case 149: - case 148: return isContextSensitiveFunctionLikeDeclaration(node); - case 183: + case 184: return isContextSensitive(node.expression); } return false; @@ -25247,7 +25464,7 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !p.type; })) { return true; } - if (node.kind === 185) { + if (node.kind === 186) { return false; } var parameter = ts.firstOrUndefined(node.parameters); @@ -25265,9 +25482,12 @@ var ts; result.properties = resolved.properties; result.callSignatures = emptyArray; result.constructSignatures = emptyArray; - type = result; + return result; } } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures)); + } return type; } function isTypeIdenticalTo(source, target) { @@ -25434,13 +25654,15 @@ var ts; return true; } var id = source.id + "," + target.id; - if (enumRelation[id] !== undefined) { - return enumRelation[id]; + var relation = enumRelation.get(id); + if (relation !== undefined) { + return relation; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256) || !(target.symbol.flags & 256) || (source.flags & 65536) !== (target.flags & 65536)) { - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } var targetEnumType = getTypeOfSymbol(target.symbol); for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { @@ -25451,11 +25673,13 @@ var ts; if (errorReporter) { errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); } - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } } } - return enumRelation[id] = true; + enumRelation.set(id, true); + return true; } function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { if (target.flags & 8192) @@ -25476,6 +25700,8 @@ var ts; return true; if (source.flags & 4096 && (!strictNullChecks || target.flags & 4096)) return true; + if (source.flags & 32768 && target.flags & 16777216) + return true; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & 1) return true; @@ -25507,12 +25733,12 @@ var ts; } if (source.flags & 32768 && target.flags & 32768) { var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { return related === 1; } } - if (source.flags & 507904 || target.flags & 507904) { + if (source.flags & 1032192 || target.flags & 1032192) { return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); } return false; @@ -25651,14 +25877,6 @@ var ts; } } } - else { - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; - } - } - } } else if (target.flags & 262144) { if (source.flags & 262144) { @@ -25666,12 +25884,10 @@ var ts; return result; } } - if (target.type.flags & 540672) { - var constraint = getConstraintOfTypeVariable(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; - } + var constraint = getConstraintOfType(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; } } } @@ -25681,8 +25897,9 @@ var ts; return result; } } - if (target.constraint) { - if (result = isRelatedTo(source, target.constraint, reportErrors)) { + var constraint = getBaseConstraintOfType(target); + if (constraint) { + if (result = isRelatedTo(source, constraint, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -25699,20 +25916,23 @@ var ts; } else { var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1) { - constraint = emptyObjectType; - } - constraint = getTypeWithThisArgument(constraint, source); - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; - return result; + if (constraint || !(target.flags & 16777216)) { + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; + } + constraint = getTypeWithThisArgument(constraint, source); + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } } } } else if (source.flags & 524288) { - if (source.constraint) { - if (result = isRelatedTo(source.constraint, target, reportErrors)) { + var constraint = getBaseConstraintOfType(source); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -25767,7 +25987,7 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) || + if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyResolvedType(resolved)) || resolved.stringIndexInfo || (resolved.numberIndexInfo && isNumericLiteralName(name)) || getPropertyOfType(type, name)) { @@ -25784,13 +26004,16 @@ var ts; } return false; } - function isEmptyObjectType(t) { + function isEmptyResolvedType(t) { return t.properties.length === 0 && t.callSignatures.length === 0 && t.constructSignatures.length === 0 && !t.stringIndexInfo && !t.numberIndexInfo; } + function isEmptyObjectType(type) { + return type.flags & 32768 && isEmptyResolvedType(resolveStructuredTypeMembers(type)); + } function hasExcessProperties(source, target, reportErrors) { if (maybeTypeOfKind(target, 32768) && !(getObjectFlags(target) & 512)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { @@ -25896,10 +26119,10 @@ var ts; return 0; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { if (reportErrors && related === 2) { - relation[id] = 3; + relation.set(id, 3); } else { return related === 1 ? -1 : 0; @@ -25907,7 +26130,7 @@ var ts; } if (depth > 0) { for (var i = 0; i < depth; i++) { - if (maybeStack[i][id]) { + if (maybeStack[i].get(id)) { return 1; } } @@ -25925,7 +26148,7 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = ts.createMap(); - maybeStack[depth][id] = 1; + maybeStack[depth].set(id, 1); depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) @@ -25959,38 +26182,38 @@ var ts; if (result) { var maybeCache = maybeStack[depth]; var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; - ts.copyProperties(maybeCache, destinationCache); + ts.copyEntries(maybeCache, destinationCache); } else { - relation[id] = reportErrors ? 3 : 2; + relation.set(id, reportErrors ? 3 : 2); } return result; } function mappedTypeRelatedTo(source, target, reportErrors) { if (isGenericMappedType(target)) { if (isGenericMappedType(source)) { - var result_2; - if (relation === identityRelation) { - var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; - var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else { - if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); - } + var sourceReadonly = !!source.declaration.readonlyToken; + var sourceOptional = !!source.declaration.questionToken; + var targetReadonly = !!target.declaration.readonlyToken; + var targetOptional = !!target.declaration.questionToken; + var modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + var result_2; + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); } } } + else if (target.declaration.questionToken && isEmptyObjectType(source)) { + return -1; + } } else if (relation !== identityRelation) { var resolved = resolveStructuredTypeMembers(target); - if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { + if (isEmptyResolvedType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { return -1; } } @@ -26352,8 +26575,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var t = types_9[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -26361,8 +26584,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -26453,8 +26676,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; result |= getFalsyFlags(t); } return result; @@ -26515,7 +26738,7 @@ var ts; var property = _a[_i]; var original = getTypeOfSymbol(property); var updated = f(original); - members[property.name] = updated === original ? property : createTransientSymbol(property, updated); + members.set(property.name, updated === original ? property : createTransientSymbol(property, updated)); } ; return members; @@ -26601,25 +26824,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 148: case 147: - case 146: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 144: + case 145: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 174: + case 175: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 226: + case 227: + case 150: case 149: - case 148: - case 151: case 152: - case 184: + case 153: case 185: + case 186: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -26716,7 +26939,7 @@ var ts; inferredProp.declarations = prop.declarations; inferredProp.type = inferredPropType; inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); - members[prop.name] = inferredProp; + members.set(prop.name, inferredProp); } if (indexInfo) { var inferredIndexType = inferTargetType(indexInfo.type); @@ -26859,10 +27082,10 @@ var ts; return; } var key = source.id + "," + target.id; - if (visited[key]) { + if (visited.get(key)) { return; } - visited[key] = true; + visited.set(key, true); if (depth === 0) { sourceStack = []; targetStack = []; @@ -26954,8 +27177,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -27031,10 +27254,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 160: + case 161: return true; case 70: - case 141: + case 142: node = node.parent; continue; default: @@ -27051,7 +27274,7 @@ var ts; if (node.kind === 98) { return "0"; } - if (node.kind === 177) { + if (node.kind === 178) { var key = getFlowCacheKey(node.expression); return key && key + "." + node.name.text; } @@ -27062,7 +27285,7 @@ var ts; case 70: case 98: return node; - case 177: + case 178: return getLeftmostIdentifierOrThis(node.expression); } return undefined; @@ -27071,19 +27294,19 @@ var ts; switch (source.kind) { case 70: return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 224 || target.kind === 174) && + (target.kind === 225 || target.kind === 175) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98: return target.kind === 98; - case 177: - return target.kind === 177 && + case 178: + return target.kind === 178 && source.name.text === target.name.text && isMatchingReference(source.expression, target.expression); } return false; } function containsMatchingReference(source, target) { - while (source.kind === 177) { + while (source.kind === 178) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -27092,7 +27315,7 @@ var ts; return false; } function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 177 && + return target.kind === 178 && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); } @@ -27100,7 +27323,7 @@ var ts; if (expr.kind === 70) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 177) { + if (expr.kind === 178) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.text); } @@ -27130,7 +27353,7 @@ var ts; } } } - if (callExpression.expression.kind === 177 && + if (callExpression.expression.kind === 178 && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -27169,8 +27392,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; result |= getTypeFacts(t); } return result; @@ -27178,7 +27401,7 @@ var ts; function isFunctionObjectType(type) { var resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || - resolved.members["bind"] && isTypeSubtypeOf(type, globalFunctionType)); + resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type) { var flags = type.flags; @@ -27221,6 +27444,9 @@ var ts; if (flags & 512) { return strictNullChecks ? 1981320 : 4193160; } + if (flags & 16777216) { + return strictNullChecks ? 6166480 : 8378320; + } if (flags & 16384) { var constraint = getConstraintOfTypeParameter(type); return getTypeFacts(constraint || emptyObjectType); @@ -27256,7 +27482,7 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 || node.parent.kind === 258 ? + return node.parent.kind === 176 || node.parent.kind === 259 ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } @@ -27275,21 +27501,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 213: - return stringType; case 214: + return stringType; + case 215: return checkRightHandSideOfForOf(parent.expression) || unknownType; - case 192: + case 193: return getAssignedTypeOfBinaryExpression(parent); - case 186: + case 187: return undefinedType; - case 175: + case 176: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 196: + case 197: return getAssignedTypeOfSpreadExpression(parent); - case 258: - return getAssignedTypeOfPropertyAssignment(parent); case 259: + return getAssignedTypeOfPropertyAssignment(parent); + case 260: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -27297,7 +27523,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 172 ? + var type = pattern.kind === 173 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : @@ -27312,35 +27538,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 213) { + if (node.parent.parent.kind === 214) { return stringType; } - if (node.parent.parent.kind === 214) { + if (node.parent.parent.kind === 215) { return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 224 ? + return node.kind === 225 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 224 || node.kind === 174 ? + return node.kind === 225 || node.kind === 175 ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 224 && node.initializer && + return node.kind === 225 && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 174 && node.parent.kind === 192 && + node.kind !== 175 && node.parent.kind === 193 && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 183: + case 184: return getReferenceCandidate(node.expression); - case 192: + case 193: switch (node.operatorToken.kind) { case 57: return getReferenceCandidate(node.left); @@ -27352,13 +27578,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 183 || - parent.kind === 192 && parent.operatorToken.kind === 57 && parent.left === node || - parent.kind === 192 && parent.operatorToken.kind === 25 && parent.right === node ? + return parent.kind === 184 || + parent.kind === 193 && parent.operatorToken.kind === 57 && parent.left === node || + parent.kind === 193 && parent.operatorToken.kind === 25 && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 254) { + if (clause.kind === 255) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -27460,8 +27686,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var t = types_13[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var t = types_14[_i]; if (!(t.flags & 8192)) { if (!(getObjectFlags(t) & 256)) { return false; @@ -27479,11 +27705,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 177 && (parent.name.text === "length" || - parent.parent.kind === 179 && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 178 && + var isLengthPushOrUnshift = parent.kind === 178 && (parent.name.text === "length" || + parent.parent.kind === 180 && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 179 && parent.expression === root && - parent.parent.kind === 192 && + parent.parent.kind === 193 && parent.parent.operatorToken.kind === 57 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -27512,7 +27738,7 @@ var ts; } function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) { var key; - if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215)) { + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 17810431)) { return declaredType; } var initialType = assumeInitialized ? declaredType : @@ -27522,7 +27748,7 @@ var ts; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); visitedFlowCount = visitedFlowStart; var resultType = getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent.kind === 201 && getTypeWithFacts(resultType, 524288).flags & 8192) { + if (reference.parent.kind === 202 && getTypeWithFacts(resultType, 524288).flags & 8192) { return declaredType; } return resultType; @@ -27567,7 +27793,7 @@ var ts; } else if (flow.flags & 2) { var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 177) { + if (container && container !== flowContainer && reference.kind !== 178) { flow = container.flowNode; continue; } @@ -27610,7 +27836,7 @@ var ts; } function getTypeAtFlowArrayMutation(flow) { var node = flow.node; - var expr = node.kind === 179 ? + var expr = node.kind === 180 ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -27618,7 +27844,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256) { var evolvedType_1 = type; - if (node.kind === 179) { + if (node.kind === 180) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -27693,8 +27919,9 @@ var ts; if (!key) { key = getFlowCacheKey(reference); } - if (cache[key]) { - return cache[key]; + var cached = cache.get(key); + if (cached) { + return cached; } for (var i = flowLoopStart; i < flowLoopCount; i++) { if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) { @@ -27716,8 +27943,9 @@ var ts; firstAntecedentType = flowType; } var type = getTypeFromFlowType(flowType); - if (cache[key]) { - return cache[key]; + var cached_1 = cache.get(key); + if (cached_1) { + return cached_1; } if (!ts.contains(antecedentTypes, type)) { antecedentTypes.push(type); @@ -27733,10 +27961,11 @@ var ts; if (isIncomplete(firstAntecedentType)) { return createFlowType(result, true); } - return cache[key] = result; + cache.set(key, result); + return result; } function isMatchingReferenceDiscriminant(expr) { - return expr.kind === 177 && + return expr.kind === 178 && declaredType.flags & 65536 && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(declaredType, expr.name.text); @@ -27770,10 +27999,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 187 && right_1.kind === 9) { + if (left_1.kind === 188 && right_1.kind === 9) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 187 && left_1.kind === 9) { + if (right_1.kind === 188 && left_1.kind === 9) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -27819,7 +28048,7 @@ var ts; assumeTrue ? 16384 : 131072; return getTypeWithFacts(type, facts); } - if (type.flags & 33281) { + if (type.flags & 16810497) { return type; } if (assumeTrue) { @@ -27844,14 +28073,14 @@ var ts; assumeTrue = !assumeTrue; } if (assumeTrue && !(type.flags & 65536)) { - var targetType = typeofTypesByName[literal.text]; + var targetType = typeofTypesByName.get(literal.text); if (targetType && isTypeSubtypeOf(targetType, type)) { return targetType; } } var facts = assumeTrue ? - typeofEQFacts[literal.text] || 64 : - typeofNEFacts[literal.text] || 8192; + typeofEQFacts.get(literal.text) || 64 : + typeofNEFacts.get(literal.text) || 8192; return getTypeWithFacts(type, facts); } function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { @@ -27951,7 +28180,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 178 || invokedExpression.kind === 177) { + if (invokedExpression.kind === 179 || invokedExpression.kind === 178) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -27968,15 +28197,15 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 178: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 179: + case 180: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 183: + case 184: return narrowType(type, expr.expression, assumeTrue); - case 192: + case 193: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 190: + case 191: if (expr.operator === 50) { return narrowType(type, expr.operand, !assumeTrue); } @@ -28003,9 +28232,9 @@ var ts; while (true) { node = node.parent; if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 232 || - node.kind === 262 || - node.kind === 147) { + node.kind === 233 || + node.kind === 263 || + node.kind === 148) { return node; } } @@ -28036,7 +28265,7 @@ var ts; if (node.kind === 70) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 145) { symbol.isAssigned = true; } } @@ -28056,7 +28285,7 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2) { - if (container.kind === 185) { + if (container.kind === 186) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (ts.hasModifier(container, 256)) { @@ -28074,7 +28303,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (declaration_1.kind === 227 + if (declaration_1.kind === 228 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -28086,11 +28315,11 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration_1.kind === 197) { + else if (declaration_1.kind === 198) { var container = ts.getThisContainer(node, false); while (container !== undefined) { if (container.parent === declaration_1) { - if (container.kind === 147 && ts.hasModifier(container, 32)) { + if (container.kind === 148 && ts.hasModifier(container, 32)) { getNodeLinks(declaration_1).flags |= 8388608; getNodeLinks(node).flags |= 16777216; } @@ -28120,12 +28349,12 @@ var ts; if (!(localOrExportSymbol.flags & 3) || assignmentKind === 1 || !declaration) { return type; } - var isParameter = ts.getRootDeclaration(declaration).kind === 144; + var isParameter = ts.getRootDeclaration(declaration).kind === 145; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; - while (flowContainer !== declarationContainer && (flowContainer.kind === 184 || - flowContainer.kind === 185 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 185 || + flowContainer.kind === 186 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -28161,7 +28390,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 257) { + symbol.valueDeclaration.parent.kind === 258) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -28179,8 +28408,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 212 && - ts.getAncestor(symbol.valueDeclaration, 225).parent === container && + if (container.kind === 213 && + ts.getAncestor(symbol.valueDeclaration, 226).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -28192,14 +28421,14 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 183) { + while (current.parent.kind === 184) { current = current.parent; } var isAssigned = false; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 190 || current.parent.kind === 191)) { + else if ((current.parent.kind === 191 || current.parent.kind === 192)) { var expr = current.parent; isAssigned = expr.operator === 42 || expr.operator === 43; } @@ -28218,7 +28447,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 147 || container.kind === 150) { + if (container.kind === 148 || container.kind === 151) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -28262,32 +28491,32 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 150) { + if (container.kind === 151) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } - if (container.kind === 185) { + if (container.kind === 186) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 231: + case 232: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 230: + case 231: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 150: + case 151: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 148: case 147: - case 146: if (ts.getModifierFlags(container) & 32) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 142: + case 143: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -28296,7 +28525,7 @@ var ts; } if (ts.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { - if (container.kind === 184 && + if (container.kind === 185 && ts.isInJavaScriptFile(container.parent) && ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { var className = container.parent @@ -28331,27 +28560,27 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 275) { + if (jsdocType && jsdocType.kind === 276) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 278) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 279) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 144) { + if (n.kind === 145) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 179 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 180 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 185) { + while (container && container.kind === 186) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -28360,16 +28589,16 @@ var ts; var nodeCheckFlag = 0; if (!canUseSuperExpression) { var current = node; - while (current && current !== container && current.kind !== 142) { + while (current && current !== container && current.kind !== 143) { current = current.parent; } - if (current && current.kind === 142) { + if (current && current.kind === 143) { 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 if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 177)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -28377,7 +28606,7 @@ var ts; } return unknownType; } - if (!isCallExpression && container.kind === 150) { + if (!isCallExpression && container.kind === 151) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if ((ts.getModifierFlags(container) & 32) || isCallExpression) { @@ -28387,7 +28616,7 @@ var ts; nodeCheckFlag = 256; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 149 && ts.getModifierFlags(container) & 256) { + if (container.kind === 150 && ts.getModifierFlags(container) & 256) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096; } @@ -28398,7 +28627,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 176) { + if (container.parent.kind === 177) { if (languageVersion < 2) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -28416,7 +28645,7 @@ var ts; } return unknownType; } - if (container.kind === 150 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 151 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -28428,24 +28657,24 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 150; + return container.kind === 151; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 176) { + if (ts.isClassLike(container.parent) || container.parent.kind === 177) { if (ts.getModifierFlags(container) & 32) { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || - container.kind === 152; + return container.kind === 150 || + container.kind === 149 || + container.kind === 152 || + container.kind === 153; } else { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || + return container.kind === 150 || + container.kind === 149 || container.kind === 152 || + container.kind === 153 || + container.kind === 148 || container.kind === 147 || - container.kind === 146 || - container.kind === 150; + container.kind === 151; } } } @@ -28453,7 +28682,7 @@ var ts; } } function getContextualThisParameterType(func) { - if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185) { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 186) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { var thisParameter = contextualSignature.thisParameter; @@ -28468,23 +28697,23 @@ var ts; var func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var iife = ts.getImmediatelyInvokedFunctionExpression(func); - if (iife) { + if (iife && iife.arguments) { var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (iife.arguments && indexOfParameter < iife.arguments.length) { - if (parameter.dotDotDotToken) { - var restTypes = []; - for (var i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); - } - return createArrayType(getUnionType(restTypes)); - } - var links = getNodeLinks(iife); - var cached = links.resolvedSignature; - links.resolvedSignature = anySignature; - var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); - links.resolvedSignature = cached; - return type; - } + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); + } + return restTypes.length ? createArrayType(getUnionType(restTypes)) : undefined; + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = indexOfParameter < iife.arguments.length ? + getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : + parameter.initializer ? undefined : undefinedWideningType; + links.resolvedSignature = cached; + return type; } var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -28509,7 +28738,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -28520,11 +28749,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_19 = declaration.propertyName || declaration.name; + var name = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_19)) { - var text = ts.getTextOfPropertyName(name_19); + !ts.isBindingPattern(name)) { + var text = ts.getTextOfPropertyName(name); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -28561,7 +28790,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 144 && node.parent.initializer === node) { + if (node.parent.kind === 145 && node.parent.initializer === node) { return true; } node = node.parent; @@ -28570,8 +28799,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 150 || - functionDecl.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152))) { + functionDecl.kind === 151 || + functionDecl.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 153))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -28590,7 +28819,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 181) { + if (template.parent.kind === 182) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -28627,8 +28856,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -28698,13 +28927,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 251) { + if (attribute.kind === 252) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 252) { + else if (attribute.kind === 253) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -28722,41 +28951,41 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 224: - case 144: + case 225: + case 145: + case 148: case 147: - case 146: - case 174: + case 175: return getContextualTypeForInitializerExpression(node); - case 185: - case 217: + case 186: + case 218: return getContextualTypeForReturnExpression(node); - case 195: + case 196: return getContextualTypeForYieldOperand(parent); - case 179: case 180: + case 181: return getContextualTypeForArgument(parent, node); - case 182: - case 200: + case 183: + case 201: return getTypeFromTypeNode(parent.type); - case 192: + case 193: return getContextualTypeForBinaryOperand(node); - case 258: case 259: + case 260: return getContextualTypeForObjectLiteralElement(parent); - case 175: + case 176: return getContextualTypeForElementExpression(node); - case 193: + case 194: return getContextualTypeForConditionalOperand(node); - case 203: - ts.Debug.assert(parent.parent.kind === 194); + case 204: + ts.Debug.assert(parent.parent.kind === 195); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 183: + case 184: return getContextualType(parent); - case 253: + case 254: return getContextualType(parent); - case 251: case 252: + case 253: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -28785,7 +29014,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 184 || node.kind === 185; + return node.kind === 185 || node.kind === 186; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -28798,7 +29027,7 @@ var ts; getApparentTypeOfContextualType(node); } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; @@ -28808,8 +29037,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var current = types_15[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var current = types_16[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -28839,8 +29068,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { - return (node.kind === 174 && !!node.initializer) || - (node.kind === 192 && node.operatorToken.kind === 57); + return (node.kind === 175 && !!node.initializer) || + (node.kind === 193 && node.operatorToken.kind === 57); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -28849,7 +29078,7 @@ var ts; var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 196) { + if (inDestructuringPattern && e.kind === 197) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -28861,7 +29090,7 @@ var ts; var type = checkExpressionForMutableLocation(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 196; + hasSpreadElement = hasSpreadElement || e.kind === 197; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -28872,7 +29101,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 173 || pattern.kind === 175)) { + if (pattern && (pattern.kind === 174 || pattern.kind === 176)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -28880,7 +29109,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 198) { + if (patternElement.kind !== 199) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -28897,7 +29126,7 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 142 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 143 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 340); @@ -28943,7 +29172,7 @@ var ts; var propagatedFlags = 0; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 172 || contextualType.pattern.kind === 176); + (contextualType.pattern.kind === 173 || contextualType.pattern.kind === 177); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -28952,25 +29181,25 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 258 || - memberDecl.kind === 259 || + if (memberDecl.kind === 259 || + memberDecl.kind === 260 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 258) { + if (memberDecl.kind === 259) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 149) { + else if (memberDecl.kind === 150) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 259); + ts.Debug.assert(memberDecl.kind === 260); type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 258 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 259 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 259 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 260 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912; } @@ -28996,12 +29225,12 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 260) { - if (languageVersion < 5) { + else if (memberDecl.kind === 261) { + if (languageVersion < 2) { checkExternalEmitHelpers(memberDecl, 2); } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; propertiesTable = ts.createMap(); hasComputedStringProperty = false; @@ -29013,12 +29242,12 @@ var ts; error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } - spread = getSpreadType(spread, type, false); + spread = getSpreadType(spread, type); offset = i + 1; continue; } else { - ts.Debug.assert(memberDecl.kind === 151 || memberDecl.kind === 152); + ts.Debug.assert(memberDecl.kind === 152 || memberDecl.kind === 153); checkAccessorDeclaration(memberDecl); } if (ts.hasDynamicName(memberDecl)) { @@ -29030,25 +29259,25 @@ var ts; } } else { - propertiesTable[member.name] = member; + propertiesTable.set(member.name, member); } propertiesArray.push(member); } if (contextualTypeHasPattern) { for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; - if (!propertiesTable[prop.name]) { + if (!propertiesTable.get(prop.name)) { if (!(prop.flags & 536870912)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable[prop.name] = prop; + propertiesTable.set(prop.name, prop); propertiesArray.push(prop); } } } if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); } if (spread.flags & 32768) { spread.flags |= propagatedFlags; @@ -29077,7 +29306,7 @@ var ts; } } function isValidSpreadType(type) { - return !!(type.flags & (1 | 4096 | 2048) || + return !!(type.flags & (1 | 4096 | 2048 | 16777216) || type.flags & 32768 && !isGenericMappedType(type) || type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); } @@ -29096,13 +29325,13 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 253: + case 254: checkJsxExpression(child); break; - case 247: + case 248: checkJsxElement(child); break; - case 248: + case 249: checkJsxSelfClosingElement(child); break; } @@ -29113,7 +29342,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 177 || tagName.kind === 98) { + if (tagName.kind === 178 || tagName.kind === 98) { return false; } else { @@ -29122,6 +29351,13 @@ var ts; } function checkJsxAttribute(node, elementAttributesType, nameTable) { var correspondingPropType = undefined; + var exprType; + if (node.initializer) { + exprType = checkExpression(node.initializer); + } + else { + exprType = booleanType; + } if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) { error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); } @@ -29141,17 +29377,10 @@ var ts; } } } - var exprType; - if (node.initializer) { - exprType = checkExpression(node.initializer); - } - else { - exprType = booleanType; - } if (correspondingPropType) { checkTypeAssignableTo(exprType, correspondingPropType, node); } - nameTable[node.name.text] = true; + nameTable.set(node.name.text, true); return exprType; } function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { @@ -29162,22 +29391,23 @@ var ts; var props = getPropertiesOfType(type); for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { var prop = props_2[_i]; - if (!nameTable[prop.name]) { + if (!nameTable.get(prop.name)) { var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); if (targetPropSym) { var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); } - nameTable[prop.name] = true; + nameTable.set(prop.name, true); } } return type; } function getJsxType(name) { - if (jsxTypes[name] === undefined) { - return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + var jsxType = jsxTypes.get(name); + if (jsxType === undefined) { + jsxTypes.set(name, jsxType = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } - return jsxTypes[name]; + return jsxType; } function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); @@ -29397,11 +29627,11 @@ var ts; var nameTable = ts.createMap(); var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 251) { + if (node.attributes[i].kind === 252) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 252); + ts.Debug.assert(node.attributes[i].kind === 253); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -29410,10 +29640,10 @@ var ts; } if (targetAttributesType && !sawSpreadedAny) { var targetProperties = getPropertiesOfType(targetAttributesType); - for (var i = 0; i < targetProperties.length; i++) { - if (!(targetProperties[i].flags & 536870912) && - !nameTable[targetProperties[i].name]) { - error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); + for (var _i = 0, targetProperties_1 = targetProperties; _i < targetProperties_1.length; _i++) { + var targetProperty = targetProperties_1[_i]; + if (!(targetProperty.flags & 536870912) && !nameTable.get(targetProperty.name)) { + error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperty.name, typeToString(targetAttributesType)); } } } @@ -29431,7 +29661,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 147; + return s.valueDeclaration ? s.valueDeclaration.kind : 148; } function getDeclarationModifierFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0; @@ -29442,13 +29672,16 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 || node.kind === 224 ? + var errorNode = node.kind === 178 || node.kind === 225 ? node.name : node.right; if (left.kind === 96) { - if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 149) { - error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); - return false; + if (languageVersion < 2) { + var propKind = getDeclarationKindFromSymbol(prop); + if (propKind !== 150 && propKind !== 149) { + error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + return false; + } } if (flags & 128) { error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass)); @@ -29490,16 +29723,17 @@ var ts; return true; } function checkNonNullExpression(node) { - var type = checkExpression(node); - if (strictNullChecks) { - var kind = getFalsyFlags(type) & 6144; - if (kind) { - error(node, kind & 2048 ? kind & 4096 ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); - } - return getNonNullableType(type); + return checkNonNullType(checkExpression(node), node); + } + function checkNonNullType(type, errorNode) { + var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 6144; + if (kind) { + error(errorNode, kind & 2048 ? kind & 4096 ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + var t = getNonNullableType(type); + return t.flags & (6144 | 8192) ? unknownType : t; } return type; } @@ -29547,6 +29781,10 @@ var ts; } var prop = getPropertyOfType(apparentType, right.text); if (!prop) { + var stringIndexType = getIndexTypeOfType(apparentType, 0); + if (stringIndexType) { + return stringIndexType; + } if (right.text && !checkAndReportErrorForExtendingInterface(node)) { reportNonexistentProperty(right, type.flags & 16384 && type.isThisType ? apparentType : type); } @@ -29565,7 +29803,7 @@ var ts; return unknownType; } } - if (node.kind !== 177 || assignmentKind === 1 || + if (node.kind !== 178 || assignmentKind === 1 || !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 65536)) { return propType; @@ -29574,7 +29812,7 @@ var ts; return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 177 + var left = node.kind === 178 ? node.expression : node.left; var type = checkExpression(left); @@ -29588,7 +29826,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 225) { + if (initializer.kind === 226) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -29610,7 +29848,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 213 && + if (node.kind === 214 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -29628,7 +29866,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 180 && node.parent.expression === node) { + if (node.parent.kind === 181 && 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); @@ -29648,7 +29886,7 @@ var ts; error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } - return getIndexedAccessType(objectType, indexType, node); + return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node); } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) { @@ -29681,10 +29919,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 181) { + if (node.kind === 182) { checkExpression(node.template); } - else if (node.kind !== 145) { + else if (node.kind !== 146) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -29706,19 +29944,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_9 = signature.declaration && signature.declaration.parent; + var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_9 === lastParent) { + if (lastParent && parent === lastParent) { index++; } else { - lastParent = parent_9; + lastParent = parent; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_9; + lastParent = parent; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -29735,7 +29973,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 196) { + if (arg && arg.kind === 197) { return i; } } @@ -29748,11 +29986,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 181) { + if (node.kind === 182) { var tagExpression = node; argCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 194) { + if (tagExpression.template.kind === 195) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -29764,7 +30002,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 145) { + else if (node.kind === 146) { isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, undefined, signature); @@ -29772,7 +30010,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 180); + ts.Debug.assert(callExpression.kind === 181); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -29831,7 +30069,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 !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { @@ -29878,7 +30116,7 @@ var ts; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 180) { + if (thisType && thisType !== voidType && node.kind !== 181) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; @@ -29891,7 +30129,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 !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { @@ -29906,28 +30144,28 @@ var ts; return true; } function getThisArgumentOfCall(node) { - if (node.kind === 179) { + if (node.kind === 180) { var callee = node.expression; - if (callee.kind === 177) { + if (callee.kind === 178) { return callee.expression; } - else if (callee.kind === 178) { + else if (callee.kind === 179) { return callee.expression; } } } function getEffectiveCallArguments(node) { var args; - if (node.kind === 181) { + if (node.kind === 182) { var template = node.template; args = [undefined]; - if (template.kind === 194) { + if (template.kind === 195) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 145) { + else if (node.kind === 146) { return undefined; } else { @@ -29936,21 +30174,21 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 145) { + if (node.kind === 146) { switch (node.parent.kind) { - case 227: - case 197: + case 228: + case 198: return 1; - case 147: + case 148: return 2; - case 149: - case 151: + case 150: case 152: + case 153: if (languageVersion === 0) { return 2; } return signature.parameters.length >= 3 ? 3 : 2; - case 144: + case 145: return 3; } } @@ -29959,48 +30197,48 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 227) { + if (node.kind === 228) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { return getParentTypeOfClassElement(node); } ts.Debug.fail("Unsupported decorator target."); return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 227) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { return anyType; } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var element = node; switch (element.name.kind) { case 70: case 8: case 9: return getLiteralTypeForText(32, element.name.text); - case 142: + case 143: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 512)) { return nameType; @@ -30017,20 +30255,20 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 227) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { return numberType; } - if (node.kind === 147) { + if (node.kind === 148) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); } @@ -30051,26 +30289,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex) { - if (node.kind === 145) { + if (node.kind === 146) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 145 || - (argIndex === 0 && node.kind === 181)) { + if (node.kind === 146 || + (argIndex === 0 && node.kind === 182)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 145) { + if (node.kind === 146) { return node.expression; } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return node.template; } else { @@ -30078,8 +30316,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 181; - var isDecorator = node.kind === 145; + var isTaggedTemplate = node.kind === 182; + var isDecorator = node.kind === 146; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -30109,7 +30347,7 @@ var ts; var candidateForTypeArgumentError; var resultOfFailedInference; var result; - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 180 && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma); } @@ -30378,16 +30616,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 227: - case 197: + case 228: + case 198: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 144: + case 145: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 147: + case 148: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 149: - case 151: + case 150: case 152: + case 153: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -30414,13 +30652,13 @@ var ts; } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 179: - return resolveCallExpression(node, candidatesOutArray); case 180: - return resolveNewExpression(node, candidatesOutArray); + return resolveCallExpression(node, candidatesOutArray); case 181: + return resolveNewExpression(node, candidatesOutArray); + case 182: return resolveTaggedTemplateExpression(node, candidatesOutArray); - case 145: + case 146: return resolveDecorator(node, candidatesOutArray); } ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); @@ -30452,12 +30690,12 @@ var ts; if (node.expression.kind === 96) { return voidType; } - if (node.kind === 180) { + if (node.kind === 181) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 150 && - declaration.kind !== 154 && - declaration.kind !== 159 && + declaration.kind !== 151 && + declaration.kind !== 155 && + declaration.kind !== 160 && !ts.isJSDocConstructSignature(declaration)) { var funcSymbol = node.expression.kind === 70 ? getResolvedSymbol(node.expression) : @@ -30488,9 +30726,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 226 + ? 227 : resolvedRequire.flags & 3 - ? 224 + ? 225 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -30524,7 +30762,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return unknownType; } - else if (container.kind === 150) { + else if (container.kind === 151) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -30600,8 +30838,8 @@ var ts; if (!links.type) { links.type = instantiateType(contextualType, mapper); if (links.type === emptyObjectType && - (parameter.valueDeclaration.name.kind === 172 || - parameter.valueDeclaration.name.kind === 173)) { + (parameter.valueDeclaration.name.kind === 173 || + parameter.valueDeclaration.name.kind === 174)) { links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); } assignBindingElementTypes(parameter.valueDeclaration); @@ -30640,7 +30878,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 205) { + if (func.body.kind !== 206) { 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); @@ -30719,7 +30957,7 @@ var ts; return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 219 && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 220 && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; @@ -30748,7 +30986,7 @@ var ts; } }); if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || - func.kind === 184 || func.kind === 185)) { + func.kind === 185 || func.kind === 186)) { return undefined; } if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) { @@ -30765,7 +31003,7 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 205 || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 206 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256; @@ -30792,9 +31030,9 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 184) { + if (!hasGrammarError && node.kind === 185) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -30828,7 +31066,7 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 149) { + if (produceDiagnostics && node.kind !== 150) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithCapturedNewTargetVariable(node, node.name); @@ -30836,7 +31074,7 @@ var ts; return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); if (!node.asteriskToken) { @@ -30846,7 +31084,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 205) { + if (node.body.kind === 206) { checkSourceElement(node.body); } else { @@ -30881,10 +31119,10 @@ var ts; function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { if (symbol.flags & 4 && - (expr.kind === 177 || expr.kind === 178) && + (expr.kind === 178 || expr.kind === 179) && expr.expression.kind === 98) { var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 150)) + if (!(func && func.kind === 151)) return true; return !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent); } @@ -30893,13 +31131,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 177 || expr.kind === 178) { + if (expr.kind === 178 || expr.kind === 179) { var node = ts.skipParentheses(expr.expression); if (node.kind === 70) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 238; + return declaration && declaration.kind === 239; } } } @@ -30907,7 +31145,7 @@ var ts; } function checkReferenceExpression(expr, invalidReferenceMessage) { var node = ts.skipParentheses(expr); - if (node.kind !== 70 && node.kind !== 177 && node.kind !== 178) { + if (node.kind !== 70 && node.kind !== 178 && node.kind !== 179) { error(expr, invalidReferenceMessage); return false; } @@ -30916,7 +31154,7 @@ var ts; function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); - if (expr.kind !== 177 && expr.kind !== 178) { + if (expr.kind !== 178 && expr.kind !== 179) { error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } @@ -30959,6 +31197,7 @@ var ts; case 36: case 37: case 51: + checkNonNullType(operandType, node.operand); if (maybeTypeOfKind(operandType, 512)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } @@ -30970,7 +31209,7 @@ var ts; booleanType; case 42: case 43: - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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_or_a_property_access); } @@ -30983,7 +31222,7 @@ var ts; if (operandType === silentNeverType) { return silentNeverType; } - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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_or_a_property_access); } @@ -30995,8 +31234,8 @@ var ts; } if (type.flags & 196608) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var t = types_17[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -31010,8 +31249,8 @@ var ts; } if (type.flags & 65536) { var types = type.types; - for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { - var t = types_17[_i]; + for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { + var t = types_18[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -31020,8 +31259,8 @@ var ts; } if (type.flags & 131072) { var types = type.types; - for (var _a = 0, types_18 = types; _a < types_18.length; _a++) { - var t = types_18[_a]; + for (var _a = 0, types_19 = types; _a < types_19.length; _a++) { + var t = types_19[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -31042,7 +31281,10 @@ var ts; if (isTypeOfKind(leftType, 8190)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } - if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(isTypeAny(rightType) || + getSignaturesOfType(rightType, 0).length || + getSignaturesOfType(rightType, 1).length || + isTypeSubtypeOf(rightType, globalFunctionType))) { error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; @@ -31051,6 +31293,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } @@ -31068,22 +31312,22 @@ var ts; return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 258 || property.kind === 259) { - var name_20 = property.name; - if (name_20.kind === 142) { - checkComputedPropertyName(name_20); + if (property.kind === 259 || property.kind === 260) { + var name = property.name; + if (name.kind === 143) { + checkComputedPropertyName(name); } - if (isComputedNonLiteralName(name_20)) { + if (isComputedNonLiteralName(name)) { return undefined; } - var text = ts.getTextOfPropertyName(name_20); + var text = ts.getTextOfPropertyName(name); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 259) { + if (property.kind === 260) { return checkDestructuringAssignment(property, type); } else { @@ -31091,10 +31335,10 @@ var ts; } } else { - error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 260) { + else if (property.kind === 261) { if (languageVersion < 5) { checkExternalEmitHelpers(property, 4); } @@ -31122,8 +31366,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 198) { - if (element.kind !== 196) { + if (element.kind !== 199) { + if (element.kind !== 197) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -31149,7 +31393,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 192 && restExpression.operatorToken.kind === 57) { + if (restExpression.kind === 193 && restExpression.operatorToken.kind === 57) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -31162,7 +31406,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 259) { + if (exprOrAssignment.kind === 260) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -31176,21 +31420,21 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 192 && target.operatorToken.kind === 57) { + if (target.kind === 193 && target.operatorToken.kind === 57) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 176) { + if (target.kind === 177) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 175) { + if (target.kind === 176) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 260 ? + var error = target.parent.kind === 261 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -31204,35 +31448,35 @@ var ts; case 70: case 9: case 11: - case 181: - case 194: + case 182: + case 195: case 12: case 8: case 100: case 85: case 94: - case 137: - case 184: - case 197: + case 138: case 185: - case 175: + case 198: + case 186: case 176: - case 187: - case 201: + case 177: + case 188: + case 202: + case 249: case 248: - case 247: return true; - case 193: + case 194: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 192: + case 193: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 190: case 191: + case 192: switch (node.operator) { case 50: case 36: @@ -31241,9 +31485,9 @@ var ts; return true; } return false; - case 188: - case 182: - case 200: + case 189: + case 183: + case 201: default: return false; } @@ -31263,7 +31507,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 57 && (left.kind === 176 || left.kind === 175)) { + if (operator === 57 && (left.kind === 177 || left.kind === 176)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -31294,12 +31538,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); var suggestedOperator = void 0; if ((leftType.flags & 136) && (rightType.flags & 136) && @@ -31319,12 +31559,10 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + if (!isTypeOfKind(leftType, 1 | 262178) && !isTypeOfKind(rightType, 1 | 262178)) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } var resultType = void 0; if (isTypeOfKind(leftType, 340) && isTypeOfKind(rightType, 340)) { resultType = numberType; @@ -31353,8 +31591,8 @@ var ts; case 29: case 30: if (checkForDisallowedESSymbolOperand(operator)) { - leftType = getBaseTypeOfLiteralType(leftType); - rightType = getBaseTypeOfLiteralType(rightType); + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -31523,7 +31761,7 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 182 || node.kind === 200; + return node.kind === 183 || node.kind === 201; } function checkDeclarationInitializer(declaration) { var type = checkExpressionCached(declaration.initializer); @@ -31534,11 +31772,11 @@ var ts; function isLiteralContextualType(contextualType) { if (contextualType) { if (contextualType.flags & 540672) { - var apparentType = getApparentTypeOfTypeVariable(contextualType); - if (apparentType.flags & (2 | 4 | 8 | 16)) { + var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; + if (constraint.flags & (2 | 4 | 8 | 16)) { return true; } - contextualType = apparentType; + contextualType = constraint; } return maybeTypeOfKind(contextualType, (480 | 262144)); } @@ -31549,14 +31787,14 @@ var ts; return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type); } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -31578,7 +31816,7 @@ var ts; return type; } function getTypeOfExpression(node) { - if (node.kind === 179 && node.expression.kind !== 96) { + if (node.kind === 180 && node.expression.kind !== 96) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -31589,7 +31827,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 141) { + if (node.kind === 142) { type = checkQualifiedName(node); } else { @@ -31597,9 +31835,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 177 && node.parent.expression === node) || - (node.parent.kind === 178 && node.parent.expression === node) || - ((node.kind === 70 || node.kind === 141) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 178 && node.parent.expression === node) || + (node.parent.kind === 179 && node.parent.expression === node) || + ((node.kind === 70 || node.kind === 142) && 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); } @@ -31621,68 +31859,68 @@ var ts; case 100: case 85: return checkLiteralExpression(node); - case 194: + case 195: return checkTemplateExpression(node); case 12: return stringType; case 11: return globalRegExpType; - case 175: - return checkArrayLiteral(node, contextualMapper); case 176: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, contextualMapper); case 177: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, contextualMapper); case 178: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 179: + return checkIndexedAccess(node); case 180: - return checkCallExpression(node); case 181: + return checkCallExpression(node); + case 182: return checkTaggedTemplateExpression(node); - case 183: + case 184: return checkExpression(node.expression, contextualMapper); - case 197: + case 198: return checkClassExpression(node); - case 184: case 185: + case 186: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 187: + case 188: return checkTypeOfExpression(node); - case 182: - case 200: - return checkAssertion(node); + case 183: case 201: - return checkNonNullAssertion(node); + return checkAssertion(node); case 202: + return checkNonNullAssertion(node); + case 203: return checkMetaProperty(node); - case 186: + case 187: return checkDeleteExpression(node); - case 188: - return checkVoidExpression(node); case 189: - return checkAwaitExpression(node); + return checkVoidExpression(node); case 190: - return checkPrefixUnaryExpression(node); + return checkAwaitExpression(node); case 191: - return checkPostfixUnaryExpression(node); + return checkPrefixUnaryExpression(node); case 192: - return checkBinaryExpression(node, contextualMapper); + return checkPostfixUnaryExpression(node); case 193: + return checkBinaryExpression(node, contextualMapper); + case 194: return checkConditionalExpression(node, contextualMapper); - case 196: + case 197: return checkSpreadExpression(node, contextualMapper); - case 198: + case 199: return undefinedWideningType; - case 195: + case 196: return checkYieldExpression(node); - case 253: + case 254: return checkJsxExpression(node); - case 247: - return checkJsxElement(node); case 248: - return checkJsxSelfClosingElement(node); + return checkJsxElement(node); case 249: + return checkJsxSelfClosingElement(node); + case 250: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -31692,6 +31930,10 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!hasNonCircularBaseConstraint(typeParameter)) { + error(node.constraint, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + } getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); if (produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); @@ -31703,7 +31945,7 @@ var ts; var func = ts.getContainingFunction(node); if (ts.getModifierFlags(node) & 92) { func = ts.getContainingFunction(node); - if (!(func.kind === 150 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 151 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -31714,7 +31956,7 @@ var ts; if (ts.indexOf(func.parameters, node) !== 0) { error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); } - if (func.kind === 150 || func.kind === 154 || func.kind === 159) { + if (func.kind === 151 || func.kind === 155 || func.kind === 160) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } } @@ -31726,9 +31968,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 149 || - node.kind === 226 || - node.kind === 184; + return node.kind === 150 || + node.kind === 227 || + node.kind === 185; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -31769,9 +32011,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_21 = _a[_i].name; - if (ts.isBindingPattern(name_21) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) { + var name = _a[_i].name; + if (ts.isBindingPattern(name) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -31784,16 +32026,16 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { + case 186: + case 154: + case 227: case 185: - case 153: - case 226: - case 184: - case 158: + case 159: + case 150: case 149: - case 148: - var parent_10 = node.parent; - if (node === parent_10.type) { - return parent_10; + var parent = node.parent; + if (node === parent.type) { + return parent; } } } @@ -31803,27 +32045,27 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_22 = element.name; - if (name_22.kind === 70 && - name_22.text === predicateVariableName) { + var name = element.name; + if (name.kind === 70 && + name.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_22.kind === 173 || - name_22.kind === 172) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) { + else if (name.kind === 174 || + name.kind === 173) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } } } } function checkSignatureDeclaration(node) { - if (node.kind === 155) { + if (node.kind === 156) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 || node.kind === 226 || node.kind === 159 || - node.kind === 153 || node.kind === 150 || - node.kind === 154) { + else if (node.kind === 159 || node.kind === 227 || node.kind === 160 || + node.kind === 154 || node.kind === 151 || + node.kind === 155) { checkGrammarFunctionLikeDeclaration(node); } if (ts.isAsyncFunctionLike(node) && languageVersion < 4) { @@ -31841,10 +32083,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 154: + case 155: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 153: + case 154: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -31875,7 +32117,7 @@ var ts; var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150) { + if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param)) { @@ -31884,18 +32126,18 @@ var ts; } } else { - var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114; }); + var isStatic = ts.getModifierFlags(member) & 32; var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { switch (member.kind) { - case 151: + case 152: addName(names, member.name, memberName, 1); break; - case 152: + case 153: addName(names, member.name, memberName, 2); break; - case 147: + case 148: addName(names, member.name, memberName, 3); break; } @@ -31903,17 +32145,38 @@ var ts; } } function addName(names, location, name, meaning) { - var prev = names[name]; + var prev = names.get(name); if (prev) { if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { - names[name] = prev | meaning; + names.set(name, prev | meaning); } } else { - names[name] = meaning; + names.set(name, meaning); + } + } + } + function checkClassForStaticPropertyNameConflicts(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var memberNameNode = member.name; + var isStatic = ts.getModifierFlags(member) & 32; + if (isStatic && memberNameNode) { + var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); + switch (memberName) { + case "name": + case "length": + case "caller": + case "arguments": + case "prototype": + var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; + var className = getNameOfSymbol(getSymbolOfNode(node)); + error(memberNameNode, message, memberName, className); + break; + } } } } @@ -31921,7 +32184,7 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind == 146) { + if (member.kind == 147) { var memberName = void 0; switch (member.name.kind) { case 9: @@ -31932,18 +32195,18 @@ var ts; default: continue; } - if (names[memberName]) { + if (names.get(memberName)) { error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName); error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName); } else { - names[memberName] = true; + names.set(memberName, true); } } } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 228) { + if (node.kind === 229) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -31958,7 +32221,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 134: + case 135: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -32025,12 +32288,12 @@ var ts; if (n.kind === 98) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 && n.kind !== 226) { + else if (n.kind !== 185 && n.kind !== 227) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 147 && + return n.kind === 148 && !(ts.getModifierFlags(n) & 32) && !!n.initializer; } @@ -32050,7 +32313,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -32073,18 +32336,18 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 151) { + if (node.kind === 152) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128)) { if (!(node.flags & 256)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); } } } - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 151 ? 152 : 151; + var otherKind = node.kind === 152 ? 153 : 152; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if ((ts.getModifierFlags(node) & 28) !== (ts.getModifierFlags(otherAccessor) & 28)) { @@ -32098,11 +32361,11 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 151) { + if (node.kind === 152) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } - if (node.parent.kind !== 176) { + if (node.parent.kind !== 177) { checkSourceElement(node.body); registerForUnusedIdentifiersCheck(node); } @@ -32183,25 +32446,42 @@ var ts; function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement); } + function checkIndexedAccessIndexType(type, accessNode) { + if (!(type.flags & 524288)) { + return type; + } + var objectType = type.objectType; + var indexType = type.indexType; + if (isTypeAssignableTo(indexType, getIndexType(objectType))) { + return type; + } + if (maybeTypeOfKind(objectType, 540672) && isTypeOfKind(indexType, 340)) { + var constraint = getBaseConstraintOfType(objectType); + if (constraint && getIndexInfoOfType(constraint, 1)) { + return type; + } + } + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return type; + } function checkIndexedAccessType(node) { - getTypeFromIndexedAccessTypeNode(node); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node) { checkSourceElement(node.typeParameter); checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 540672 ? getApparentTypeOfTypeVariable(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 228 && - n.parent.kind !== 227 && - n.parent.kind !== 197 && + if (n.parent.kind !== 229 && + n.parent.kind !== 228 && + n.parent.kind !== 198 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; @@ -32278,7 +32558,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) { - var reportError = (node.kind === 149 || node.kind === 148) && + var reportError = (node.kind === 150 || node.kind === 149) && (ts.getModifierFlags(node) & 32) !== (ts.getModifierFlags(subsequentNode) & 32); if (reportError) { var diagnostic = ts.getModifierFlags(node) & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; @@ -32311,11 +32591,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 228 || node.parent.kind === 161 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 229 || node.parent.kind === 162 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 226 || node.kind === 149 || node.kind === 148 || node.kind === 150) { + if (node.kind === 227 || node.kind === 150 || node.kind === 149 || node.kind === 151) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -32426,16 +32706,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 228: + case 229: return 2097152; - case 231: + case 232: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 227: - case 230: + case 228: + case 231: return 2097152 | 1048576; - case 235: + case 236: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -32583,22 +32863,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 227: + case 228: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 144: + case 145: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 147: + case 148: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 149: - case 151: + case 150: case 152: + case 153: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -32632,13 +32912,13 @@ var ts; } var firstDecorator = node.decorators[0]; checkExternalEmitHelpers(firstDecorator, 8); - if (node.kind === 144) { + if (node.kind === 145) { checkExternalEmitHelpers(firstDecorator, 32); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 227: + case 228: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -32647,19 +32927,19 @@ var ts; } } break; - case 149: - case 151: + case 150: case 152: + case 153: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; - case 147: + case 148: markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); break; - case 144: + case 145: markTypeNodeAsReferenced(node.type); break; } @@ -32680,7 +32960,7 @@ var ts; checkDecorators(node); checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); - if (node.name && node.name.kind === 142) { + if (node.name && node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -32722,43 +33002,43 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 262: - case 231: + case 263: + case 232: checkUnusedModuleMembers(node); break; - case 227: - case 197: + case 228: + case 198: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 228: + case 229: checkUnusedTypeParameters(node); break; - case 205: - case 233: - case 212: + case 206: + case 234: case 213: case 214: + case 215: checkUnusedLocalsAndParameters(node); break; - case 150: - case 184: - case 226: - case 185: - case 149: case 151: + case 185: + case 227: + case 186: + case 150: case 152: + case 153: if (node.body) { checkUnusedLocalsAndParameters(node); } checkUnusedTypeParameters(node); break; - case 148: - case 153: + case 149: case 154: case 155: - case 158: + case 156: case 159: + case 160: checkUnusedTypeParameters(node); break; } @@ -32767,11 +33047,10 @@ var ts; } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 228 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_2 = function (key) { - var local = node.locals[key]; + if (node.parent.kind !== 229 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + node.locals.forEach(function (local) { if (!local.isReferenced) { - if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144) { + if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 145) { var parameter = ts.getRootDeclaration(local.valueDeclaration); if (compilerOptions.noUnusedParameters && !ts.isParameterPropertyDeclaration(parameter) && @@ -32784,10 +33063,7 @@ var ts; ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); }); } } - }; - for (var key in node.locals) { - _loop_2(key); - } + }); } } function isRemovedPropertyFromObjectSpread(node) { @@ -32800,9 +33076,9 @@ var ts; function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 224 && - (declaration.parent.parent.kind === 213 || - declaration.parent.parent.kind === 214)) { + if (declaration.kind === 225 && + (declaration.parent.parent.kind === 214 || + declaration.parent.parent.kind === 215)) { return; } } @@ -32821,12 +33097,12 @@ var ts; if (node.members) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 149 || member.kind === 147) { + if (member.kind === 150 || member.kind === 148) { if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8) { error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); } } - else if (member.kind === 150) { + else if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8) { @@ -32857,8 +33133,7 @@ var ts; } function checkUnusedModuleMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { - for (var key in node.locals) { - var local = node.locals[key]; + node.locals.forEach(function (local) { if (!local.isReferenced && !local.exportSymbol) { for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; @@ -32867,11 +33142,11 @@ var ts; } } } - } + }); } } function checkBlock(node) { - if (node.kind === 205) { + if (node.kind === 206) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -32893,19 +33168,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 147 || - node.kind === 146 || + if (node.kind === 148 || + node.kind === 147 || + node.kind === 150 || node.kind === 149 || - node.kind === 148 || - node.kind === 151 || - node.kind === 152) { + node.kind === 152 || + node.kind === 153) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 144 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 145 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -32977,11 +33252,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 263 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -32989,11 +33264,11 @@ var ts; if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { + if (parent.kind === 263 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -33001,7 +33276,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 224 && !node.initializer) { + if (node.kind === 225 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -33011,25 +33286,25 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 225); - var container = varDeclList.parent.kind === 206 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 226); + var container = varDeclList.parent.kind === 207 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 205 && ts.isFunctionLike(container.parent) || + (container.kind === 206 && ts.isFunctionLike(container.parent) || + container.kind === 233 || container.kind === 232 || - container.kind === 231 || - container.kind === 262); + container.kind === 263); if (!namesShareScope) { - var name_23 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23); + var name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 144) { + if (ts.getRootDeclaration(node).kind !== 145) { return; } var func = ts.getContainingFunction(node); @@ -33038,7 +33313,7 @@ var ts; if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { return; } - if (n.kind === 177) { + if (n.kind === 178) { return visit(n.expression); } else if (n.kind === 70) { @@ -33052,8 +33327,8 @@ var ts; } var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144 || - symbol.valueDeclaration.kind === 174) { + if (symbol.valueDeclaration.kind === 145 || + symbol.valueDeclaration.kind === 175) { if (symbol.valueDeclaration.pos < node.pos) { return; } @@ -33062,7 +33337,7 @@ var ts; if (ts.isFunctionLike(current.parent)) { return; } - if (current.parent.kind === 147 && + if (current.parent.kind === 148 && !(ts.hasModifier(current.parent, 32)) && ts.isClassLike(current.parent.parent)) { return; @@ -33084,37 +33359,37 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 174) { - if (node.parent.kind === 172 && languageVersion < 5 && !ts.isInAmbientContext(node)) { + if (node.kind === 175) { + if (node.parent.kind === 173 && languageVersion < 5 && !ts.isInAmbientContext(node)) { checkExternalEmitHelpers(node, 4); } - if (node.propertyName && node.propertyName.kind === 142) { + if (node.propertyName && node.propertyName.kind === 143) { checkComputedPropertyName(node.propertyName); } - var parent_11 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_11); - var name_24 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); + var parent = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent); + var name = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name)); markPropertyAsReferenced(property); - if (parent_11.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + if (parent.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent, parent.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 144 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 145 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 213) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -33123,7 +33398,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol)); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 213) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -33141,9 +33416,9 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 147 && node.kind !== 146) { + if (node.kind !== 148 && node.kind !== 147) { checkExportsOnMergedDeclarations(node); - if (node.kind === 224 || node.kind === 174) { + if (node.kind === 225 || node.kind === 175) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -33154,8 +33429,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 && right.kind === 224) || - (left.kind === 224 && right.kind === 144)) { + if ((left.kind === 145 && right.kind === 225) || + (left.kind === 225 && right.kind === 145)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -33182,7 +33457,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 176) { + if (node.modifiers && node.parent.kind === 177) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -33201,7 +33476,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 207) { + if (node.thenStatement.kind === 208) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -33218,12 +33493,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 225) { + if (node.initializer && node.initializer.kind === 226) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 225) { + if (node.initializer.kind === 226) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -33241,13 +33516,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 225) { + if (node.initializer.kind === 226) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 175 || varExpr.kind === 176) { + if (varExpr.kind === 176 || varExpr.kind === 177) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -33266,7 +33541,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); - if (node.initializer.kind === 225) { + if (node.initializer.kind === 226) { 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); @@ -33276,7 +33551,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 175 || varExpr.kind === 176) { + if (varExpr.kind === 176 || varExpr.kind === 177) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -33452,7 +33727,7 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152))); + return !!(node.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 153))); } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; @@ -33474,30 +33749,30 @@ var ts; if (func.asteriskToken) { return; } - if (func.kind === 152) { + if (func.kind === 153) { if (node.expression) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 150) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { - error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + else if (func.kind === 151) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { - checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + checkTypeAssignableTo(awaitedType, promisedType, node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression || node); + checkTypeAssignableTo(exprType, returnType, node); } } } - else if (func.kind !== 150 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + else if (func.kind !== 151 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } } @@ -33523,7 +33798,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 255 && !hasDuplicateDefaultClause) { + if (clause.kind === 256 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -33535,7 +33810,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 254) { + if (produceDiagnostics && clause.kind === 255) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); var caseIsLiteral = isLiteralType(caseType); @@ -33561,7 +33836,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 220 && current.label.text === node.label.text) { + if (current.kind === 221 && 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; @@ -33594,14 +33869,14 @@ var ts; grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var blockLocals = catchClause.block.locals; - if (blockLocals) { - for (var caughtName in catchClause.locals) { - var blockLocal = blockLocals[caughtName]; + var blockLocals_1 = catchClause.block.locals; + if (blockLocals_1) { + ts.forEachKey(catchClause.locals, function (caughtName) { + var blockLocal = blockLocals_1.get(caughtName); if (blockLocal && (blockLocal.flags & 2) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); } - } + }); } } } @@ -33649,12 +33924,13 @@ var ts; if (!indexType) { return; } - if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { + var propDeclaration = prop.valueDeclaration; + if (indexKind === 1 && !(propDeclaration ? isNumericName(propDeclaration.name) : isNumericLiteralName(prop.name))) { return; } var errorNode; - if (prop.valueDeclaration.name.kind === 142 || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + if (propDeclaration && (propDeclaration.name.kind === 143 || prop.parent === containingType.symbol)) { + errorNode = propDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; @@ -33679,6 +33955,7 @@ var ts; case "string": case "symbol": case "void": + case "object": error(name, message, name.text); } } @@ -33704,7 +33981,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 || declaration.kind === 228) { + if (declaration.kind === 228 || declaration.kind === 229) { if (!firstDecl) { firstDecl = declaration; } @@ -33749,6 +34026,9 @@ var ts; var staticType = getTypeOfSymbol(symbol); checkTypeParameterListsIdentical(node, symbol); checkClassForDuplicateDeclarations(node); + if (!ts.isInAmbientContext(node)) { + checkClassForStaticPropertyNameConflicts(node); + } var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { if (languageVersion < 2 && !ts.isInAmbientContext(node)) { @@ -33757,7 +34037,8 @@ var ts; var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; - var staticBaseType = getBaseConstructorTypeOfClass(type); + var baseConstructorType = getBaseConstructorTypeOfClass(type); + var staticBaseType = getApparentType(baseConstructorType); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { @@ -33771,14 +34052,17 @@ var ts; } checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType_1.symbol.valueDeclaration && + if (baseConstructorType.flags & 540672 && !isMixinConstructorType(staticType)) { + error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); + } + if (baseType_1.symbol && baseType_1.symbol.valueDeclaration && !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 227) { + baseType_1.symbol.valueDeclaration.kind === 228) { if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); } } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 540672)) { var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); @@ -33798,8 +34082,7 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { - var declaredType = getObjectFlags(t) & 4 ? t.target : t; - if (getObjectFlags(declaredType) & 3) { + if (isValidBaseType(t)) { checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -33833,7 +34116,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { - var baseProperties = getPropertiesOfObjectType(baseType); + var baseProperties = getPropertiesOfType(baseType); for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); @@ -33847,7 +34130,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128))) { - if (derivedClassDecl.kind === 197) { + if (derivedClassDecl.kind === 198) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -33891,7 +34174,7 @@ var ts; } } function isAccessor(kind) { - return kind === 151 || kind === 152; + return kind === 152 || kind === 153; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -33924,16 +34207,16 @@ var ts; return true; } var seen = ts.createMap(); - ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.name, { prop: p, containingType: type }); }); var ok = true; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); + var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { var prop = properties_7[_a]; - var existing = seen[prop.name]; + var existing = seen.get(prop.name); if (!existing) { - seen[prop.name] = { prop: prop, containingType: base }; + seen.set(prop.name, { prop: prop, containingType: base }); } else { var isInheritedProperty = existing.containingType !== type; @@ -33958,7 +34241,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 228); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 229); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -34054,7 +34337,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 190: + case 191: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -34065,7 +34348,7 @@ var ts; case 51: return ~value_1; } return undefined; - case 192: + case 193: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -34091,11 +34374,11 @@ var ts; case 8: checkGrammarNumericLiteral(e); return +e.text; - case 183: + case 184: return evalConstant(e.expression); case 70: + case 179: case 178: - case 177: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -34106,7 +34389,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 178) { + if (e.kind === 179) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -34123,7 +34406,7 @@ var ts; if (current.kind === 70) { break; } - else if (current.kind === 177) { + else if (current.kind === 178) { current = current.expression; } else { @@ -34184,7 +34467,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 230) { + if (declaration.kind !== 231) { return false; } var enumDeclaration = declaration; @@ -34207,8 +34490,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 227 || - (declaration.kind === 226 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 228 || + (declaration.kind === 227 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -34267,7 +34550,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, 227); + var mergedClass = ts.getDeclarationOfKind(symbol, 228); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -34310,36 +34593,36 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 206: + case 207: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 241: case 242: + case 243: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 235: case 236: + case 237: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 174: - case 224: - var name_25 = node.name; - if (ts.isBindingPattern(name_25)) { - for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { + case 175: + case 225: + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } - case 227: - case 230: - case 226: case 228: case 231: + case 227: case 229: + case 232: + case 230: if (isGlobalAugmentation) { return; } @@ -34357,12 +34640,12 @@ var ts; switch (node.kind) { case 70: return node; - case 141: + case 142: do { node = node.left; } while (node.kind !== 70); return node; - case 177: + case 178: do { node = node.expression; } while (node.kind !== 70); @@ -34375,9 +34658,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 262 && !inAmbientExternalModule) { - error(moduleName, node.kind === 242 ? + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 263 && !inAmbientExternalModule) { + error(moduleName, node.kind === 243 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -34398,7 +34681,7 @@ var ts; (symbol.flags & 793064 ? 793064 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 244 ? + var message = node.kind === 245 ? 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)); @@ -34425,7 +34708,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 238) { + if (importClause.namedBindings.kind === 239) { checkImportBinding(importClause.namedBindings); } else { @@ -34476,8 +34759,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 262 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 263 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -34490,7 +34773,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 262 || node.parent.kind === 232 || node.parent.kind === 231; + var isInAppropriateContext = node.parent.kind === 263 || node.parent.kind === 233 || node.parent.kind === 232; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -34513,8 +34796,8 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 262 ? node.parent : node.parent.parent; - if (container.kind === 231 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 263 ? node.parent : node.parent.parent; + if (container.kind === 232 && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -34543,18 +34826,13 @@ var ts; } } function hasExportedMembers(moduleSymbol) { - for (var id in moduleSymbol.exports) { - if (id !== "export=") { - return true; - } - } - return false; + return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; }); } function checkExternalModuleExports(node) { var moduleSymbol = getSymbolOfNode(node); var links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - var exportEqualsSymbol = moduleSymbol.exports["export="]; + var exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (!isTopLevelInExternalModuleAugmentation(declaration)) { @@ -34562,17 +34840,17 @@ var ts; } } var exports = getExportsOfModule(moduleSymbol); - for (var id in exports) { + exports && exports.forEach(function (_a, id) { + var declarations = _a.declarations, flags = _a.flags; if (id === "__export") { - continue; + return; } - var _a = exports[id], declarations = _a.declarations, flags = _a.flags; if (flags & (1920 | 64 | 384)) { - continue; + return; } var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); if (flags & 524288 && exportedDeclarationsCount <= 2) { - continue; + return; } if (exportedDeclarationsCount > 1) { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -34582,11 +34860,11 @@ var ts; } } } - } + }); links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 226 && declaration.kind !== 149) || + return (declaration.kind !== 227 && declaration.kind !== 150) || !!declaration.body; } } @@ -34597,123 +34875,123 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 231: - case 227: + case 232: case 228: - case 226: + case 229: + case 227: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 143: - return checkTypeParameter(node); case 144: + return checkTypeParameter(node); + case 145: return checkParameter(node); + case 148: case 147: - case 146: return checkPropertyDeclaration(node); - case 158: case 159: - case 153: + case 160: case 154: - return checkSignatureDeclaration(node); case 155: return checkSignatureDeclaration(node); + case 156: + return checkSignatureDeclaration(node); + case 150: case 149: - case 148: return checkMethodDeclaration(node); - case 150: - return checkConstructorDeclaration(node); case 151: + return checkConstructorDeclaration(node); case 152: + case 153: return checkAccessorDeclaration(node); - case 157: + case 158: return checkTypeReferenceNode(node); - case 156: + case 157: return checkTypePredicate(node); - case 160: - return checkTypeQuery(node); case 161: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 162: - return checkArrayType(node); + return checkTypeLiteral(node); case 163: - return checkTupleType(node); + return checkArrayType(node); case 164: + return checkTupleType(node); case 165: - return checkUnionOrIntersectionType(node); case 166: - case 168: - return checkSourceElement(node.type); + return checkUnionOrIntersectionType(node); + case 167: case 169: - return checkIndexedAccessType(node); + return checkSourceElement(node.type); case 170: + return checkIndexedAccessType(node); + case 171: return checkMappedType(node); - case 226: + case 227: return checkFunctionDeclaration(node); - case 205: - case 232: - return checkBlock(node); case 206: + case 233: + return checkBlock(node); + case 207: return checkVariableStatement(node); - case 208: - return checkExpressionStatement(node); case 209: - return checkIfStatement(node); + return checkExpressionStatement(node); case 210: - return checkDoStatement(node); + return checkIfStatement(node); case 211: - return checkWhileStatement(node); + return checkDoStatement(node); case 212: - return checkForStatement(node); + return checkWhileStatement(node); case 213: - return checkForInStatement(node); + return checkForStatement(node); case 214: - return checkForOfStatement(node); + return checkForInStatement(node); case 215: + return checkForOfStatement(node); case 216: - return checkBreakOrContinueStatement(node); case 217: - return checkReturnStatement(node); + return checkBreakOrContinueStatement(node); case 218: - return checkWithStatement(node); + return checkReturnStatement(node); case 219: - return checkSwitchStatement(node); + return checkWithStatement(node); case 220: - return checkLabeledStatement(node); + return checkSwitchStatement(node); case 221: - return checkThrowStatement(node); + return checkLabeledStatement(node); case 222: + return checkThrowStatement(node); + case 223: return checkTryStatement(node); - case 224: + case 225: return checkVariableDeclaration(node); - case 174: + case 175: return checkBindingElement(node); - case 227: - return checkClassDeclaration(node); case 228: - return checkInterfaceDeclaration(node); + return checkClassDeclaration(node); case 229: - return checkTypeAliasDeclaration(node); + return checkInterfaceDeclaration(node); case 230: - return checkEnumDeclaration(node); + return checkTypeAliasDeclaration(node); case 231: + return checkEnumDeclaration(node); + case 232: return checkModuleDeclaration(node); - case 236: + case 237: return checkImportDeclaration(node); - case 235: + case 236: return checkImportEqualsDeclaration(node); - case 242: + case 243: return checkExportDeclaration(node); - case 241: + case 242: return checkExportAssignment(node); - case 207: + case 208: checkGrammarStatementInAmbientContext(node); return; - case 223: + case 224: checkGrammarStatementInAmbientContext(node); return; - case 245: + case 246: return checkMissingDeclaration(node); } } @@ -34726,17 +35004,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 184: case 185: + case 186: + case 150: case 149: - case 148: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 151: case 152: + case 153: checkAccessorDeferred(node); break; - case 197: + case 198: checkClassExpressionDeferred(node); break; } @@ -34824,7 +35102,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 218 && node.parent.statement === node) { + if (node.parent.kind === 219 && node.parent.statement === node) { return true; } node = node.parent; @@ -34846,28 +35124,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 262: + case 263: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 231: + case 232: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 230: + case 231: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 197: + case 198: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 227: case 228: + case 229: if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793064); } break; - case 184: + case 185: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -34885,17 +35163,16 @@ var ts; function copySymbol(symbol, meaning) { if (symbol.flags & meaning) { var id = symbol.name; - if (!symbols[id]) { - symbols[id] = symbol; + if (!symbols.has(id)) { + symbols.set(id, symbol); } } } function copySymbols(source, meaning) { if (meaning) { - for (var id in source) { - var symbol = source[id]; + source.forEach(function (symbol) { copySymbol(symbol, meaning); - } + }); } } } @@ -34906,27 +35183,27 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 143: - case 227: + case 144: case 228: case 229: case 230: + case 231: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 141) { + while (node.parent && node.parent.kind === 142) { node = node.parent; } - return node.parent && (node.parent.kind === 157 || node.parent.kind === 273); + return node.parent && (node.parent.kind === 158 || node.parent.kind === 274); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 177) { + while (node.parent && node.parent.kind === 178) { node = node.parent; } - return node.parent && node.parent.kind === 199; + return node.parent && node.parent.kind === 200; } function forEachEnclosingClass(node, callback) { var result; @@ -34943,13 +35220,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 141) { + while (nodeOnRightSide.parent.kind === 142) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 235) { + if (nodeOnRightSide.parent.kind === 236) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 241) { + if (nodeOnRightSide.parent.kind === 242) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -34961,7 +35238,7 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 178) { var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); switch (specialPropertyAssignmentKind) { case 1: @@ -34973,11 +35250,11 @@ var ts; default: } } - if (entityName.parent.kind === 241 && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 242 && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608); } - if (entityName.kind !== 177 && isInRightSideOfImportOrExportAssignment(entityName)) { - var importEqualsDeclaration = ts.getAncestor(entityName, 235); + if (entityName.kind !== 178 && isInRightSideOfImportOrExportAssignment(entityName)) { + var importEqualsDeclaration = ts.getAncestor(entityName, 236); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true); } @@ -34986,7 +35263,7 @@ var ts; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 199) { + if (entityName.parent.kind === 200) { meaning = 793064; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 107455; @@ -35008,14 +35285,14 @@ var ts; } return resolveEntityName(entityName, 107455, false, true); } - else if (entityName.kind === 177) { + else if (entityName.kind === 178) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 141) { + else if (entityName.kind === 142) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -35024,19 +35301,19 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 273) ? 793064 : 1920; + var meaning = (entityName.parent.kind === 158 || entityName.parent.kind === 274) ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 251) { + else if (entityName.parent.kind === 252) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 156) { + if (entityName.parent.kind === 157) { return resolveEntityName(entityName, 1); } return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 262) { + if (node.kind === 263) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -35052,8 +35329,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 174 && - node.parent.parent.kind === 172 && + else if (node.parent.kind === 175 && + node.parent.parent.kind === 173 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -35064,8 +35341,8 @@ var ts; } switch (node.kind) { case 70: - case 177: - case 141: + case 178: + case 142: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 98: var container = ts.getThisContainer(node, false); @@ -35078,18 +35355,18 @@ var ts; case 96: var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 167: + case 168: return getTypeFromTypeNode(node).symbol; case 122: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 150) { + if (constructorDeclaration && constructorDeclaration.kind === 151) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 236 || node.parent.kind === 242) && + ((node.parent.kind === 237 || node.parent.kind === 243) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -35097,7 +35374,7 @@ var ts; return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 178 && node.parent.argumentExpression === node) { + if (node.parent.kind === 179 && node.parent.argumentExpression === node) { var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -35111,7 +35388,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 259) { + if (location && location.kind === 260) { return resolveEntityName(location.name, 107455 | 8388608); } return undefined; @@ -35161,20 +35438,20 @@ var ts; return unknownType; } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 176 || expr.kind === 175); - if (expr.parent.kind === 214) { + ts.Debug.assert(expr.kind === 177 || expr.kind === 176); + if (expr.parent.kind === 215) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 192) { + if (expr.parent.kind === 193) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 258) { + if (expr.parent.kind === 259) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } - ts.Debug.assert(expr.parent.kind === 175); + ts.Debug.assert(expr.parent.kind === 176); var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); @@ -35200,8 +35477,8 @@ var ts; var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { - if (!propsByName[p.name]) { - propsByName[p.name] = p; + if (!propsByName.has(p.name)) { + propsByName.set(p.name, p); } }); } @@ -35210,9 +35487,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols_3 = []; - var name_26 = symbol.name; + var name_2 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_26); + var symbol = getPropertyOfType(t, name_2); if (symbol) { symbols_3.push(symbol); } @@ -35224,6 +35501,9 @@ var ts; var links = symbol; return [links.leftSpread, links.rightSpread]; } + if (symbol.mappedTypeOrigin) { + return getRootSymbols(symbol.mappedTypeOrigin); + } var target = void 0; var next = symbol; while (next = getSymbolLinks(next).target) { @@ -35239,7 +35519,8 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - return getReferencedValueSymbol(node) === argumentsSymbol; + var isPropertyName_1 = node.parent.kind === 178 && node.parent.name === node; + return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } return false; @@ -35255,7 +35536,7 @@ var ts; if (symbolLinks.exportsSomeValue === undefined) { symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 107455) - : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue); + : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; function isValue(s) { @@ -35281,7 +35562,7 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 262) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 263) { var symbolFile = parentSymbol.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -35319,7 +35600,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 205 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 206 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -35359,16 +35640,16 @@ var ts; return true; } switch (node.kind) { - case 235: - case 237: + case 236: case 238: - case 240: - case 244: + case 239: + case 241: + case 245: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 242: + case 243: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 241: + case 242: return node.expression && node.expression.kind === 70 ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -35378,7 +35659,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 262 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 263 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -35429,7 +35710,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 261) { + if (node.kind === 262) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -35445,15 +35726,17 @@ var ts; } function getTypeReferenceSerializationKind(typeName, location) { var valueSymbol = resolveEntityName(typeName, 107455, true, false, location); - var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); - if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { - return ts.TypeReferenceSerializationKind.Promise; - } - var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; - if (constructorType && isConstructorType(constructorType)) { - return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; - } var typeSymbol = resolveEntityName(typeName, 793064, true, false, location); + if (valueSymbol && valueSymbol === typeSymbol) { + var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return ts.TypeReferenceSerializationKind.Promise; + } + var constructorType = getTypeOfSymbol(valueSymbol); + if (constructorType && isConstructorType(constructorType)) { + return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + } if (!typeSymbol) { return ts.TypeReferenceSerializationKind.ObjectType; } @@ -35514,7 +35797,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); } function hasGlobalName(name) { - return !!globals[name]; + return globals.has(name); } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; @@ -35523,9 +35806,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_12 = reference.parent; - if (ts.isDeclaration(parent_12) && reference === parent_12.name) { - location = getDeclarationContainer(parent_12); + var parent = reference.parent; + if (ts.isDeclaration(parent) && reference === parent.name) { + location = getDeclarationContainer(parent); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -35558,14 +35841,13 @@ var ts; var fileToDirective; if (resolvedTypeReferenceDirectives) { fileToDirective = ts.createFileMap(); - for (var key in resolvedTypeReferenceDirectives) { - var resolvedDirective = resolvedTypeReferenceDirectives[key]; + resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (!resolvedDirective) { - continue; + return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key); - } + }); } return { getReferencedExportContainer: getReferencedExportContainer, @@ -35603,7 +35885,7 @@ var ts; if (!fileToDirective) { return undefined; } - var meaning = (node.kind === 177) || (node.kind === 70 && isInTypeQuery(node)) + var meaning = (node.kind === 178) || (node.kind === 70 && isInTypeQuery(node)) ? 107455 | 1048576 : 793064 | 1920; var symbol = resolveEntityName(node, meaning, true); @@ -35638,15 +35920,15 @@ var ts; } var current = symbol; while (true) { - var parent_13 = getParentOfSymbol(current); - if (parent_13) { - current = parent_13; + var parent = getParentOfSymbol(current); + if (parent) { + current = parent; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 262 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 263 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -35665,7 +35947,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 262); + return ts.getDeclarationOfKind(moduleSymbol, 263); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -35686,11 +35968,11 @@ var ts; } if (file.symbol && file.symbol.globalExports) { var source = file.symbol.globalExports; - for (var id in source) { - if (!(id in globals)) { - globals[id] = source[id]; + source.forEach(function (sourceSymbol, id) { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); } - } + }); } } if (augmentations) { @@ -35756,10 +36038,10 @@ var ts; var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; for (var helper = 1; helper <= 128; helper <<= 1) { if (uncheckedHelpers & helper) { - var name_27 = getHelperName(helper); - var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_27), 107455); + var name = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name), 107455); if (!symbol) { - error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_27); + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); } } } @@ -35808,14 +36090,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 149 && !ts.nodeIsPresent(node.body)) { + if (node.kind === 150 && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 151 || node.kind === 152) { + else if (node.kind === 152 || node.kind === 153) { 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); @@ -35833,16 +36115,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 130) { - if (node.kind === 146 || node.kind === 148) { + if (node.kind === 147 || node.kind === 149) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 155) { + if (node.kind === 156) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 75: - if (node.kind !== 230 && node.parent.kind === 227) { + if (node.kind !== 231 && node.parent.kind === 228) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75)); } break; @@ -35868,7 +36150,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 232 || node.parent.kind === 262) { + else if (node.parent.kind === 233 || node.parent.kind === 263) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -35891,10 +36173,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 232 || node.parent.kind === 262) { + else if (node.parent.kind === 233 || node.parent.kind === 263) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128) { @@ -35907,7 +36189,7 @@ var ts; if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 147 && node.kind !== 146 && node.kind !== 155 && node.kind !== 144) { + else if (node.kind !== 148 && node.kind !== 147 && node.kind !== 156 && node.kind !== 145) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64; @@ -35926,10 +36208,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -35941,13 +36223,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 232) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 233) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -35957,14 +36239,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 227) { - if (node.kind !== 149 && - node.kind !== 147 && - node.kind !== 151 && - node.kind !== 152) { + if (node.kind !== 228) { + if (node.kind !== 150 && + node.kind !== 148 && + node.kind !== 152 && + node.kind !== 153) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 227 && ts.getModifierFlags(node.parent) & 128)) { + if (!(node.parent.kind === 228 && ts.getModifierFlags(node.parent) & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -35983,7 +36265,7 @@ var ts; 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 === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256; @@ -35991,7 +36273,7 @@ var ts; break; } } - if (node.kind === 150) { + if (node.kind === 151) { if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -36006,13 +36288,13 @@ var ts; } return; } - else if ((node.kind === 236 || node.kind === 235) && flags & 2) { + else if ((node.kind === 237 || node.kind === 236) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 144 && (flags & 92) && ts.isBindingPattern(node.name)) { + else if (node.kind === 145 && (flags & 92) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 144 && (flags & 92) && node.dotDotDotToken) { + else if (node.kind === 145 && (flags & 92) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256) { @@ -36028,37 +36310,37 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 151: case 152: - case 150: + case 153: + case 151: + case 148: case 147: - case 146: + case 150: case 149: - case 148: - case 155: - case 231: + case 156: + case 232: + case 237: case 236: - case 235: + case 243: case 242: - case 241: - case 184: case 185: - case 144: + case 186: + case 145: return false; default: - if (node.parent.kind === 232 || node.parent.kind === 262) { + if (node.parent.kind === 233 || node.parent.kind === 263) { return false; } switch (node.kind) { - case 226: - return nodeHasAnyModifiersExcept(node, 119); case 227: - return nodeHasAnyModifiersExcept(node, 116); + return nodeHasAnyModifiersExcept(node, 119); case 228: - case 206: + return nodeHasAnyModifiersExcept(node, 116); case 229: - return true; + case 207: case 230: + return true; + case 231: return nodeHasAnyModifiersExcept(node, 75); default: ts.Debug.fail(); @@ -36071,10 +36353,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 149: - case 226: - case 184: + case 150: + case 227: case 185: + case 186: if (!node.asteriskToken) { return false; } @@ -36136,7 +36418,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 185) { + if (node.kind === 186) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -36171,7 +36453,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 !== 134 && parameter.type.kind !== 132) { + if (parameter.type.kind !== 135 && parameter.type.kind !== 132) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -36198,7 +36480,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { var arg = args_4[_i]; - if (arg.kind === 198) { + if (arg.kind === 199) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -36268,19 +36550,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 142) { + if (node.kind !== 143) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 192 && computedPropertyName.expression.operatorToken.kind === 25) { + if (computedPropertyName.expression.kind === 193 && computedPropertyName.expression.operatorToken.kind === 25) { 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 === 226 || - node.kind === 184 || - node.kind === 149); + ts.Debug.assert(node.kind === 227 || + node.kind === 185 || + node.kind === 150); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -36305,66 +36587,66 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 260) { + if (prop.kind === 261) { continue; } - var name_28 = prop.name; - if (name_28.kind === 142) { - checkGrammarComputedPropertyName(name_28); + var name = prop.name; + if (name.kind === 143) { + checkGrammarComputedPropertyName(name); } - if (prop.kind === 259 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 260 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (mod.kind !== 119 || prop.kind !== 149) { + if (mod.kind !== 119 || prop.kind !== 150) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } } var currentKind = void 0; - if (prop.kind === 258 || prop.kind === 259) { + if (prop.kind === 259 || prop.kind === 260) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_28.kind === 8) { - checkGrammarNumericLiteral(name_28); + if (name.kind === 8) { + checkGrammarNumericLiteral(name); } currentKind = Property; } - else if (prop.kind === 149) { + else if (prop.kind === 150) { currentKind = Property; } - else if (prop.kind === 151) { + else if (prop.kind === 152) { currentKind = GetAccessor; } - else if (prop.kind === 152) { + else if (prop.kind === 153) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_28); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name); if (effectiveName === undefined) { continue; } - if (!seen[effectiveName]) { - seen[effectiveName] = currentKind; + var existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); } else { - var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_28, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_28)); + grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[effectiveName] = currentKind | existingKind; + seen.set(effectiveName, currentKind | existingKind); } else { - return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -36373,19 +36655,19 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 252) { + if (attr.kind === 253) { continue; } var jsxAttr = attr; - var name_29 = jsxAttr.name; - if (!seen[name_29.text]) { - seen[name_29.text] = true; + var name = jsxAttr.name; + if (!seen.get(name.text)) { + seen.set(name.text, true); } else { - return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 253 && !initializer.expression) { + if (initializer && initializer.kind === 254 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -36394,7 +36676,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 225) { + if (forInOrOfStatement.initializer.kind === 226) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -36402,20 +36684,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 213 + var diagnostic = forInOrOfStatement.kind === 214 ? 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 = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 213 + var diagnostic = forInOrOfStatement.kind === 214 ? 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 === 213 + var diagnostic = forInOrOfStatement.kind === 214 ? 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); @@ -36442,11 +36724,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 151 ? + return grammarErrorOnNode(accessor.name, kind === 152 ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 152) { + else if (kind === 153) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -36465,10 +36747,10 @@ var ts; } } function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 152 ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 151 ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 152 ? 1 : 2)) { return ts.getThisParameter(accessor); } } @@ -36483,7 +36765,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 176) { + if (node.parent.kind === 177) { if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } @@ -36499,10 +36781,10 @@ 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 === 228) { + else if (node.parent.kind === 229) { 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 === 161) { + else if (node.parent.kind === 162) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -36513,9 +36795,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 220: + case 221: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 215 + var isMisplacedContinueLabel = node.kind === 216 && !ts.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); @@ -36523,8 +36805,8 @@ var ts; return false; } break; - case 219: - if (node.kind === 216 && !node.label) { + case 220: + if (node.kind === 217 && !node.label) { return false; } break; @@ -36537,13 +36819,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 216 + var message = node.kind === 217 ? 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 === 216 + var message = node.kind === 217 ? 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); @@ -36555,7 +36837,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 173 || node.name.kind === 172) { + if (node.name.kind === 174 || node.name.kind === 173) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -36565,11 +36847,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 || expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 213 && node.parent.parent.kind !== 214) { + if (node.parent.parent.kind !== 214 && node.parent.parent.kind !== 215) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -36626,15 +36908,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 209: case 210: case 211: - case 218: case 212: + case 219: case 213: case 214: + case 215: return false; - case 220: + case 221: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -36696,7 +36978,7 @@ var ts; return true; } } - else if (node.parent.kind === 228) { + else if (node.parent.kind === 229) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -36704,7 +36986,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 161) { + else if (node.parent.kind === 162) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -36717,13 +36999,13 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 228 || - node.kind === 229 || + if (node.kind === 229 || + node.kind === 230 || + node.kind === 237 || node.kind === 236 || - node.kind === 235 || + node.kind === 243 || node.kind === 242 || - node.kind === 241 || - node.kind === 234 || + node.kind === 235 || ts.getModifierFlags(node) & (2 | 1 | 512)) { return false; } @@ -36732,7 +37014,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 === 206) { + if (ts.isDeclaration(decl) || decl.kind === 207) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -36751,7 +37033,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 === 205 || node.parent.kind === 232 || node.parent.kind === 262) { + if (node.parent.kind === 206 || node.parent.kind === 233 || node.parent.kind === 263) { 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); @@ -36767,10 +37049,10 @@ var ts; if (languageVersion >= 1) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 171)) { + else if (ts.isChildOfNodeWithKind(node, 172)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 261)) { + else if (ts.isChildOfNodeWithKind(node, 262)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -36790,11 +37072,11 @@ var ts; } function getAmbientModules() { var result = []; - for (var sym in globals) { + globals.forEach(function (global, sym) { if (ambientModuleSymbolRegex.test(sym)) { - result.push(globals[sym]); + result.push(global); } - } + }); return result; } } @@ -36803,54 +37085,56 @@ var ts; var ts; (function (ts) { ; - var nodeEdgeTraversalMap = ts.createMap((_a = {}, - _a[141] = [ - { name: "left", test: ts.isEntityName }, - { name: "right", test: ts.isIdentifier } - ], - _a[145] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[182] = [ - { name: "type", test: ts.isTypeNode }, - { name: "expression", test: ts.isUnaryExpression } - ], - _a[200] = [ - { name: "expression", test: ts.isExpression }, - { name: "type", test: ts.isTypeNode } - ], - _a[201] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[230] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "members", test: ts.isEnumMember } - ], - _a[231] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isModuleName }, - { name: "body", test: ts.isModuleBody } - ], - _a[232] = [ - { name: "statements", test: ts.isStatement } - ], - _a[235] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "moduleReference", test: ts.isModuleReference } - ], - _a[246] = [ - { name: "expression", test: ts.isExpression, optional: true } - ], - _a[261] = [ - { name: "name", test: ts.isPropertyName }, - { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } - ], - _a)); + function getNodeEdgeTraversal(kind) { + switch (kind) { + case 142: return [ + { name: "left", test: ts.isEntityName }, + { name: "right", test: ts.isIdentifier } + ]; + case 146: return [ + { name: "expression", test: ts.isLeftHandSideExpression } + ]; + case 183: return [ + { name: "type", test: ts.isTypeNode }, + { name: "expression", test: ts.isUnaryExpression } + ]; + case 201: return [ + { name: "expression", test: ts.isExpression }, + { name: "type", test: ts.isTypeNode } + ]; + case 202: return [ + { name: "expression", test: ts.isLeftHandSideExpression } + ]; + case 231: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "members", test: ts.isEnumMember } + ]; + case 232: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isModuleName }, + { name: "body", test: ts.isModuleBody } + ]; + case 233: return [ + { name: "statements", test: ts.isStatement } + ]; + case 236: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "moduleReference", test: ts.isModuleReference } + ]; + case 247: return [ + { name: "expression", test: ts.isExpression, optional: true } + ]; + case 262: return [ + { name: "name", test: ts.isPropertyName }, + { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } + ]; + } + } function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } @@ -36864,41 +37148,41 @@ var ts; var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; var cbNodes = cbNodeArray || cbNode; var kind = node.kind; - if ((kind > 0 && kind <= 140)) { + if ((kind > 0 && kind <= 141)) { return initial; } - if ((kind >= 156 && kind <= 171)) { + if ((kind >= 157 && kind <= 172)) { return initial; } var result = initial; switch (node.kind) { - case 204: - case 207: - case 198: - case 223: - case 294: + case 205: + case 208: + case 199: + case 224: + case 295: break; - case 142: + case 143: result = reduceNode(node.expression, cbNode, result); break; - case 144: + case 145: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 145: + case 146: result = reduceNode(node.expression, cbNode, result); break; - case 147: + case 148: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 149: + case 150: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -36907,12 +37191,12 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 150: + case 151: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 151: + case 152: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -36920,51 +37204,51 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 152: + case 153: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 172: case 173: + case 174: result = reduceNodes(node.elements, cbNodes, result); break; - case 174: + case 175: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 175: + case 176: result = reduceNodes(node.elements, cbNodes, result); break; - case 176: + case 177: result = reduceNodes(node.properties, cbNodes, result); break; - case 177: + case 178: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 178: + case 179: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.argumentExpression, cbNode, result); break; - case 179: + case 180: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 180: + case 181: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 181: + case 182: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 184: + case 185: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -36972,117 +37256,117 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 185: + case 186: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 183: - case 186: + case 184: case 187: case 188: case 189: - case 195: + case 190: case 196: - case 201: + case 197: + case 202: result = reduceNode(node.expression, cbNode, result); break; - case 190: case 191: + case 192: result = reduceNode(node.operand, cbNode, result); break; - case 192: + case 193: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 193: + case 194: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 194: + case 195: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 197: + case 198: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 199: + case 200: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 203: + case 204: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; - case 205: + case 206: result = reduceNodes(node.statements, cbNodes, result); break; - case 206: + case 207: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 208: + case 209: result = reduceNode(node.expression, cbNode, result); break; - case 209: + case 210: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 210: + case 211: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 211: - case 218: + case 212: + case 219: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212: + case 213: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 213: case 214: + case 215: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 217: - case 221: + case 218: + case 222: result = reduceNode(node.expression, cbNode, result); break; - case 219: + case 220: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 220: + case 221: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 222: + case 223: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 224: + case 225: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 225: + case 226: result = reduceNodes(node.declarations, cbNodes, result); break; - case 226: + case 227: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -37091,7 +37375,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 227: + case 228: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -37099,96 +37383,96 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 233: + case 234: result = reduceNodes(node.clauses, cbNodes, result); break; - case 236: + case 237: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 237: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.namedBindings, cbNode, result); - break; case 238: result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); break; case 239: - case 243: - result = reduceNodes(node.elements, cbNodes, result); + result = reduceNode(node.name, cbNode, result); break; case 240: case 244: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 241: + case 245: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 241: + case 242: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 242: + case 243: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 247: + case 248: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 248: case 249: + case 250: result = reduceNode(node.tagName, cbNode, result); result = reduceNodes(node.attributes, cbNodes, result); break; - case 250: + case 251: result = reduceNode(node.tagName, cbNode, result); break; - case 251: + case 252: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 252: - result = reduceNode(node.expression, cbNode, result); - break; case 253: result = reduceNode(node.expression, cbNode, result); break; case 254: result = reduceNode(node.expression, cbNode, result); + break; case 255: + result = reduceNode(node.expression, cbNode, result); + case 256: result = reduceNodes(node.statements, cbNodes, result); break; - case 256: + case 257: result = reduceNodes(node.types, cbNodes, result); break; - case 257: + case 258: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; - case 258: + case 259: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 259: + case 260: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 260: + case 261: result = reduceNode(node.expression, cbNode, result); break; - case 262: + case 263: result = reduceNodes(node.statements, cbNodes, result); break; - case 295: + case 296: result = reduceNode(node.expression, cbNode, result); break; default: - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + var edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) { var edge = edgeTraversalPath_1[_i]; @@ -37318,183 +37602,183 @@ var ts; return undefined; } var kind = node.kind; - if ((kind > 0 && kind <= 140)) { + if ((kind > 0 && kind <= 141)) { return node; } - if ((kind >= 156 && kind <= 171)) { + if ((kind >= 157 && kind <= 172)) { return node; } switch (node.kind) { - case 204: - case 207: - case 198: - case 223: + case 205: + case 208: + case 199: + case 224: return node; - case 142: + case 143: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); - case 144: + case 145: return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 147: + case 148: return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 149: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 150: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); + return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 151: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); case 152: + return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + case 153: return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 172: - return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); case 173: - return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); + return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); case 174: - return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); + return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); case 175: - return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); + return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); case 176: - return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); + return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); case 177: - return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); case 178: - return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); + return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); case 179: - return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); case 180: - return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); case 181: + return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + case 182: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 183: - return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 184: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 185: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 186: - return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 187: - return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 188: - return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); case 189: + return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + case 190: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 192: + case 193: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); - case 190: - return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); case 191: + return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); + case 192: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 193: - return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); case 194: - return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); + return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); case 195: - return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); case 196: - return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); case 197: + return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + case 198: return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 199: + case 200: return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 203: + case 204: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 205: - return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); case 206: + return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); + case 207: return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 208: - return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 209: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 210: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); case 211: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); case 212: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 213: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 214: - return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 215: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 216: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 217: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 218: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); case 219: - return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 220: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); case 221: - return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 222: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + case 223: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true)); - case 224: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 225: - return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 226: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); case 227: + return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + case 228: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 233: + case 234: return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 236: - return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 237: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); + return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 238: - return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); case 239: - return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); case 240: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); case 241: - return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); case 242: - return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); + return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); case 243: - return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); case 244: + return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + case 245: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); - case 247: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 248: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 249: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 250: - return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 251: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); case 252: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 253: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 254: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 255: - return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); case 256: - return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); + return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); case 257: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); case 258: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); case 259: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 260: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 261: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); - case 262: + case 263: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 295: + case 296: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + var edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) { var edge = edgeTraversalPath_2[_i]; @@ -37578,7 +37862,7 @@ var ts; return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { - if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 199)) { + if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 200)) { return 0; } return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); @@ -37626,7 +37910,6 @@ var ts; } } })(Debug = ts.Debug || (ts.Debug = {})); - var _a; })(ts || (ts = {})); var ts; (function (ts) { @@ -37721,10 +38004,10 @@ var ts; } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { - var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_30 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; - var variable = ts.createVariableDeclaration(name_30, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location); variable.original = original; - if (ts.isIdentifier(name_30)) { + if (ts.isIdentifier(name)) { ts.setEmitFlags(variable, 64); } ts.aggregateTransformFlags(variable); @@ -37870,8 +38153,8 @@ var ts; return ts.createElementAccess(value, argumentExpression); } else { - var name_31 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); - return ts.createPropertyAccess(value, name_31); + var name = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name); } } function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { @@ -37948,8 +38231,8 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); context.enableSubstitution(178); + context.enableSubstitution(179); var currentSourceFile; var currentNamespace; var currentNamespaceContainerName; @@ -37982,15 +38265,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 262: + case 263: + case 234: case 233: - case 232: - case 205: + case 206: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; + case 228: case 227: - case 226: if (ts.hasModifier(node, 2)) { break; } @@ -38015,13 +38298,13 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 236: + case 237: return visitImportDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); - case 241: - return visitExportAssignment(node); case 242: + return visitExportAssignment(node); + case 243: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -38031,11 +38314,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 242 || - node.kind === 236 || + if (node.kind === 243 || node.kind === 237 || - (node.kind === 235 && - node.moduleReference.kind === 246)) { + node.kind === 238 || + (node.kind === 236 && + node.moduleReference.kind === 247)) { return undefined; } else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) { @@ -38051,15 +38334,15 @@ var ts; } function classElementVisitorWorker(node) { switch (node.kind) { - case 150: - return undefined; - case 147: - case 155: case 151: + return undefined; + case 148: + case 156: case 152: - case 149: + case 153: + case 150: return visitorWorker(node); - case 204: + case 205: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -38090,23 +38373,22 @@ var ts; case 75: case 123: case 130: - case 162: case 163: - case 161: - case 156: - case 143: + case 164: + case 162: + case 157: + case 144: case 118: case 121: - case 134: + case 135: case 132: case 129: case 104: - case 135: + case 136: + case 160: case 159: + case 161: case 158: - case 160: - case 157: - case 164: case 165: case 166: case 167: @@ -38114,57 +38396,58 @@ var ts; case 169: case 170: case 171: - case 155: - case 145: - case 229: - case 147: + case 172: + case 156: + case 146: + case 230: + case 148: return undefined; - case 150: + case 151: return visitConstructor(node); - case 228: + case 229: return ts.createNotEmittedStatement(node); - case 227: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 256: + case 257: return visitHeritageClause(node); - case 199: + case 200: return visitExpressionWithTypeArguments(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: - return visitGetAccessor(node); case 152: + return visitGetAccessor(node); + case 153: return visitSetAccessor(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: + case 145: return visitParameter(node); - case 183: + case 184: return visitParenthesizedExpression(node); - case 182: - case 200: + case 183: + case 201: return visitAssertionExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 201: + case 202: return visitNonNullExpression(node); - case 230: + case 231: return visitEnumDeclaration(node); - case 206: + case 207: return visitVariableStatement(node); - case 224: + case 225: return visitVariableDeclaration(node); - case 231: + case 232: return visitModuleDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); default: ts.Debug.failBadSyntaxKind(node); @@ -38318,7 +38601,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -38352,7 +38635,7 @@ var ts; return isInitializedProperty(member, false); } function isInitializedProperty(member, isStatic) { - return member.kind === 147 + return member.kind === 148 && isStatic === ts.hasModifier(member, 32) && member.initializer !== undefined; } @@ -38425,12 +38708,12 @@ var ts; } function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { - case 151: case 152: + case 153: return getAllDecoratorsOfAccessors(node, member); - case 149: + case 150: return getAllDecoratorsOfMethod(member); - case 147: + case 148: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -38509,7 +38792,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, true); var descriptor = languageVersion > 0 - ? member.kind === 147 + ? member.kind === 148 ? ts.createVoidZero() : ts.createNull() : undefined; @@ -38593,37 +38876,37 @@ var ts; } function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 149 - || kind === 151 + return kind === 150 || kind === 152 - || kind === 147; + || kind === 153 + || kind === 148; } function shouldAddReturnTypeMetadata(node) { - return node.kind === 149; + return node.kind === 150; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 227: - case 197: + case 228: + case 198: return ts.getFirstConstructorWithBody(node) !== undefined; - case 149: - case 151: + case 150: case 152: + case 153: return true; } return false; } function serializeTypeOfNode(node) { switch (node.kind) { - case 147: - case 144: - case 151: - return serializeTypeNode(node.type); + case 148: + case 145: case 152: + return serializeTypeNode(node.type); + case 153: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 227: - case 197: - case 149: + case 228: + case 198: + case 150: return ts.createIdentifier("Function"); default: return ts.createVoidZero(); @@ -38655,7 +38938,7 @@ var ts; return ts.createArrayLiteral(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 151) { + if (container && node.kind === 152) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -38678,24 +38961,24 @@ var ts; } switch (node.kind) { case 104: - case 137: + case 138: case 94: case 129: return ts.createVoidZero(); - case 166: + case 167: return serializeTypeNode(node.type); - case 158: case 159: + case 160: return ts.createIdentifier("Function"); - case 162: case 163: + case 164: return ts.createIdentifier("Array"); - case 156: + case 157: case 121: return ts.createIdentifier("Boolean"); - case 134: + case 135: return ts.createIdentifier("String"); - case 171: + case 172: switch (node.literal.kind) { case 9: return ts.createIdentifier("String"); @@ -38711,22 +38994,22 @@ var ts; break; case 132: return ts.createIdentifier("Number"); - case 135: + case 136: return languageVersion < 2 ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); - case 157: + case 158: return serializeTypeReferenceNode(node); + case 166: case 165: - case 164: return serializeUnionOrIntersectionType(node); - case 160: - case 168: + case 161: case 169: case 170: - case 161: + case 171: + case 162: case 118: - case 167: + case 168: break; default: ts.Debug.failBadSyntaxKind(node); @@ -38794,15 +39077,15 @@ var ts; function serializeEntityNameAsExpression(node, useFallback) { switch (node.kind) { case 70: - var name_32 = ts.getMutableClone(node); - name_32.flags &= ~8; - name_32.original = undefined; - name_32.parent = currentScope; + var name = ts.getMutableClone(node); + name.flags &= ~8; + name.original = undefined; + name.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_32), ts.createLiteral("undefined")), name_32); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name); } - return name_32; - case 141: + return name; + case 142: return serializeQualifiedNameAsExpression(node, useFallback); } } @@ -39065,16 +39348,16 @@ var ts; if (!currentScopeFirstDeclarationsOfName) { currentScopeFirstDeclarationsOfName = ts.createMap(); } - if (!(name in currentScopeFirstDeclarationsOfName)) { - currentScopeFirstDeclarationsOfName[name] = node; + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_33 = node.symbol && node.symbol.name; - if (name_33) { - return currentScopeFirstDeclarationsOfName[name_33] === node; + var name = node.symbol && node.symbol.name; + if (name) { + return currentScopeFirstDeclarationsOfName.get(name) === node; } } return false; @@ -39086,7 +39369,7 @@ var ts; ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 230) { + if (node.kind === 231) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -39146,7 +39429,7 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 232) { + if (body.kind === 233) { saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; @@ -39169,13 +39452,13 @@ var ts; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); - if (body.kind !== 232) { + if (body.kind !== 233) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 231) { + if (moduleDeclaration.body.kind === 232) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -39195,7 +39478,7 @@ var ts; return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 238) { + if (node.kind === 239) { return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } else { @@ -39323,22 +39606,22 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(70); - classAliases = ts.createMap(); + classAliases = []; } } function enableSubstitutionForNamespaceExports() { if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(70); - context.enableSubstitution(259); - context.enableEmitNotification(231); + context.enableSubstitution(260); + context.enableEmitNotification(232); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 231; + return ts.getOriginalNode(node).kind === 232; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 230; + return ts.getOriginalNode(node).kind === 231; } function onEmitNode(emitContext, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; @@ -39363,14 +39646,14 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2) { - var name_34 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_34); + var name = node.name; + var exportedName = trySubstituteNamespaceExportedName(name); if (exportedName) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_34, initializer, node); + return ts.createPropertyAssignment(name, initializer, node); } - return ts.createPropertyAssignment(name_34, exportedName, node); + return ts.createPropertyAssignment(name, exportedName, node); } } return node; @@ -39379,9 +39662,9 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 177: - return substitutePropertyAccessExpression(node); case 178: + return substitutePropertyAccessExpression(node); + case 179: return substituteElementAccessExpression(node); } return node; @@ -39411,9 +39694,9 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 262) { - var substitute = (applicableSubstitutions & 2 && container.kind === 231) || - (applicableSubstitutions & 8 && container.kind === 230); + if (container && container.kind !== 263) { + var substitute = (applicableSubstitutions & 2 && container.kind === 232) || + (applicableSubstitutions & 8 && container.kind === 231); if (substitute) { return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node); } @@ -39524,37 +39807,37 @@ var ts; return node; } switch (node.kind) { - case 176: + case 177: return visitObjectLiteralExpression(node); - case 192: + case 193: return visitBinaryExpression(node, noDestructuringValue); - case 224: + case 225: return visitVariableDeclaration(node); - case 214: + case 215: return visitForOfStatement(node); - case 212: + case 213: return visitForStatement(node); - case 188: + case 189: return visitVoidExpression(node); - case 150: + case 151: return visitConstructorDeclaration(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: - return visitGetAccessorDeclaration(node); case 152: + return visitGetAccessorDeclaration(node); + case 153: return visitSetAccessorDeclaration(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: + case 145: return visitParameter(node); - case 208: + case 209: return visitExpressionStatement(node); - case 183: + case 184: return visitParenthesizedExpression(node, noDestructuringValue); default: return ts.visitEachChild(node, visitor, context); @@ -39565,7 +39848,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 260) { + if (e.kind === 261) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -39577,7 +39860,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 258) { + if (e.kind === 259) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -39594,7 +39877,7 @@ var ts; function visitObjectLiteralExpression(node) { if (node.transformFlags & 1048576) { var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176) { + if (objects.length && objects[0].kind !== 177) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -39719,6 +40002,9 @@ var ts; text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" }; function createAssignHelper(context, attributesSegments) { + if (context.getCompilerOptions().target >= 2) { + return ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), undefined, attributesSegments); + } context.requestEmitHelper(assignHelper); return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments); } @@ -39750,11 +40036,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 247: - return visitJsxElement(node, false); case 248: + return visitJsxElement(node, false); + case 249: return visitJsxSelfClosingElement(node, false); - case 253: + case 254: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -39764,11 +40050,11 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 253: + case 254: return visitJsxExpression(node); - case 247: - return visitJsxElement(node, true); case 248: + return visitJsxElement(node, true); + case 249: return visitJsxSelfClosingElement(node, true); default: ts.Debug.failBadSyntaxKind(node); @@ -39822,7 +40108,7 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.createLiteral(decoded, node) : node; } - else if (node.kind === 253) { + else if (node.kind === 254) { if (node.expression === undefined) { return ts.createLiteral(true); } @@ -39833,43 +40119,35 @@ var ts; } } function visitJsxText(node) { - var text = ts.getTextOfNode(node, true); - var parts; + var fixed = fixupWhitespaceAndDecodeEntities(ts.getTextOfNode(node, true)); + return fixed === undefined ? undefined : ts.createLiteral(fixed); + } + function fixupWhitespaceAndDecodeEntities(text) { + var acc; var firstNonWhitespace = 0; var lastNonWhitespace = -1; for (var i = 0; i < text.length; i++) { var c = text.charCodeAt(i); if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); } firstNonWhitespace = -1; } - else if (!ts.isWhiteSpace(c)) { + else if (!ts.isWhiteSpaceSingleLine(c)) { lastNonWhitespace = i; if (firstNonWhitespace === -1) { firstNonWhitespace = i; } } } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); - } - if (parts) { - return ts.reduceLeft(parts, aggregateJsxTextParts); - } - return undefined; + return firstNonWhitespace !== -1 + ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) + : acc; } - function aggregateJsxTextParts(left, right) { - return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right); + function addLineOfJsxText(acc, trimmedLine) { + var decoded = decodeEntities(trimmedLine); + return acc === undefined ? decoded : acc + " " + decoded; } function decodeEntities(text) { return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) { @@ -39880,7 +40158,7 @@ var ts; return String.fromCharCode(parseInt(hex, 16)); } else { - var ch = entities[word]; + var ch = entities.get(word); return ch ? String.fromCharCode(ch) : match; } }); @@ -39890,16 +40168,16 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 247) { + if (node.kind === 248) { return getTagName(node.openingElement); } else { - var name_35 = node.tagName; - if (ts.isIdentifier(name_35) && ts.isIntrinsicJsxName(name_35.text)) { - return ts.createLiteral(name_35.text); + var name = node.tagName; + if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.text)) { + return ts.createLiteral(name.text); } else { - return ts.createExpressionFromEntityName(name_35); + return ts.createExpressionFromEntityName(name); } } } @@ -39917,7 +40195,7 @@ var ts; } } ts.transformJsx = transformJsx; - var entities = ts.createMap({ + var entities = ts.createMapFromTemplate({ "quot": 0x0022, "amp": 0x0026, "apos": 0x0027, @@ -40205,15 +40483,15 @@ var ts; switch (node.kind) { case 119: return undefined; - case 189: + case 190: return visitAwaitExpression(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); default: return ts.visitEachChild(node, visitor, context); @@ -40250,7 +40528,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 185; + var isArrowFunction = node.kind === 186; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; if (!isArrowFunction) { var statements = []; @@ -40305,23 +40583,23 @@ var ts; function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; - context.enableSubstitution(179); - context.enableSubstitution(177); + context.enableSubstitution(180); context.enableSubstitution(178); - context.enableEmitNotification(227); - context.enableEmitNotification(149); - context.enableEmitNotification(151); - context.enableEmitNotification(152); + context.enableSubstitution(179); + context.enableEmitNotification(228); context.enableEmitNotification(150); + context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(151); } } function substituteExpression(node) { switch (node.kind) { - case 177: - return substitutePropertyAccessExpression(node); case 178: - return substituteElementAccessExpression(node); + return substitutePropertyAccessExpression(node); case 179: + return substituteElementAccessExpression(node); + case 180: if (enabledSubstitutions & 1) { return substituteCallExpression(node); } @@ -40364,11 +40642,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 227 - || kind === 150 - || kind === 149 + return kind === 228 || kind === 151 - || kind === 152; + || kind === 150 + || kind === 152 + || kind === 153; } function onEmitNode(emitContext, node, emitCallback) { if (enabledSubstitutions & 1 && isSuperContainer(node)) { @@ -40446,7 +40724,7 @@ var ts; return node; } switch (node.kind) { - case 192: + case 193: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -40530,7 +40808,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return hierarchyFacts & 4096 - && node.kind === 217 + && node.kind === 218 && !node.expression; } function shouldVisitNode(node) { @@ -40563,91 +40841,91 @@ var ts; switch (node.kind) { case 114: return undefined; - case 227: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 144: + case 145: return visitParameter(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 185: + case 186: return visitArrowFunction(node); - case 184: + case 185: return visitFunctionExpression(node); - case 224: + case 225: return visitVariableDeclaration(node); case 70: return visitIdentifier(node); - case 225: + case 226: return visitVariableDeclarationList(node); - case 219: + case 220: return visitSwitchStatement(node); - case 233: + case 234: return visitCaseBlock(node); - case 205: + case 206: return visitBlock(node, false); + case 217: case 216: - case 215: return visitBreakOrContinueStatement(node); - case 220: + case 221: return visitLabeledStatement(node); - case 210: case 211: - return visitDoOrWhileStatement(node, undefined); case 212: - return visitForStatement(node, undefined); + return visitDoOrWhileStatement(node, undefined); case 213: - return visitForInStatement(node, undefined); + return visitForStatement(node, undefined); case 214: + return visitForInStatement(node, undefined); + case 215: return visitForOfStatement(node, undefined); - case 208: + case 209: return visitExpressionStatement(node); - case 176: + case 177: return visitObjectLiteralExpression(node); - case 257: + case 258: return visitCatchClause(node); - case 259: + case 260: return visitShorthandPropertyAssignment(node); - case 142: + case 143: return visitComputedPropertyName(node); - case 175: + case 176: return visitArrayLiteralExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 183: + case 184: return visitParenthesizedExpression(node, true); - case 192: + case 193: return visitBinaryExpression(node, true); case 12: case 13: case 14: case 15: return visitTemplateLiteral(node); - case 181: + case 182: return visitTaggedTemplateExpression(node); - case 194: - return visitTemplateExpression(node); case 195: - return visitYieldExpression(node); + return visitTemplateExpression(node); case 196: + return visitYieldExpression(node); + case 197: return visitSpreadElement(node); case 96: return visitSuperKeyword(false); case 98: return visitThisKeyword(node); - case 202: + case 203: return visitMetaProperty(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: case 152: + case 153: return visitAccessorDeclaration(node); - case 206: + case 207: return visitVariableStatement(node); - case 217: + case 218: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context); @@ -40717,20 +40995,20 @@ var ts; if (ts.isGeneratedIdentifier(node)) { return node; } - if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) { + if (node.text !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { return node; } return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 216 ? 2 : 4; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + var jump = node.kind === 217 ? 2 : 4; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 216) { + if (node.kind === 217) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -40740,7 +41018,7 @@ var ts; } } else { - if (node.kind === 216) { + if (node.kind === 217) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -40898,17 +41176,17 @@ var ts; return block; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 217) { + if (statement.kind === 218) { return true; } - else if (statement.kind === 209) { + else if (statement.kind === 210) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 205) { + else if (statement.kind === 206) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -40937,7 +41215,7 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 208 && ts.isSuperCall(firstStatement.expression)) { + if (firstStatement.kind === 209 && ts.isSuperCall(firstStatement.expression)) { superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } @@ -40945,8 +41223,8 @@ var ts; && statementOffset === ctorStatements.length - 1 && !(ctor.transformFlags & (16384 | 32768))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 192 - || superCallExpression.left.kind !== 179) { + if (superCallExpression.kind !== 193 + || superCallExpression.left.kind !== 180) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))); @@ -40988,15 +41266,15 @@ var ts; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - var name_36 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; if (dotDotDotToken) { continue; } - if (ts.isBindingPattern(name_36)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_36, initializer); + if (ts.isBindingPattern(name)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer); } else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_36, initializer); + addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer); } } } @@ -41046,7 +41324,7 @@ var ts; statements.push(forStatement); } function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 && node.kind !== 185) { + if (node.transformFlags & 32768 && node.kind !== 186) { captureThisForNode(statements, node, ts.createThis()); } } @@ -41063,18 +41341,18 @@ var ts; if (hierarchyFacts & 16384) { var newTarget = void 0; switch (node.kind) { - case 185: + case 186: return statements; - case 149: - case 151: + case 150: case 152: + case 153: newTarget = ts.createVoidZero(); break; - case 150: + case 151: newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); break; - case 226: - case 184: + case 227: + case 185: newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 92, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); break; default: @@ -41095,20 +41373,20 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 204: + case 205: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 149: + case 150: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 150: + case 151: break; default: ts.Debug.failBadSyntaxKind(node); @@ -41231,7 +41509,7 @@ var ts; : enterSubtree(16286, 65); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 16384 && !name && (node.kind === 226 || node.kind === 184)) { + if (hierarchyFacts & 16384 && !name && (node.kind === 227 || node.kind === 185)) { name = ts.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 49152, 0); @@ -41264,7 +41542,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 185); + ts.Debug.assert(node.kind === 186); statementsLocation = ts.moveRangeEnd(body, -1); var equalsGreaterThanToken = node.equalsGreaterThanToken; if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { @@ -41314,9 +41592,9 @@ var ts; } function visitExpressionStatement(node) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateStatement(node, visitBinaryExpression(node.expression, false)); } return ts.visitEachChild(node, visitor, context); @@ -41324,9 +41602,9 @@ var ts; function visitParenthesizedExpression(node, needsDestructuringValue) { if (!needsDestructuringValue) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateParen(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateParen(node, visitBinaryExpression(node.expression, false)); } } @@ -41433,10 +41711,10 @@ var ts; return updated; } function recordLabel(node) { - convertedLoopState.labels[node.label.text] = node.label.text; + convertedLoopState.labels.set(node.label.text, node.label.text); } function resetLabel(node) { - convertedLoopState.labels[node.label.text] = undefined; + convertedLoopState.labels.set(node.label.text, undefined); } function visitLabeledStatement(node) { if (convertedLoopState && !convertedLoopState.labels) { @@ -41510,7 +41788,7 @@ var ts; ts.addRange(statements, convertedLoopBodyStatements); } else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); bodyLocation = statement; @@ -41532,14 +41810,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 210: case 211: - return visitDoOrWhileStatement(node, outermostLabeledStatement); case 212: - return visitForStatement(node, outermostLabeledStatement); + return visitDoOrWhileStatement(node, outermostLabeledStatement); case 213: - return visitForInStatement(node, outermostLabeledStatement); + return visitForStatement(node, outermostLabeledStatement); case 214: + return visitForInStatement(node, outermostLabeledStatement); + case 215: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -41554,7 +41832,7 @@ var ts; && i < numInitialPropertiesWithoutYield) { numInitialPropertiesWithoutYield = i; } - if (property.name.kind === 142) { + if (property.name.kind === 143) { numInitialProperties = i; break; } @@ -41616,11 +41894,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 212: case 213: case 214: + case 215: var initializer = node.initializer; - if (initializer && initializer.kind === 225) { + if (initializer && initializer.kind === 226) { loopInitializer = initializer; } break; @@ -41794,23 +42072,22 @@ var ts; if (!state.labeledNonLocalBreaks) { state.labeledNonLocalBreaks = ts.createMap(); } - state.labeledNonLocalBreaks[labelText] = labelMarker; + state.labeledNonLocalBreaks.set(labelText, labelMarker); } else { if (!state.labeledNonLocalContinues) { state.labeledNonLocalContinues = ts.createMap(); } - state.labeledNonLocalContinues[labelText] = labelMarker; + state.labeledNonLocalContinues.set(labelText, labelMarker); } } function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { if (!table) { return; } - for (var labelText in table) { - var labelMarker = table[labelText]; + table.forEach(function (labelMarker, labelText) { var statements = []; - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) { var label = ts.createIdentifier(labelText); statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)); } @@ -41819,7 +42096,7 @@ var ts; statements.push(ts.createReturn(loopResultName)); } caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)); - } + }); } function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { var name = decl.name; @@ -41845,20 +42122,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 149: + case 150: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 258: + case 259: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 259: + case 260: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -41990,7 +42267,7 @@ var ts; })); if (segments.length === 1) { var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 + return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 176 ? ts.createArraySlice(segments[0]) : segments[0]; } @@ -42118,13 +42395,13 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(98); - context.enableEmitNotification(150); - context.enableEmitNotification(149); context.enableEmitNotification(151); + context.enableEmitNotification(150); context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(186); context.enableEmitNotification(185); - context.enableEmitNotification(184); - context.enableEmitNotification(226); + context.enableEmitNotification(227); } } function onSubstituteNode(emitContext, node) { @@ -42149,10 +42426,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 174: - case 227: - case 230: - case 224: + case 175: + case 228: + case 231: + case 225: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -42195,11 +42472,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 208) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 209) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 180) { return false; } var callTarget = statementExpression.expression; @@ -42207,7 +42484,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 197) { return false; } var expression = callArgument.expression; @@ -42231,13 +42508,15 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var instructionNames = ts.createMap((_a = {}, - _a[2] = "return", - _a[3] = "break", - _a[4] = "yield", - _a[5] = "yield*", - _a[7] = "endfinally", - _a)); + function getInstructionName(instruction) { + switch (instruction) { + case 2: return "return"; + case 3: return "break"; + case 4: return "yield"; + case 5: return "yield*"; + case 7: return "endfinally"; + } + } function transformGenerators(context) { var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); @@ -42303,13 +42582,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 210: - return visitDoStatement(node); case 211: + return visitDoStatement(node); + case 212: return visitWhileStatement(node); - case 219: - return visitSwitchStatement(node); case 220: + return visitSwitchStatement(node); + case 221: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -42317,24 +42596,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); - case 151: case 152: + case 153: return visitAccessorDeclaration(node); - case 206: + case 207: return visitVariableStatement(node); - case 212: - return visitForStatement(node); case 213: + return visitForStatement(node); + case 214: return visitForInStatement(node); - case 216: + case 217: return visitBreakStatement(node); - case 215: + case 216: return visitContinueStatement(node); - case 217: + case 218: return visitReturnStatement(node); default: if (node.transformFlags & 16777216) { @@ -42350,21 +42629,21 @@ var ts; } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 192: - return visitBinaryExpression(node); case 193: + return visitBinaryExpression(node); + case 194: return visitConditionalExpression(node); - case 195: + case 196: return visitYieldExpression(node); - case 175: - return visitArrayLiteralExpression(node); case 176: + return visitArrayLiteralExpression(node); + case 177: return visitObjectLiteralExpression(node); - case 178: - return visitElementAccessExpression(node); case 179: - return visitCallExpression(node); + return visitElementAccessExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -42372,9 +42651,9 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); default: ts.Debug.failBadSyntaxKind(node); @@ -42531,10 +42810,10 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 177: + case 178: target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 178: + case 179: target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); break; default: @@ -42730,35 +43009,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 205: + case 206: return transformAndEmitBlock(node); - case 208: - return transformAndEmitExpressionStatement(node); case 209: - return transformAndEmitIfStatement(node); + return transformAndEmitExpressionStatement(node); case 210: - return transformAndEmitDoStatement(node); + return transformAndEmitIfStatement(node); case 211: - return transformAndEmitWhileStatement(node); + return transformAndEmitDoStatement(node); case 212: - return transformAndEmitForStatement(node); + return transformAndEmitWhileStatement(node); case 213: + return transformAndEmitForStatement(node); + case 214: return transformAndEmitForInStatement(node); - case 215: - return transformAndEmitContinueStatement(node); case 216: - return transformAndEmitBreakStatement(node); + return transformAndEmitContinueStatement(node); case 217: - return transformAndEmitReturnStatement(node); + return transformAndEmitBreakStatement(node); case 218: - return transformAndEmitWithStatement(node); + return transformAndEmitReturnStatement(node); case 219: - return transformAndEmitSwitchStatement(node); + return transformAndEmitWithStatement(node); case 220: - return transformAndEmitLabeledStatement(node); + return transformAndEmitSwitchStatement(node); case 221: - return transformAndEmitThrowStatement(node); + return transformAndEmitLabeledStatement(node); case 222: + return transformAndEmitThrowStatement(node); + case 223: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true)); @@ -42778,9 +43057,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - var name_37 = ts.getSynthesizedClone(variable.name); - ts.setCommentRange(name_37, variable.name); - hoistVariableDeclaration(name_37); + var name = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -43044,7 +43323,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 255 && defaultClauseIndex === -1) { + if (clause.kind === 256 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -43054,7 +43333,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 254) { + if (clause.kind === 255) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -43170,14 +43449,14 @@ var ts; return node; } function substituteExpressionIdentifier(node) { - if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) { + if (renamedCatchVariables && renamedCatchVariables.has(node.text)) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_38 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_38) { - var clone_7 = ts.getMutableClone(name_38); + var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)]; + if (name) { + var clone_7 = ts.getMutableClone(name); ts.setSourceMapRange(clone_7, node); ts.setCommentRange(clone_7, node); return clone_7; @@ -43285,10 +43564,10 @@ var ts; var name = declareLocal(text); if (!renamedCatchVariables) { renamedCatchVariables = ts.createMap(); - renamedCatchVariableDeclarations = ts.createMap(); + renamedCatchVariableDeclarations = []; context.enableSubstitution(70); } - renamedCatchVariables[text] = true; + renamedCatchVariables.set(text, true); renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; var exception = peekBlock(); ts.Debug.assert(exception.state < 1); @@ -43489,7 +43768,7 @@ var ts; } function createInstruction(instruction) { var literal = ts.createLiteral(instruction); - literal.trailingComment = instructionNames[instruction]; + literal.trailingComment = getInstructionName(instruction); return literal; } function createInlineBreak(label, location) { @@ -43844,7 +44123,6 @@ var ts; priority: 6, text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; - var _a; })(ts || (ts = {})); var ts; (function (ts) { @@ -43852,27 +44130,27 @@ var ts; var compilerOptions = context.getCompilerOptions(); var previousOnEmitNode; var noSubstitution; - if (compilerOptions.jsx === 1) { + if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(249); context.enableEmitNotification(250); - context.enableEmitNotification(248); + context.enableEmitNotification(251); + context.enableEmitNotification(249); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); - context.enableSubstitution(258); + context.enableSubstitution(178); + context.enableSubstitution(259); return transformSourceFile; function transformSourceFile(node) { return node; } function onEmitNode(emitContext, node, emitCallback) { switch (node.kind) { - case 249: case 250: - case 248: + case 251: + case 249: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -43924,7 +44202,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(262); + context.enableEmitNotification(263); context.enableSubstitution(70); var currentSourceFile; return transformSourceFile; @@ -43949,9 +44227,9 @@ var ts; } function visitor(node) { switch (node.kind) { - case 235: + case 236: return undefined; - case 241: + case 242: return visitExportAssignment(node); } return node; @@ -44000,14 +44278,14 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableEmitNotification(262); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); - var exportFunctionsMap = ts.createMap(); - var noSubstitutionMap = ts.createMap(); + context.enableSubstitution(192); + context.enableEmitNotification(263); + var moduleInfoMap = []; + var deferredExports = []; + var exportFunctionsMap = []; + var noSubstitutionMap = []; var currentSourceFile; var moduleInfo; var exportFunction; @@ -44026,7 +44304,8 @@ var ts; currentSourceFile = node; enclosingBlockScopedContainer = node; moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); + exportFunction = ts.createUniqueName("exports"); + exportFunctionsMap[id] = exportFunction; contextObject = ts.createUniqueName("context"); var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); @@ -44063,12 +44342,12 @@ var ts; var externalImport = externalImports[i]; var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); var text = externalModuleName.text; - if (ts.hasProperty(groupIndices, text)) { - var groupIndex = groupIndices[text]; + var groupIndex = groupIndices.get(text); + if (groupIndex !== undefined) { dependencyGroups[groupIndex].externalImports.push(externalImport); } else { - groupIndices[text] = dependencyGroups.length; + groupIndices.set(text, dependencyGroups.length); dependencyGroups.push({ name: externalModuleName, externalImports: [externalImport] @@ -44099,11 +44378,11 @@ var ts; if (!moduleInfo.hasExportStarsToExportValues) { return; } - if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) { + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 242 && externalImport.exportClause) { + if (externalImport.kind === 243 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -44126,7 +44405,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 242) { + if (externalImport.kind !== 243) { continue; } var exportDecl = externalImport; @@ -44178,15 +44457,15 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 236: + case 237: if (!entry.importClause) { break; } - case 235: + case 236: ts.Debug.assert(importVariableName !== undefined); statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 242: + case 243: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { var properties = []; @@ -44208,13 +44487,13 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 236: + case 237: return visitImportDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); - case 242: + case 243: return undefined; - case 241: + case 242: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -44335,7 +44614,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 1048576) === 0 - && (enclosingBlockScopedContainer.kind === 262 + && (enclosingBlockScopedContainer.kind === 263 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -44357,7 +44636,7 @@ var ts; : preventSubstitution(ts.createAssignment(name, value, location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -44390,10 +44669,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 238: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 239: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -44463,7 +44742,7 @@ var ts; return statements; } var name = ts.getDeclarationName(decl); - var exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; @@ -44492,43 +44771,43 @@ var ts; } function nestedElementVisitor(node) { switch (node.kind) { - case 206: + case 207: return visitVariableStatement(node); - case 226: - return visitFunctionDeclaration(node); case 227: + return visitFunctionDeclaration(node); + case 228: return visitClassDeclaration(node); - case 212: - return visitForStatement(node); case 213: - return visitForInStatement(node); + return visitForStatement(node); case 214: + return visitForInStatement(node); + case 215: return visitForOfStatement(node); - case 210: - return visitDoStatement(node); case 211: + return visitDoStatement(node); + case 212: return visitWhileStatement(node); - case 220: + case 221: return visitLabeledStatement(node); - case 218: - return visitWithStatement(node); case 219: + return visitWithStatement(node); + case 220: return visitSwitchStatement(node); - case 233: + case 234: return visitCaseBlock(node); - case 254: - return visitCaseClause(node); case 255: + return visitCaseClause(node); + case 256: return visitDefaultClause(node); - case 222: + case 223: return visitTryStatement(node); - case 257: + case 258: return visitCatchClause(node); - case 205: + case 206: return visitBlock(node); - case 296: - return visitMergeDeclarationMarker(node); case 297: + return visitMergeDeclarationMarker(node); + case 298: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -44619,7 +44898,7 @@ var ts; } function destructuringVisitor(node) { if (node.transformFlags & 1024 - && node.kind === 192) { + && node.kind === 193) { return visitDestructuringAssignment(node); } else if (node.transformFlags & 2048) { @@ -44656,7 +44935,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 262; + return container !== undefined && container.kind === 263; } else { return false; @@ -44671,7 +44950,7 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 262) { + if (node.kind === 263) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -44704,10 +44983,10 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); - case 190: case 191: + case 192: return substituteUnaryExpression(node); } return node; @@ -44759,14 +45038,14 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 + var expression = node.kind === 192 ? ts.createPrefix(node.operator, node.operand, node) : node; for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { var exportName = exportedNames_2[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 191) { + if (node.kind === 192) { expression = node.operator === 42 ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -44783,7 +45062,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 262) { + if (exportContainer && exportContainer.kind === 263) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -44793,7 +45072,7 @@ var ts; } function preventSubstitution(node) { if (noSubstitution === undefined) - noSubstitution = ts.createMap(); + noSubstitution = []; noSubstitution[ts.getNodeId(node)] = true; return node; } @@ -44806,12 +45085,13 @@ var ts; var ts; (function (ts) { function transformModule(context) { - var transformModuleDelegates = ts.createMap((_a = {}, - _a[ts.ModuleKind.None] = transformCommonJSModule, - _a[ts.ModuleKind.CommonJS] = transformCommonJSModule, - _a[ts.ModuleKind.AMD] = transformAMDModule, - _a[ts.ModuleKind.UMD] = transformUMDModule, - _a)); + function getTransformModuleDelegate(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.AMD: return transformAMDModule; + case ts.ModuleKind.UMD: return transformUMDModule; + default: return transformCommonJSModule; + } + } var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); @@ -44823,13 +45103,13 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableSubstitution(259); - context.enableEmitNotification(262); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); + context.enableSubstitution(192); + context.enableSubstitution(260); + context.enableEmitNotification(263); + var moduleInfoMap = []; + var deferredExports = []; var currentSourceFile; var currentModuleInfo; var noSubstitution; @@ -44841,8 +45121,9 @@ var ts; return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; + currentModuleInfo = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; + var transformModule = getTransformModuleDelegate(moduleKind); var updated = transformModule(node); currentSourceFile = undefined; currentModuleInfo = undefined; @@ -44968,23 +45249,23 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 236: + case 237: return visitImportDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); - case 242: + case 243: return visitExportDeclaration(node); - case 241: + case 242: return visitExportAssignment(node); - case 206: + case 207: return visitVariableStatement(node); - case 226: - return visitFunctionDeclaration(node); case 227: + return visitFunctionDeclaration(node); + case 228: return visitClassDeclaration(node); - case 296: - return visitMergeDeclarationMarker(node); case 297: + return visitMergeDeclarationMarker(node); + case 298: return visitEndOfDeclarationMarker(node); default: return node; @@ -45182,7 +45463,7 @@ var ts; } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -45214,10 +45495,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 238: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 239: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -45275,7 +45556,7 @@ var ts; } function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl); - var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; @@ -45287,7 +45568,7 @@ var ts; function appendExportStatement(statements, exportName, expression, location, allowComments) { if (exportName.text === "default") { var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile); - if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { + if (sourceFile && !sourceFile.symbol.exports.get("___esModule")) { if (languageVersion === 0) { statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true)))); } @@ -45325,10 +45606,10 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 262) { + if (node.kind === 263) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; - noSubstitution = ts.createMap(); + noSubstitution = []; previousOnEmitNode(emitContext, node, emitCallback); currentSourceFile = undefined; currentModuleInfo = undefined; @@ -45367,10 +45648,10 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); + case 192: case 191: - case 190: return substituteUnaryExpression(node); } return node; @@ -45385,7 +45666,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 262) { + if (exportContainer && exportContainer.kind === 263) { return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -45394,8 +45675,8 @@ var ts; return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_39 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_39), node); + var name = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name), node); } } } @@ -45428,7 +45709,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 + var expression = node.kind === 192 ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 ? 58 : 59), ts.createLiteral(1), node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { @@ -45451,7 +45732,6 @@ var ts; } } } - var _a; } ts.transformModule = transformModule; var exportStarHelper = { @@ -45462,14 +45742,16 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var moduleTransformerMap = ts.createMap((_a = {}, - _a[ts.ModuleKind.ES2015] = ts.transformES2015Module, - _a[ts.ModuleKind.System] = ts.transformSystemModule, - _a[ts.ModuleKind.AMD] = ts.transformModule, - _a[ts.ModuleKind.CommonJS] = ts.transformModule, - _a[ts.ModuleKind.UMD] = ts.transformModule, - _a[ts.ModuleKind.None] = ts.transformModule, - _a)); + function getModuleTransformer(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.ES2015: + return ts.transformES2015Module; + case ts.ModuleKind.System: + return ts.transformSystemModule; + default: + return ts.transformModule; + } + } function getTransformers(compilerOptions) { var jsx = compilerOptions.jsx; var languageVersion = ts.getEmitScriptTarget(compilerOptions); @@ -45492,7 +45774,7 @@ var ts; transformers.push(ts.transformES2015); transformers.push(ts.transformGenerators); } - transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]); + transformers.push(getModuleTransformer(moduleKind)); if (languageVersion < 1) { transformers.push(ts.transformES5); } @@ -45500,7 +45782,7 @@ var ts; } ts.getTransformers = getTransformers; function transformFiles(resolver, host, sourceFiles, transformers) { - var enabledSyntaxKindFeatures = new Array(298); + var enabledSyntaxKindFeatures = new Array(299); var lexicalEnvironmentDisabled = false; var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; @@ -45656,7 +45938,6 @@ var ts; } } ts.transformFiles = transformFiles; - var _a; })(ts || (ts = {})); var ts; (function (ts) { @@ -45822,7 +46103,7 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 294 + if (node.kind !== 295 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); @@ -45835,7 +46116,7 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 294 + if (node.kind !== 295 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -45979,7 +46260,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 294; + var isEmittedNode = node.kind !== 295; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { @@ -45993,7 +46274,7 @@ var ts; } if (!skipTrailingComments) { containerEnd = end; - if (node.kind === 225) { + if (node.kind === 226) { declarationListContainerEnd = end; } } @@ -46198,7 +46479,7 @@ var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); - ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + ts.forEachEmittedFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { var declarationFilePath = _a.declarationFilePath; @@ -46268,7 +46549,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 236); + ts.Debug.assert(aliasEmitInfo.node.kind === 237); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -46291,9 +46572,9 @@ var ts; } }); if (usedTypeDirectiveReferences) { - for (var directive in usedTypeDirectiveReferences) { + ts.forEachKey(usedTypeDirectiveReferences, function (directive) { referencesOutput += "/// " + newLine; - } + }); } return { reportedDeclarationError: reportedDeclarationError, @@ -46340,10 +46621,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 224) { + if (declaration.kind === 225) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 239 || declaration.kind === 240 || declaration.kind === 237) { + else if (declaration.kind === 240 || declaration.kind === 241 || declaration.kind === 238) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -46354,7 +46635,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 236) { + if (moduleElementEmitInfo.node.kind === 237) { moduleElementEmitInfo.isVisible = true; } else { @@ -46362,12 +46643,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 231) { + if (nodeToCheck.kind === 232) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 231) { + if (nodeToCheck.kind === 232) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -46386,8 +46667,8 @@ var ts; } for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { var directive = typeReferenceDirectives_1[_i]; - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + if (!usedTypeDirectiveReferences.has(directive)) { + usedTypeDirectiveReferences.set(directive, directive); } } } @@ -46480,49 +46761,50 @@ var ts; function emitType(type) { switch (type.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 133: + case 136: case 104: - case 137: + case 138: case 94: case 129: - case 167: - case 171: + case 168: + case 172: return writeTextOfNode(currentText, type); - case 199: + case 200: return emitExpressionWithTypeArguments(type); - case 157: + case 158: return emitTypeReference(type); - case 160: + case 161: return emitTypeQuery(type); - case 162: - return emitArrayType(type); case 163: - return emitTupleType(type); + return emitArrayType(type); case 164: - return emitUnionType(type); + return emitTupleType(type); case 165: - return emitIntersectionType(type); + return emitUnionType(type); case 166: + return emitIntersectionType(type); + case 167: return emitParenType(type); - case 168: - return emitTypeOperator(type); case 169: - return emitIndexedAccessType(type); + return emitTypeOperator(type); case 170: + return emitIndexedAccessType(type); + case 171: return emitMappedType(type); - case 158: case 159: + case 160: return emitSignatureDeclarationWithJsDocComments(type); - case 161: + case 162: return emitTypeLiteral(type); case 70: return emitEntityName(type); - case 141: + case 142: return emitEntityName(type); - case 156: + case 157: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -46530,22 +46812,22 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 141 ? entityName.left : entityName.expression; - var right = entityName.kind === 141 ? entityName.right : entityName.name; + var left = entityName.kind === 142 ? entityName.left : entityName.expression; + var right = entityName.kind === 142 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 235 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 236 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isEntityNameExpression(node.expression)) { - ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 177); + ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 178); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -46649,15 +46931,15 @@ var ts; } function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!(baseName in currentIdentifiers)) { + if (!currentIdentifiers.has(baseName)) { return baseName; } var count = 0; while (true) { count++; - var name_40 = baseName + "_" + count; - if (!(name_40 in currentIdentifiers)) { - return name_40; + var name = baseName + "_" + count; + if (!currentIdentifiers.has(name)) { + return name; } } } @@ -46701,10 +46983,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 235 || - (node.parent.kind === 262 && isCurrentFileExternalModule)) { + else if (node.kind === 236 || + (node.parent.kind === 263 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 262) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 263) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -46713,7 +46995,7 @@ var ts; }); } else { - if (node.kind === 236) { + if (node.kind === 237) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -46731,30 +47013,30 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 226: + case 227: return writeFunctionDeclaration(node); - case 206: + case 207: return writeVariableStatement(node); - case 228: + case 229: return writeInterfaceDeclaration(node); - case 227: + case 228: return writeClassDeclaration(node); - case 229: - return writeTypeAliasDeclaration(node); case 230: - return writeEnumDeclaration(node); + return writeTypeAliasDeclaration(node); case 231: + return writeEnumDeclaration(node); + case 232: return writeModuleDeclaration(node); - case 235: - return writeImportEqualsDeclaration(node); case 236: + return writeImportEqualsDeclaration(node); + case 237: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 262) { + if (node.parent.kind === 263) { var modifiers = ts.getModifierFlags(node); if (modifiers & 1) { write("export "); @@ -46762,7 +47044,7 @@ var ts; if (modifiers & 512) { write("default "); } - else if (node.kind !== 228 && !noDeclare) { + else if (node.kind !== 229 && !noDeclare) { write("declare "); } } @@ -46812,7 +47094,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 238) { + if (namedBindings.kind === 239) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -46835,7 +47117,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 238) { + if (node.importClause.namedBindings.kind === 239) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -46852,13 +47134,13 @@ var ts; writer.writeLine(); } function emitExternalModuleSpecifier(parent) { - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 231; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 232; var moduleSpecifier; - if (parent.kind === 235) { + if (parent.kind === 236) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 231) { + else if (parent.kind === 232) { moduleSpecifier = parent.name; } else { @@ -46926,7 +47208,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 232) { + while (node.body && node.body.kind !== 233) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -46996,7 +47278,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 149 && ts.hasModifier(node.parent, 8); + return node.parent.kind === 150 && ts.hasModifier(node.parent, 8); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -47006,15 +47288,15 @@ var ts; writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - (node.parent.parent && node.parent.parent.kind === 161)) { - ts.Debug.assert(node.parent.kind === 149 || - node.parent.kind === 148 || - node.parent.kind === 158 || + if (node.parent.kind === 159 || + node.parent.kind === 160 || + (node.parent.parent && node.parent.parent.kind === 162)) { + ts.Debug.assert(node.parent.kind === 150 || + node.parent.kind === 149 || node.parent.kind === 159 || - node.parent.kind === 153 || - node.parent.kind === 154); + node.parent.kind === 160 || + node.parent.kind === 154 || + node.parent.kind === 155); emitType(node.constraint); } else { @@ -47024,34 +47306,34 @@ var ts; function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 227: + case 228: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 228: + case 229: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 154: + case 155: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 153: + case 154: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { 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 === 227) { + else if (node.parent.parent.kind === 228) { 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 226: + case 227: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 229: + case 230: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -47088,7 +47370,7 @@ var ts; } function getHeritageClauseVisibilityError() { var diagnosticMessage; - if (node.parent.parent.kind === 227) { + if (node.parent.parent.kind === 228) { 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; @@ -47171,17 +47453,17 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 224 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 225 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentText, node.name); - if ((node.kind === 147 || node.kind === 146 || - (node.kind === 144 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { + if ((node.kind === 148 || node.kind === 147 || + (node.kind === 145 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 147 || node.kind === 146) && node.parent.kind === 161) { + if ((node.kind === 148 || node.kind === 147) && node.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (resolver.isLiteralConstDeclaration(node)) { @@ -47194,14 +47476,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 224) { + if (node.kind === 225) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 === 147 || node.kind === 146) { + else if (node.kind === 148 || node.kind === 147) { if (ts.hasModifier(node, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -47209,7 +47491,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 === 227) { + else if (node.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47235,7 +47517,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198) { + if (element.kind !== 199) { elements.push(element); } } @@ -47301,7 +47583,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 151 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 152 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -47314,7 +47596,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 151 + return accessor.kind === 152 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -47323,7 +47605,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 152) { + if (accessorWithTypeAnnotation.kind === 153) { if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : @@ -47369,17 +47651,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 226) { + if (node.kind === 227) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 149 || node.kind === 150) { + else if (node.kind === 150 || node.kind === 151) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 226) { + if (node.kind === 227) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 150) { + else if (node.kind === 151) { write("constructor"); } else { @@ -47399,15 +47681,15 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; var closeParenthesizedFunctionType = false; - if (node.kind === 155) { + if (node.kind === 156) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); write("["); } else { - if (node.kind === 154 || node.kind === 159) { + if (node.kind === 155 || node.kind === 160) { write("new "); } - else if (node.kind === 158) { + else if (node.kind === 159) { var currentOutput = writer.getText(); if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { closeParenthesizedFunctionType = true; @@ -47418,20 +47700,20 @@ var ts; write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 155) { + if (node.kind === 156) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 158 || node.kind === 159; - if (isFunctionTypeOrConstructorType || node.parent.kind === 161) { + var isFunctionTypeOrConstructorType = node.kind === 159 || node.kind === 160; + if (isFunctionTypeOrConstructorType || node.parent.kind === 162) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 150 && !ts.hasModifier(node, 8)) { + else if (node.kind !== 151 && !ts.hasModifier(node, 8)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -47445,23 +47727,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 154: + case 155: diagnosticMessage = symbolAccessibilityResult.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 153: + case 154: diagnosticMessage = symbolAccessibilityResult.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 155: + case 156: diagnosticMessage = symbolAccessibilityResult.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 150: case 149: - case 148: if (ts.hasModifier(node, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -47469,7 +47751,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 === 227) { + else if (node.parent.kind === 228) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -47482,7 +47764,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 226: + case 227: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -47514,9 +47796,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - node.parent.parent.kind === 161) { + if (node.parent.kind === 159 || + node.parent.kind === 160 || + node.parent.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!ts.hasModifier(node.parent, 8)) { @@ -47532,26 +47814,26 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 150: + case 151: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 154: + case 155: return symbolAccessibilityResult.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 153: + case 154: return symbolAccessibilityResult.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 155: + case 156: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -47559,7 +47841,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 === 227) { + else if (node.parent.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -47571,7 +47853,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 226: + case 227: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47582,12 +47864,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -47598,10 +47880,10 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 198) { + if (bindingElement.kind === 199) { write(" "); } - else if (bindingElement.kind === 174) { + else if (bindingElement.kind === 175) { if (bindingElement.propertyName) { writeTextOfNode(currentText, bindingElement.propertyName); write(": "); @@ -47623,39 +47905,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 226: - case 231: - case 235: - case 228: case 227: + case 232: + case 236: case 229: + case 228: case 230: + case 231: return emitModuleElement(node, isModuleElementVisible(node)); - case 206: + case 207: return emitModuleElement(node, isVariableStatementVisible(node)); - case 236: + case 237: return emitModuleElement(node, !node.importClause); - case 242: + case 243: return emitExportDeclaration(node); + case 151: case 150: case 149: - case 148: return writeFunctionDeclaration(node); - case 154: - case 153: case 155: + case 154: + case 156: return emitSignatureDeclarationWithJsDocComments(node); - case 151: case 152: + case 153: return emitAccessorDeclaration(node); + case 148: case 147: - case 146: return emitPropertyDeclaration(node); - case 261: + case 262: return emitEnumMemberDeclaration(node); - case 241: + case 242: return emitExportAssignment(node); - case 262: + case 263: return emitSourceFile(node); } } @@ -47666,7 +47948,7 @@ var ts; declFileName = referencedFile.fileName; } else { - ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); @@ -47744,10 +48026,10 @@ var ts; var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification; ts.performance.measure("transformTime", "beforeTransform"); ts.performance.mark("beforePrint"); - ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, emitFile, transformed, emitOnlyDtsFiles); ts.performance.measure("printTime", "beforePrint"); - for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) { - var sourceFile = sourceFiles_4[_b]; + for (var _b = 0, sourceFiles_3 = sourceFiles; _b < sourceFiles_3.length; _b++) { + var sourceFile = sourceFiles_3[_b]; ts.disposeEmitNodes(sourceFile); } return { @@ -47756,7 +48038,8 @@ var ts; emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; - function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) { + function emitFile(_a, sourceFiles, isBundledEmit) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { if (!emitOnlyDtsFiles) { printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); @@ -47788,8 +48071,8 @@ var ts; bundledHelpers = isBundledEmit ? ts.createMap() : undefined; isOwnFileEmit = !isBundledEmit; if (isBundledEmit && moduleKind) { - for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { - var sourceFile = sourceFiles_5[_a]; + for (var _a = 0, sourceFiles_4 = sourceFiles; _a < sourceFiles_4.length; _a++) { + var sourceFile = sourceFiles_4[_a]; emitHelpers(sourceFile, true); } } @@ -47863,7 +48146,7 @@ var ts; function pipelineEmitInSourceFileContext(node) { var kind = node.kind; switch (kind) { - case 262: + case 263: return emitSourceFile(node); } } @@ -47907,7 +48190,6 @@ var ts; case 130: case 131: case 132: - case 133: case 134: case 135: case 136: @@ -47915,190 +48197,191 @@ var ts; case 138: case 139: case 140: + case 141: writeTokenText(kind); return; - case 141: - return emitQualifiedName(node); case 142: - return emitComputedPropertyName(node); + return emitQualifiedName(node); case 143: - return emitTypeParameter(node); + return emitComputedPropertyName(node); case 144: - return emitParameter(node); + return emitTypeParameter(node); case 145: - return emitDecorator(node); + return emitParameter(node); case 146: - return emitPropertySignature(node); + return emitDecorator(node); case 147: - return emitPropertyDeclaration(node); + return emitPropertySignature(node); case 148: - return emitMethodSignature(node); + return emitPropertyDeclaration(node); case 149: - return emitMethodDeclaration(node); + return emitMethodSignature(node); case 150: - return emitConstructor(node); + return emitMethodDeclaration(node); case 151: + return emitConstructor(node); case 152: - return emitAccessorDeclaration(node); case 153: - return emitCallSignature(node); + return emitAccessorDeclaration(node); case 154: - return emitConstructSignature(node); + return emitCallSignature(node); case 155: - return emitIndexSignature(node); + return emitConstructSignature(node); case 156: - return emitTypePredicate(node); + return emitIndexSignature(node); case 157: - return emitTypeReference(node); + return emitTypePredicate(node); case 158: - return emitFunctionType(node); + return emitTypeReference(node); case 159: - return emitConstructorType(node); + return emitFunctionType(node); case 160: - return emitTypeQuery(node); + return emitConstructorType(node); case 161: - return emitTypeLiteral(node); + return emitTypeQuery(node); case 162: - return emitArrayType(node); + return emitTypeLiteral(node); case 163: - return emitTupleType(node); + return emitArrayType(node); case 164: - return emitUnionType(node); + return emitTupleType(node); case 165: - return emitIntersectionType(node); + return emitUnionType(node); case 166: + return emitIntersectionType(node); + case 167: return emitParenthesizedType(node); - case 199: + case 200: return emitExpressionWithTypeArguments(node); - case 167: - return emitThisType(); case 168: - return emitTypeOperator(node); + return emitThisType(); case 169: - return emitIndexedAccessType(node); + return emitTypeOperator(node); case 170: - return emitMappedType(node); + return emitIndexedAccessType(node); case 171: - return emitLiteralType(node); + return emitMappedType(node); case 172: - return emitObjectBindingPattern(node); + return emitLiteralType(node); case 173: - return emitArrayBindingPattern(node); + return emitObjectBindingPattern(node); case 174: + return emitArrayBindingPattern(node); + case 175: return emitBindingElement(node); - case 203: - return emitTemplateSpan(node); case 204: - return emitSemicolonClassElement(); + return emitTemplateSpan(node); case 205: - return emitBlock(node); + return emitSemicolonClassElement(); case 206: - return emitVariableStatement(node); + return emitBlock(node); case 207: - return emitEmptyStatement(); + return emitVariableStatement(node); case 208: - return emitExpressionStatement(node); + return emitEmptyStatement(); case 209: - return emitIfStatement(node); + return emitExpressionStatement(node); case 210: - return emitDoStatement(node); + return emitIfStatement(node); case 211: - return emitWhileStatement(node); + return emitDoStatement(node); case 212: - return emitForStatement(node); + return emitWhileStatement(node); case 213: - return emitForInStatement(node); + return emitForStatement(node); case 214: - return emitForOfStatement(node); + return emitForInStatement(node); case 215: - return emitContinueStatement(node); + return emitForOfStatement(node); case 216: - return emitBreakStatement(node); + return emitContinueStatement(node); case 217: - return emitReturnStatement(node); + return emitBreakStatement(node); case 218: - return emitWithStatement(node); + return emitReturnStatement(node); case 219: - return emitSwitchStatement(node); + return emitWithStatement(node); case 220: - return emitLabeledStatement(node); + return emitSwitchStatement(node); case 221: - return emitThrowStatement(node); + return emitLabeledStatement(node); case 222: - return emitTryStatement(node); + return emitThrowStatement(node); case 223: - return emitDebuggerStatement(node); + return emitTryStatement(node); case 224: - return emitVariableDeclaration(node); + return emitDebuggerStatement(node); case 225: - return emitVariableDeclarationList(node); + return emitVariableDeclaration(node); case 226: - return emitFunctionDeclaration(node); + return emitVariableDeclarationList(node); case 227: - return emitClassDeclaration(node); + return emitFunctionDeclaration(node); case 228: - return emitInterfaceDeclaration(node); + return emitClassDeclaration(node); case 229: - return emitTypeAliasDeclaration(node); + return emitInterfaceDeclaration(node); case 230: - return emitEnumDeclaration(node); + return emitTypeAliasDeclaration(node); case 231: - return emitModuleDeclaration(node); + return emitEnumDeclaration(node); case 232: - return emitModuleBlock(node); + return emitModuleDeclaration(node); case 233: + return emitModuleBlock(node); + case 234: return emitCaseBlock(node); - case 235: - return emitImportEqualsDeclaration(node); case 236: - return emitImportDeclaration(node); + return emitImportEqualsDeclaration(node); case 237: - return emitImportClause(node); + return emitImportDeclaration(node); case 238: - return emitNamespaceImport(node); + return emitImportClause(node); case 239: - return emitNamedImports(node); + return emitNamespaceImport(node); case 240: - return emitImportSpecifier(node); + return emitNamedImports(node); case 241: - return emitExportAssignment(node); + return emitImportSpecifier(node); case 242: - return emitExportDeclaration(node); + return emitExportAssignment(node); case 243: - return emitNamedExports(node); + return emitExportDeclaration(node); case 244: - return emitExportSpecifier(node); + return emitNamedExports(node); case 245: - return; + return emitExportSpecifier(node); case 246: + return; + case 247: return emitExternalModuleReference(node); case 10: return emitJsxText(node); - case 249: - return emitJsxOpeningElement(node); case 250: - return emitJsxClosingElement(node); + return emitJsxOpeningElement(node); case 251: - return emitJsxAttribute(node); + return emitJsxClosingElement(node); case 252: - return emitJsxSpreadAttribute(node); + return emitJsxAttribute(node); case 253: - return emitJsxExpression(node); + return emitJsxSpreadAttribute(node); case 254: - return emitCaseClause(node); + return emitJsxExpression(node); case 255: - return emitDefaultClause(node); + return emitCaseClause(node); case 256: - return emitHeritageClause(node); + return emitDefaultClause(node); case 257: - return emitCatchClause(node); + return emitHeritageClause(node); case 258: - return emitPropertyAssignment(node); + return emitCatchClause(node); case 259: - return emitShorthandPropertyAssignment(node); + return emitPropertyAssignment(node); case 260: - return emitSpreadAssignment(node); + return emitShorthandPropertyAssignment(node); case 261: + return emitSpreadAssignment(node); + case 262: return emitEnumMember(node); } if (ts.isExpression(node)) { @@ -48123,65 +48406,65 @@ var ts; case 98: writeTokenText(kind); return; - case 175: - return emitArrayLiteralExpression(node); case 176: - return emitObjectLiteralExpression(node); + return emitArrayLiteralExpression(node); case 177: - return emitPropertyAccessExpression(node); + return emitObjectLiteralExpression(node); case 178: - return emitElementAccessExpression(node); + return emitPropertyAccessExpression(node); case 179: - return emitCallExpression(node); + return emitElementAccessExpression(node); case 180: - return emitNewExpression(node); + return emitCallExpression(node); case 181: - return emitTaggedTemplateExpression(node); + return emitNewExpression(node); case 182: - return emitTypeAssertionExpression(node); + return emitTaggedTemplateExpression(node); case 183: - return emitParenthesizedExpression(node); + return emitTypeAssertionExpression(node); case 184: - return emitFunctionExpression(node); + return emitParenthesizedExpression(node); case 185: - return emitArrowFunction(node); + return emitFunctionExpression(node); case 186: - return emitDeleteExpression(node); + return emitArrowFunction(node); case 187: - return emitTypeOfExpression(node); + return emitDeleteExpression(node); case 188: - return emitVoidExpression(node); + return emitTypeOfExpression(node); case 189: - return emitAwaitExpression(node); + return emitVoidExpression(node); case 190: - return emitPrefixUnaryExpression(node); + return emitAwaitExpression(node); case 191: - return emitPostfixUnaryExpression(node); + return emitPrefixUnaryExpression(node); case 192: - return emitBinaryExpression(node); + return emitPostfixUnaryExpression(node); case 193: - return emitConditionalExpression(node); + return emitBinaryExpression(node); case 194: - return emitTemplateExpression(node); + return emitConditionalExpression(node); case 195: - return emitYieldExpression(node); + return emitTemplateExpression(node); case 196: - return emitSpreadExpression(node); + return emitYieldExpression(node); case 197: - return emitClassExpression(node); + return emitSpreadExpression(node); case 198: + return emitClassExpression(node); + case 199: return; - case 200: - return emitAsExpression(node); case 201: - return emitNonNullExpression(node); + return emitAsExpression(node); case 202: + return emitNonNullExpression(node); + case 203: return emitMetaProperty(node); - case 247: - return emitJsxElement(node); case 248: + return emitJsxElement(node); + case 249: return emitJsxSelfClosingElement(node); - case 295: + case 296: return emitPartiallyEmittedExpression(node); } } @@ -48280,7 +48563,7 @@ var ts; function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - write(node.kind === 151 ? "get " : "set "); + write(node.kind === 152 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -48478,7 +48761,9 @@ var ts; function needsDotDotForPropertyAccess(expression) { if (expression.kind === 8) { var text = getLiteralTextOfNode(expression); - return text.indexOf(ts.tokenToString(22)) < 0; + return ts.getNumericLiteralFlags(text, 15) === 0 + && !expression.isOctalLiteral + && text.indexOf(ts.tokenToString(22)) < 0; } else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { var constantValue = ts.getConstantValue(expression); @@ -48561,7 +48846,7 @@ var ts; } function shouldEmitWhitespaceBeforeOperand(node) { var operand = node.operand; - return operand.kind === 190 + return operand.kind === 191 && ((node.operator === 36 && (operand.operator === 36 || operand.operator === 42)) || (node.operator === 37 && (operand.operator === 37 || operand.operator === 43))); } @@ -48678,7 +48963,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node); writeToken(81, node.thenStatement.end, node); - if (node.elseStatement.kind === 209) { + if (node.elseStatement.kind === 210) { write(" "); emit(node.elseStatement); } @@ -48740,7 +49025,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 225) { + if (node.kind === 226) { emit(node); } else { @@ -48972,7 +49257,7 @@ var ts; write(node.flags & 16 ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 231) { + while (body.kind === 232) { write("."); emit(body.name); body = body.body; @@ -49168,7 +49453,6 @@ var ts; emitList(node, node.types, 272); } function emitCatchClause(node) { - writeLine(); var openParenPos = writeToken(73, node.pos); write(" "); writeToken(18, openParenPos); @@ -49248,10 +49532,10 @@ var ts; if (shouldSkip) continue; if (shouldBundle) { - if (bundledHelpers[helper.name]) { + if (bundledHelpers.get(helper.name)) { continue; } - bundledHelpers[helper.name] = true; + bundledHelpers.set(helper.name, true); } } else if (isBundle) { @@ -49586,7 +49870,7 @@ var ts; && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); } function skipSynthesizedParentheses(node) { - while (node.kind === 183 && ts.nodeIsSynthesized(node)) { + while (node.kind === 184 && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -49628,13 +49912,14 @@ var ts; } function isUniqueName(name) { return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentFileIdentifiers, name) && - !ts.hasProperty(generatedNameSet, name); + !currentFileIdentifiers.has(name) && + !generatedNameSet.has(name); } function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { - if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { + if (node.locals) { + var local = node.locals.get(name); + if (local && local.flags & (107455 | 1048576 | 8388608)) { return false; } } @@ -49643,21 +49928,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_41 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_41)) { + var name = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name)) { tempFlags |= flags; - return name_41; + return name; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_42 = count < 26 + var name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_42)) { - return name_42; + if (isUniqueName(name)) { + return name; } } } @@ -49670,7 +49955,8 @@ var ts; while (true) { var generatedName = baseName + i; if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; + generatedNameSet.set(generatedName, generatedName); + return generatedName; } i++; } @@ -49701,21 +49987,21 @@ var ts; switch (node.kind) { case 70: return makeUniqueName(getTextOfNode(node)); + case 232: case 231: - case 230: return generateNameForModuleOrEnum(node); - case 236: - case 242: + case 237: + case 243: return generateNameForImportOrExportDeclaration(node); - case 226: case 227: - case 241: + case 228: + case 242: return generateNameForExportDefault(); - case 197: + case 198: return generateNameForClassExpression(); - case 149: - case 151: + case 150: case 152: + case 153: return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0); @@ -49871,11 +50157,11 @@ var ts; return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; } function directoryExists(directoryPath) { - if (directoryPath in existingDirectories) { + if (existingDirectories.has(directoryPath)) { return true; } if (ts.sys.directoryExists(directoryPath)) { - existingDirectories[directoryPath] = true; + existingDirectories.set(directoryPath, true); return true; } return false; @@ -49894,9 +50180,10 @@ var ts; } var hash = ts.sys.createHash(data); var mtimeBefore = ts.sys.getModifiedTime(fileName); - if (mtimeBefore && fileName in outputFingerprints) { - var fingerprint = outputFingerprints[fileName]; - if (fingerprint.byteOrderMark === writeByteOrderMark && + if (mtimeBefore) { + var fingerprint = outputFingerprints.get(fileName); + if (fingerprint && + fingerprint.byteOrderMark === writeByteOrderMark && fingerprint.hash === hash && fingerprint.mtime.getTime() === mtimeBefore.getTime()) { return; @@ -49904,11 +50191,11 @@ var ts; } ts.sys.writeFile(fileName, data, writeByteOrderMark); var mtimeAfter = ts.sys.getModifiedTime(fileName); - outputFingerprints[fileName] = { + outputFingerprints.set(fileName, { hash: hash, byteOrderMark: writeByteOrderMark, mtime: mtimeAfter - }; + }); } function writeFile(fileName, data, writeByteOrderMark, onError) { try { @@ -50007,10 +50294,14 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_43 = names_1[_i]; - var result = name_43 in cache - ? cache[name_43] - : cache[name_43] = loader(name_43, containingFile); + var name = names_1[_i]; + var result = void 0; + if (cache.has(name)) { + result = cache.get(name); + } + else { + cache.set(name, result = loader(name, containingFile)); + } resolutions.push(result); } return resolutions; @@ -50119,7 +50410,7 @@ var ts; return program; function getCommonSourceDirectory() { if (commonSourceDirectory === undefined) { - var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary); + var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary); }); if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); } @@ -50138,7 +50429,7 @@ var ts; classifiableNames = ts.createMap(); for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var sourceFile = files_2[_i]; - ts.copyProperties(sourceFile.classifiableNames, classifiableNames); + ts.copyEntries(sourceFile.classifiableNames, classifiableNames); } } return classifiableNames; @@ -50321,7 +50612,7 @@ var ts; }; } function isSourceFileFromExternalLibrary(file) { - return sourceFilesFoundSearchingNodeModules[file.path]; + return sourceFilesFoundSearchingNodeModules.get(file.path); } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); @@ -50438,57 +50729,57 @@ var ts; return diagnostics; function walk(node) { switch (parent.kind) { - case 144: - case 147: + case 145: + case 148: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); return; } - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 184: - case 226: + case 153: case 185: - case 226: - case 224: + case 227: + case 186: + case 227: + case 225: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); return; } } switch (node.kind) { - case 235: + case 236: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 241: + case 242: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 256: + case 257: var heritageClause = node; if (heritageClause.token === 107) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 228: + case 229: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 231: + case 232: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 229: + case 230: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 230: + case 231: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 182: + case 183: var typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; @@ -50503,26 +50794,26 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 227: - case 149: - case 148: + case 228: case 150: + case 149: case 151: case 152: - case 184: - case 226: + case 153: case 185: - case 226: + case 227: + case 186: + case 227: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - case 206: + case 207: if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 206); + return checkModifiers(nodes, parent.kind === 207); } break; - case 147: + case 148: if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; @@ -50533,15 +50824,15 @@ var ts; return; } break; - case 144: + case 145: if (nodes === parent.modifiers) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); return; } break; - case 179: case 180: - case 199: + case 181: + case 200: if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); return; @@ -50631,7 +50922,7 @@ var ts; && !file.isDeclarationFile) { var externalHelpersModuleReference = ts.createSynthesizedNode(9); externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(236); + var importDecl = ts.createSynthesizedNode(237); importDecl.parent = file; externalHelpersModuleReference.parent = importDecl; imports = [externalHelpersModuleReference]; @@ -50649,9 +50940,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { + case 237: case 236: - case 235: - case 242: + case 243: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -50663,7 +50954,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 231: + case 232: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) { var moduleName = node.name; if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { @@ -50747,18 +51038,18 @@ var ts; if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } - if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) { - sourceFilesFoundSearchingNodeModules[file_1.path] = false; + if (file_1 && sourceFilesFoundSearchingNodeModules.get(file_1.path) && currentNodeModulesDepth == 0) { + sourceFilesFoundSearchingNodeModules.set(file_1.path, false); if (!options.noResolve) { processReferencedFiles(file_1, isDefaultLib); processTypeReferenceDirectives(file_1); } - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } - else if (file_1 && modulesWithElidedImports[file_1.path]) { + else if (file_1 && modulesWithElidedImports.get(file_1.path)) { if (currentNodeModulesDepth < maxNodeModuleJsDepth) { - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } } @@ -50774,7 +51065,7 @@ var ts; }); filesByName.set(path, file); if (file) { - sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0); + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); file.path = path; if (host.useCaseSensitiveFileNames()) { var existingFile = filesByNameIgnoreCase.get(path); @@ -50818,7 +51109,7 @@ var ts; } } function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { - var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); if (previousResolution && previousResolution.primary) { return; } @@ -50846,7 +51137,7 @@ var ts; fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); } if (saveResolution) { - resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective); } } function createDiagnostic(refFile, refPos, refEnd, message) { @@ -50887,7 +51178,7 @@ var ts; var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; if (elideImport) { - modulesWithElidedImports[file.path] = true; + modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); @@ -50905,8 +51196,8 @@ var ts; } function computeCommonSourceDirectory(sourceFiles) { var fileNames = []; - for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { - var file = sourceFiles_6[_i]; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var file = sourceFiles_5[_i]; if (!file.isDeclarationFile) { fileNames.push(file.fileName); } @@ -50917,8 +51208,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { - var sourceFile = sourceFiles_7[_i]; + for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { + var sourceFile = sourceFiles_6[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -51069,7 +51360,7 @@ var ts; if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); - ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) { + ts.forEachEmittedFile(emitHost, function (emitFileNames) { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); }); @@ -51182,12 +51473,13 @@ var ts; }, { name: "jsx", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "preserve": 1, + "react-native": 3, "react": 2 }), paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, }, { name: "reactNamespace", @@ -51217,7 +51509,7 @@ var ts; { name: "module", shortName: "m", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "none": ts.ModuleKind.None, "commonjs": ts.ModuleKind.CommonJS, "amd": ts.ModuleKind.AMD, @@ -51231,7 +51523,7 @@ var ts; }, { name: "newLine", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "crlf": 0, "lf": 1 }), @@ -51328,8 +51620,8 @@ var ts; shortName: "p", type: "string", isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY }, { name: "removeComments", @@ -51379,7 +51671,7 @@ var ts; { name: "target", shortName: "t", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es3": 0, "es5": 1, "es6": 2, @@ -51416,7 +51708,7 @@ var ts; }, { name: "moduleResolution", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "node": ts.ModuleResolutionKind.NodeJs, "classic": ts.ModuleResolutionKind.Classic, }), @@ -51521,7 +51813,7 @@ var ts; type: "list", element: { name: "lib", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es5": "lib.es5.d.ts", "es6": "lib.es2015.d.ts", "es2015": "lib.es2015.d.ts", @@ -51621,9 +51913,9 @@ var ts; var optionNameMap = ts.createMap(); var shortOptionNames = ts.createMap(); ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; @@ -51631,7 +51923,7 @@ var ts; } ts.getOptionNameMap = getOptionNameMap; function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; @@ -51680,11 +51972,12 @@ var ts; } else if (s.charCodeAt(0) === 45) { s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); - if (s in shortOptionNames) { - s = shortOptionNames[s]; + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - var opt = optionNameMap[s]; + var opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -51810,19 +52103,18 @@ var ts; } } function getNameOfCompilerOptionValue(value, customTypeMap) { - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { return key; } - } - return undefined; + }); } function serializeCompilerOptions(options) { - var result = ts.createMap(); + var result = {}; var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_44 in options) { - if (ts.hasProperty(options, name_44)) { - switch (name_44) { + for (var name in options) { + if (ts.hasProperty(options, name)) { + switch (name) { case "init": case "watch": case "version": @@ -51830,12 +52122,12 @@ var ts; case "project": break; default: - var value = options[name_44]; - var optionDefinition = optionsNameMap[name_44.toLowerCase()]; + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { - result[name_44] = value; + result[name] = value; } else { if (optionDefinition.type === "list") { @@ -51844,10 +52136,10 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_44] = convertedValue; + result[name] = convertedValue; } else { - result[name_44] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -52054,8 +52346,8 @@ var ts; } var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; + var opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -52089,8 +52381,9 @@ var ts; } function convertJsonOptionOfCustomType(opt, value, errors) { var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + var val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -52124,7 +52417,7 @@ var ts; for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } if (include && include.length > 0) { @@ -52135,14 +52428,13 @@ var ts; } removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); return { fileNames: literalFiles.concat(wildcardFiles), wildcardDirectories: wildcardDirectories @@ -52150,8 +52442,8 @@ var ts; } function validateSpecs(specs, errors, allowTrailingRecursion) { var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } @@ -52170,7 +52462,7 @@ var ts; function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); + var wildcardDirectories = {}; if (include !== undefined) { var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { @@ -52191,14 +52483,16 @@ var ts; } } } - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } } } - } + ; } return wildcardDirectories; } @@ -52221,7 +52515,7 @@ var ts; for (var i = 0; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i]; var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -52233,13 +52527,9 @@ var ts; for (var i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i]; var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - function addFileToOutput(output, file) { - output.push(file); - return output; - } function caseSensitiveKeyMapper(key) { return key; } @@ -52300,11 +52590,13 @@ var ts; var gutterSeparator = " "; var resetEscapeSequence = "\u001b[0m"; var ellipsis = "..."; - var categoryFormatMap = ts.createMap((_a = {}, - _a[ts.DiagnosticCategory.Warning] = yellowForegroundEscapeSequence, - _a[ts.DiagnosticCategory.Error] = redForegroundEscapeSequence, - _a[ts.DiagnosticCategory.Message] = blueForegroundEscapeSequence, - _a)); + function getCategoryFormat(category) { + switch (category) { + case ts.DiagnosticCategory.Warning: return yellowForegroundEscapeSequence; + case ts.DiagnosticCategory.Error: return redForegroundEscapeSequence; + case ts.DiagnosticCategory.Message: return blueForegroundEscapeSequence; + } + } function formatAndReset(text, formatStyle) { return formatStyle + text + resetEscapeSequence; } @@ -52353,7 +52645,7 @@ var ts; output += ts.sys.newLine; output += relativeFileName + "(" + (firstLine + 1) + "," + (firstLineChar + 1) + "): "; } - var categoryColor = categoryFormatMap[diagnostic.category]; + var categoryColor = getCategoryFormat(diagnostic.category); var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); output += formatAndReset(category, categoryColor) + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine); output += ts.sys.newLine + ts.sys.newLine; @@ -52365,7 +52657,7 @@ var ts; var loc = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); output += diagnostic.file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + "): "; } - output += "" + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine; + output += "" + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + (ts.sys.newLine + ts.sys.newLine + ts.sys.newLine); ts.sys.write(output); } function padLeft(s, length) { @@ -52544,9 +52836,11 @@ var ts; reportWatchDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Compilation_complete_Watching_for_file_changes)); } function cachedFileExists(fileName) { - return fileName in cachedExistingFiles - ? cachedExistingFiles[fileName] - : cachedExistingFiles[fileName] = hostFileExists(fileName); + var fileExists = cachedExistingFiles.get(fileName); + if (fileExists === undefined) { + cachedExistingFiles.set(fileName, fileExists = hostFileExists(fileName)); + } + return fileExists; } function getSourceFile(fileName, languageVersion, onError) { if (cachedProgram) { @@ -52698,17 +52992,17 @@ var ts; var nameSize = 0; var valueSize = 0; for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) { - var _a = statistics_1[_i], name_45 = _a.name, value = _a.value; - if (name_45.length > nameSize) { - nameSize = name_45.length; + var _a = statistics_1[_i], name = _a.name, value = _a.value; + if (name.length > nameSize) { + nameSize = name.length; } if (value.length > valueSize) { valueSize = value.length; } } for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) { - var _c = statistics_2[_b], name_46 = _c.name, value = _c.value; - ts.sys.write(padRight(name_46 + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + ts.sys.newLine); + var _c = statistics_2[_b], name = _c.name, value = _c.value; + ts.sys.write(padRight(name + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + ts.sys.newLine); } } function reportStatisticalValue(name, value) { @@ -52762,13 +53056,9 @@ var ts; var description = void 0; if (option.name === "lib") { description = getDiagnosticText(option.description); - var options = []; var element = option.element; var typeMap = element.type; - for (var key in typeMap) { - options.push("'" + key + "'"); - } - optionsDescriptionMap[description] = options; + optionsDescriptionMap.set(description, ts.arrayFrom(typeMap.keys()).map(function (key) { return "'" + key + "'"; })); } else { description = getDiagnosticText(option.description); @@ -52783,7 +53073,7 @@ var ts; for (var i = 0; i < usageColumn.length; i++) { var usage = usageColumn[i]; var description = descriptionColumn[i]; - var kindsList = optionsDescriptionMap[description]; + var kindsList = optionsDescriptionMap.get(description); output.push(usage + makePadding(marginLength - usage.length + 2) + description + ts.sys.newLine); if (kindsList) { output.push(makePadding(marginLength + 4)); @@ -52821,7 +53111,6 @@ var ts; } return; } - var _a; })(ts || (ts = {})); if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) { ts.sys.tryEnableSourceMapsForHost(); diff --git a/lib/tsserver.js b/lib/tsserver.js index 10cfa276fec34..3f20c86d0764e 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -98,32 +98,32 @@ var ts; var measures; function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } performance.mark = mark; function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; function enable() { @@ -145,19 +145,93 @@ var ts; ts.version = "2.2.0"; })(ts || (ts = {})); (function (ts) { - var createObject = Object.create; - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + function createDictionaryObject() { + var map = Object.create(null); map["__"] = undefined; delete map["__"]; + return map; + } + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -170,32 +244,27 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -209,6 +278,10 @@ var ts; return getCanonicalFileName(nonCanonicalizedPath); } ts.toPath = toPath; + function length(array) { + return array ? array.length : 0; + } + ts.length = length; function forEach(array, callback) { if (array) { for (var i = 0; i < array.length; i++) { @@ -249,6 +322,15 @@ var ts; return undefined; } ts.find = find; + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; function findMap(array, callback) { for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); @@ -470,21 +552,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -768,38 +847,46 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + function arrayFrom(iterator) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + ts.arrayFrom = arrayFrom; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } } - return false; + return undefined; + var _b; } - ts.someProperties = someProperties; - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; + ts.forEachEntry = forEachEntry; + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } } + return undefined; + var _b; } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachKey = forEachKey; + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); } - ts.appendProperty = appendProperty; + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -815,14 +902,6 @@ var ts; return t; } ts.assign = assign; - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -847,23 +926,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -890,27 +960,32 @@ var ts; return result; } ts.extend = extend; - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; function isArray(value) { return Array.isArray ? Array.isArray(value) : value instanceof Array; } @@ -1088,8 +1163,10 @@ var ts; if (b === undefined) return 1; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); return result < 0 ? -1 : result > 0 ? 1 : 0; } a = a.toUpperCase(); @@ -1471,36 +1548,26 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } var replaceWildcardCharacter = usage === "files" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther; var singleAsteriskRegexFragment = usage === "files" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther; var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; function isImplicitGlob(lastPathComponent) { return !/[.*?]/.test(lastPathComponent); } @@ -1570,6 +1637,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -1582,34 +1650,48 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); + } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -1625,14 +1707,14 @@ var ts; includeBasePaths.push(getIncludeBasePath(absolute)); } includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } }; for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -2079,32 +2161,32 @@ var ts; var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; function createWatchedFileSet() { var dirWatchers = ts.createMap(); - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -2116,16 +2198,19 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { var fileName = typeof relativeFileName !== "string" ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } @@ -2190,10 +2275,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -2870,6 +2955,7 @@ var ts; Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2880,6 +2966,7 @@ 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_2607", message: "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_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other 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_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -2928,6 +3015,7 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, @@ -3052,7 +3140,7 @@ var ts; Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'" }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -3067,6 +3155,7 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, @@ -3100,7 +3189,7 @@ var ts; Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'" }, File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, @@ -3234,9 +3323,10 @@ var ts; Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: {0}" }, Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, @@ -3252,7 +3342,7 @@ var ts; return token >= 70; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ + var textToToken = ts.createMapFromTemplate({ "abstract": 116, "any": 118, "as": 117, @@ -3276,7 +3366,7 @@ var ts; "false": 85, "finally": 86, "for": 87, - "from": 138, + "from": 139, "function": 88, "get": 124, "if": 89, @@ -3294,27 +3384,28 @@ var ts; "new": 93, "null": 94, "number": 132, + "object": 133, "package": 110, "private": 111, "protected": 112, "public": 113, "readonly": 130, "require": 131, - "global": 139, + "global": 140, "return": 95, - "set": 133, + "set": 134, "static": 114, - "string": 134, + "string": 135, "super": 96, "switch": 97, - "symbol": 135, + "symbol": 136, "this": 98, "throw": 99, "true": 100, "try": 101, - "type": 136, + "type": 137, "typeof": 102, - "undefined": 137, + "undefined": 138, "var": 103, "void": 104, "while": 105, @@ -3322,7 +3413,7 @@ var ts; "yield": 115, "async": 119, "await": 120, - "of": 140, + "of": 141, "{": 16, "}": 17, "(": 18, @@ -3417,9 +3508,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; - } + source.forEach(function (value, name) { + result[value] = name; + }); return result; } var tokenStrings = makeReverseMap(textToToken); @@ -3428,7 +3519,7 @@ var ts; } ts.tokenToString = tokenToString; function stringToToken(s) { - return textToToken[s]; + return textToToken.get(s); } ts.stringToToken = stringToToken; function computeLineStarts(text) { @@ -3488,7 +3579,6 @@ var ts; return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -4147,8 +4237,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= 97 && ch <= 122) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = 70; @@ -4858,12 +4951,13 @@ var ts; }, { name: "jsx", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "preserve": 1, + "react-native": 3, "react": 2 }), paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, }, { name: "reactNamespace", @@ -4893,7 +4987,7 @@ var ts; { name: "module", shortName: "m", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "none": ts.ModuleKind.None, "commonjs": ts.ModuleKind.CommonJS, "amd": ts.ModuleKind.AMD, @@ -4907,7 +5001,7 @@ var ts; }, { name: "newLine", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "crlf": 0, "lf": 1 }), @@ -5004,8 +5098,8 @@ var ts; shortName: "p", type: "string", isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY }, { name: "removeComments", @@ -5055,7 +5149,7 @@ var ts; { name: "target", shortName: "t", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es3": 0, "es5": 1, "es6": 2, @@ -5092,7 +5186,7 @@ var ts; }, { name: "moduleResolution", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "node": ts.ModuleResolutionKind.NodeJs, "classic": ts.ModuleResolutionKind.Classic, }), @@ -5197,7 +5291,7 @@ var ts; type: "list", element: { name: "lib", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es5": "lib.es5.d.ts", "es6": "lib.es2015.d.ts", "es2015": "lib.es2015.d.ts", @@ -5297,9 +5391,9 @@ var ts; var optionNameMap = ts.createMap(); var shortOptionNames = ts.createMap(); ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; @@ -5307,7 +5401,7 @@ var ts; } ts.getOptionNameMap = getOptionNameMap; function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; @@ -5356,11 +5450,12 @@ var ts; } else if (s.charCodeAt(0) === 45) { s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); - if (s in shortOptionNames) { - s = shortOptionNames[s]; + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - var opt = optionNameMap[s]; + var opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -5486,19 +5581,18 @@ var ts; } } function getNameOfCompilerOptionValue(value, customTypeMap) { - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { return key; } - } - return undefined; + }); } function serializeCompilerOptions(options) { - var result = ts.createMap(); + var result = {}; var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_5 in options) { - if (ts.hasProperty(options, name_5)) { - switch (name_5) { + for (var name in options) { + if (ts.hasProperty(options, name)) { + switch (name) { case "init": case "watch": case "version": @@ -5506,12 +5600,12 @@ var ts; case "project": break; default: - var value = options[name_5]; - var optionDefinition = optionsNameMap[name_5.toLowerCase()]; + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { - result[name_5] = value; + result[name] = value; } else { if (optionDefinition.type === "list") { @@ -5520,10 +5614,10 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_5] = convertedValue; + result[name] = convertedValue; } else { - result[name_5] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -5730,8 +5824,8 @@ var ts; } var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; + var opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -5765,8 +5859,9 @@ var ts; } function convertJsonOptionOfCustomType(opt, value, errors) { var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + var val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -5800,7 +5895,7 @@ var ts; for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } if (include && include.length > 0) { @@ -5811,14 +5906,13 @@ var ts; } removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); return { fileNames: literalFiles.concat(wildcardFiles), wildcardDirectories: wildcardDirectories @@ -5826,8 +5920,8 @@ var ts; } function validateSpecs(specs, errors, allowTrailingRecursion) { var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } @@ -5846,7 +5940,7 @@ var ts; function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); + var wildcardDirectories = {}; if (include !== undefined) { var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { @@ -5867,14 +5961,16 @@ var ts; } } } - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } } } - } + ; } return wildcardDirectories; } @@ -5897,7 +5993,7 @@ var ts; for (var i = 0; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i]; var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -5909,13 +6005,9 @@ var ts; for (var i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i]; var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - function addFileToOutput(output, file) { - output.push(file); - return output; - } function caseSensitiveKeyMapper(key) { return key; } @@ -5951,7 +6043,7 @@ var ts; }); if (!safeList) { var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMap(result.config) : EmptySafeList; + safeList = result.config ? ts.createMapFromTemplate(result.config) : EmptySafeList; } var filesToWatch = []; var searchDirs = []; @@ -5976,31 +6068,31 @@ var ts; if (unresolvedImports) { for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { var moduleId = unresolvedImports_1[_a]; - var typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; + var typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); } } } - for (var name_6 in packageNameToTypingLocation) { - if (name_6 in inferredTypings && !inferredTypings[name_6]) { - inferredTypings[name_6] = packageNameToTypingLocation[name_6]; + packageNameToTypingLocation.forEach(function (typingLocation, name) { + if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { + inferredTypings.set(name, typingLocation); } - } + }); for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { var excludeTypingName = exclude_1[_b]; - delete inferredTypings[excludeTypingName]; + inferredTypings.delete(excludeTypingName); } var newTypingNames = []; var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); + inferredTypings.forEach(function (inferred, typing) { + if (inferred !== undefined) { + cachedTypingPaths.push(inferred); } else { newTypingNames.push(typing); } - } + }); return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; function mergeTypings(typingNames) { if (!typingNames) { @@ -6008,8 +6100,8 @@ var ts; } for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; + if (!inferredTypings.has(typing)) { + inferredTypings.set(typing, undefined); } } } @@ -6039,7 +6131,7 @@ var ts; var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); if (safeList !== EmptySafeList) { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return safeList.has(f); })); } var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; }); if (hasJsxFile) { @@ -6072,7 +6164,7 @@ var ts; } if (packageJson.typings) { var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; + inferredTypings.set(packageJson.name, absolutePath); } else { typingNames.push(packageJson.name); @@ -6347,9 +6439,10 @@ var ts; if (!moduleHasNonRelativeName(nonRelativeModuleName)) { return undefined; } - var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); if (!perModuleNameCache) { - moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); } return perModuleNameCache; } @@ -6369,12 +6462,12 @@ var ts; var commonPrefix = getCommonPrefix(path, resolvedFileName); var current = path; while (true) { - var parent_1 = ts.getDirectoryPath(current); - if (parent_1 === current || directoryPathMap.contains(parent_1)) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { break; } - directoryPathMap.set(parent_1, result); - current = parent_1; + directoryPathMap.set(parent, result); + current = parent; if (current == commonPrefix) { break; } @@ -6405,7 +6498,7 @@ var ts; } var containingDirectory = ts.getDirectoryPath(containingFile); var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); - var result = perFolderCache && perFolderCache[moduleName]; + var result = perFolderCache && perFolderCache.get(moduleName); if (result) { if (traceEnabled) { trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); @@ -6433,7 +6526,7 @@ var ts; break; } if (perFolderCache) { - perFolderCache[moduleName] = result; + perFolderCache.set(moduleName, result); var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); if (perModuleNameCache) { perModuleNameCache.set(containingDirectory, result); @@ -6916,25 +7009,25 @@ var ts; } ts.getFullWidth = getFullWidth; function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); } ts.hasResolvedModule = hasResolvedModule; function getResolvedModule(sourceFile, moduleNameText) { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; } ts.getResolvedModule = getResolvedModule; function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = ts.createMap(); } - sourceFile.resolvedModules[moduleNameText] = resolvedModule; + sourceFile.resolvedModules.set(moduleNameText, resolvedModule); } ts.setResolvedModule = setResolvedModule; function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { if (!sourceFile.resolvedTypeReferenceDirectiveNames) { sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap(); } - sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective); } ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; function moduleResolutionIsEqualTo(oldResolution, newResolution) { @@ -6953,7 +7046,7 @@ var ts; } for (var i = 0; i < names.length; i++) { var newResolution = newResolutions[i]; - var oldResolution = oldResolutions && oldResolutions[names[i]]; + var oldResolution = oldResolutions && oldResolutions.get(names[i]); var changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; @@ -6980,7 +7073,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 262) { + while (node && node.kind !== 263) { node = node.parent; } return node; @@ -6988,11 +7081,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 205: - case 233: - case 212: + case 206: + case 234: case 213: case 214: + case 215: return true; } return false; @@ -7057,18 +7150,18 @@ var ts; if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 293 && node._children.length > 0) { + if (node.kind === 294 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 263 && node.kind <= 289; + return node.kind >= 264 && node.kind <= 293; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 279 && node.kind <= 292; + return node.kind >= 280 && node.kind <= 293; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -7128,18 +7221,36 @@ var ts; } ts.getLiteralText = getLiteralText; function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 && text.length > 1) { + return node.kind === 8 + && (getNumericLiteralFlags(text, 6) & 6) !== 0; + } + ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; + function getNumericLiteralFlags(text, hint) { + if (text.length > 1) { switch (text.charCodeAt(1)) { case 98: case 66: + return 2; case 111: case 79: - return true; + return 4; + case 120: + case 88: + return 1; + } + if (hint & 8) { + for (var i = text.length - 1; i >= 0; i--) { + switch (text.charCodeAt(i)) { + case 101: + case 69: + return 8; + } + } } } - return false; + return 0; } - ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; + ts.getNumericLiteralFlags = getNumericLiteralFlags; function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; } @@ -7162,11 +7273,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 224 && node.parent.kind === 257; + return node.kind === 225 && node.parent.kind === 258; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 231 && + return node && node.kind === 232 && (node.name.kind === 9 || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -7175,11 +7286,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return node.kind === 231 && (!node.body); + return node && node.kind === 232 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 262 || - node.kind === 231 || + return node.kind === 263 || + node.kind === 232 || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -7192,9 +7303,9 @@ var ts; return false; } switch (node.parent.kind) { - case 262: + case 263: return ts.isExternalModule(node.parent); - case 232: + case 233: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -7206,22 +7317,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 262: - case 233: - case 257: - case 231: - case 212: + case 263: + case 234: + case 258: + case 232: case 213: case 214: - case 150: - case 149: + case 215: case 151: + case 150: case 152: - case 226: - case 184: + case 153: + case 227: case 185: + case 186: return true; - case 205: + case 206: return parentNode && !isFunctionLike(parentNode); } return false; @@ -7248,7 +7359,7 @@ var ts; case 9: case 8: return name.text; - case 142: + case 143: if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } @@ -7260,9 +7371,9 @@ var ts; switch (name.kind) { case 70: return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name); - case 141: + case 142: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 177: + case 178: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -7299,7 +7410,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 205) { + if (node.body && node.body.kind === 206) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -7311,29 +7422,29 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 262: + case 263: 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 224: - case 174: - case 227: - case 197: + case 225: + case 175: case 228: + case 198: + case 229: + case 232: case 231: - case 230: - case 261: - case 226: - case 184: - case 149: - case 151: + case 262: + case 227: + case 185: + case 150: case 152: - case 229: + case 153: + case 230: errorNode = node.name; break; - case 185: + case 186: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -7354,7 +7465,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 230 && isConst(node); + return node.kind === 231 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -7367,11 +7478,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 179 && n.expression.kind === 96; + return n.kind === 180 && n.expression.kind === 96; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 208 + return node.kind === 209 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; @@ -7384,10 +7495,10 @@ var ts; } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 144 || - node.kind === 143 || - node.kind === 184 || - node.kind === 185) ? + var commentRanges = (node.kind === 145 || + node.kind === 144 || + node.kind === 185 || + node.kind === 186) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, function (comment) { @@ -7401,69 +7512,69 @@ var ts; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (156 <= node.kind && node.kind <= 171) { + if (157 <= node.kind && node.kind <= 172) { return true; } switch (node.kind) { case 118: case 132: - case 134: - case 121: case 135: - case 137: + case 121: + case 136: + case 138: case 129: return true; case 104: - return node.parent.kind !== 188; - case 199: + return node.parent.kind !== 189; + case 200: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 70: - if (node.parent.kind === 141 && node.parent.right === node) { + if (node.parent.kind === 142 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 177 && node.parent.name === node) { + else if (node.parent.kind === 178 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 70 || node.kind === 141 || node.kind === 177, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 141: - case 177: + ts.Debug.assert(node.kind === 70 || node.kind === 142 || node.kind === 178, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 142: + case 178: case 98: - var parent_2 = node.parent; - if (parent_2.kind === 160) { + var parent = node.parent; + if (parent.kind === 161) { return false; } - if (156 <= parent_2.kind && parent_2.kind <= 171) { + if (157 <= parent.kind && parent.kind <= 172) { return true; } - switch (parent_2.kind) { - case 199: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); - case 143: - return node === parent_2.constraint; - case 147: - case 146: + switch (parent.kind) { + case 200: + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 144: - case 224: - return node === parent_2.type; - case 226: - case 184: + return node === parent.constraint; + case 148: + case 147: + case 145: + case 225: + return node === parent.type; + case 227: case 185: + case 186: + case 151: case 150: case 149: - case 148: - case 151: case 152: - return node === parent_2.type; case 153: + return node === parent.type; case 154: case 155: - return node === parent_2.type; - case 182: - return node === parent_2.type; - case 179: + case 156: + return node === parent.type; + case 183: + return node === parent.type; case 180: - return parent_2.typeArguments && ts.indexOf(parent_2.typeArguments, node) >= 0; case 181: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 182: return false; } } @@ -7481,30 +7592,30 @@ var ts; } ts.isChildOfNodeWithKind = isChildOfNodeWithKind; function isPrefixUnaryExpression(node) { - return node.kind === 190; + return node.kind === 191; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 217: + case 218: return visitor(node); - case 233: - case 205: - case 209: + case 234: + case 206: case 210: case 211: case 212: case 213: case 214: - case 218: + case 215: case 219: - case 254: - case 255: case 220: - case 222: - case 257: + case 255: + case 256: + case 221: + case 223: + case 258: return ts.forEachChild(node, traverse); } } @@ -7514,24 +7625,24 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 195: + case 196: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 230: - case 228: case 231: case 229: - case 227: - case 197: + case 232: + case 230: + case 228: + case 198: return; default: if (isFunctionLike(node)) { - var name_7 = node.name; - if (name_7 && name_7.kind === 142) { - traverse(name_7.expression); + var name = node.name; + if (name && name.kind === 143) { + traverse(name.expression); return; } } @@ -7543,10 +7654,10 @@ var ts; } ts.forEachYieldExpression = forEachYieldExpression; function getRestParameterElementType(node) { - if (node && node.kind === 162) { + if (node && node.kind === 163) { return node.elementType; } - else if (node && node.kind === 157) { + else if (node && node.kind === 158) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -7557,14 +7668,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 174: - case 261: - case 144: - case 258: - case 147: - case 146: + case 175: + case 262: + case 145: case 259: - case 224: + case 148: + case 147: + case 260: + case 225: return true; } } @@ -7572,11 +7683,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 151 || node.kind === 152); + return node && (node.kind === 152 || node.kind === 153); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 227 || node.kind === 197); + return node && (node.kind === 228 || node.kind === 198); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -7585,19 +7696,19 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 150: - case 184: - case 226: + case 151: case 185: + case 227: + case 186: + case 150: case 149: - case 148: - case 151: case 152: case 153: case 154: case 155: - case 158: + case 156: case 159: + case 160: return true; } return false; @@ -7605,13 +7716,13 @@ var ts; ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 226: - case 184: + case 153: + case 227: + case 185: return true; } return false; @@ -7619,13 +7730,13 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 212: case 213: case 214: - case 210: + case 215: case 211: + case 212: return true; - case 220: + case 221: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -7636,7 +7747,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 220) { + if (node.statement.kind !== 221) { return node.statement; } node = node.statement; @@ -7644,17 +7755,17 @@ var ts; } ts.unwrapInnermostStatmentOfLabel = unwrapInnermostStatmentOfLabel; function isFunctionBlock(node) { - return node && node.kind === 205 && isFunctionLike(node.parent); + return node && node.kind === 206 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 149 && node.parent.kind === 176; + return node && node.kind === 150 && node.parent.kind === 177; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { - return node.kind === 149 && - (node.parent.kind === 176 || - node.parent.kind === 197); + return node.kind === 150 && + (node.parent.kind === 177 || + node.parent.kind === 198); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -7690,39 +7801,39 @@ var ts; return undefined; } switch (node.kind) { - case 142: + case 143: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 185: + case 186: if (!includeArrowFunctions) { continue; } - case 226: - case 184: - case 231: - case 147: - case 146: - case 149: + case 227: + case 185: + case 232: case 148: + case 147: case 150: + case 149: case 151: case 152: case 153: case 154: case 155: - case 230: - case 262: + case 156: + case 231: + case 263: return node; } } @@ -7732,9 +7843,9 @@ var ts; var container = getThisContainer(node, false); if (container) { switch (container.kind) { - case 150: - case 226: - case 184: + case 151: + case 227: + case 185: return container; } } @@ -7748,25 +7859,25 @@ var ts; return node; } switch (node.kind) { - case 142: + case 143: node = node.parent; break; - case 226: - case 184: + case 227: case 185: + case 186: if (!stopOnFunctions) { continue; } - case 147: - case 146: - case 149: case 148: + case 147: case 150: + case 149: case 151: case 152: + case 153: return node; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { @@ -7778,36 +7889,36 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 184 || func.kind === 185) { + if (func.kind === 185 || func.kind === 186) { var prev = func; - var parent_3 = func.parent; - while (parent_3.kind === 183) { - prev = parent_3; - parent_3 = parent_3.parent; + var parent = func.parent; + while (parent.kind === 184) { + prev = parent; + parent = parent.parent; } - if (parent_3.kind === 179 && parent_3.expression === prev) { - return parent_3; + if (parent.kind === 180 && parent.expression === prev) { + return parent; } } } ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; function isSuperProperty(node) { var kind = node.kind; - return (kind === 177 || kind === 178) + return (kind === 178 || kind === 179) && node.expression.kind === 96; } ts.isSuperProperty = isSuperProperty; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 157: - case 273: + case 158: + case 274: return node.typeName; - case 199: + case 200: return isEntityNameExpression(node.expression) ? node.expression : undefined; case 70: - case 141: + case 142: return node; } return undefined; @@ -7815,10 +7926,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function isCallLikeExpression(node) { switch (node.kind) { - case 179: case 180: case 181: - case 145: + case 182: + case 146: return true; default: return false; @@ -7826,7 +7937,7 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function getInvokedExpression(node) { - if (node.kind === 181) { + if (node.kind === 182) { return node.tag; } return node.expression; @@ -7834,21 +7945,21 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 227: + case 228: return true; - case 147: - return node.parent.kind === 227; - case 151: + case 148: + return node.parent.kind === 228; case 152: - case 149: + case 153: + case 150: return node.body !== undefined - && node.parent.kind === 227; - case 144: + && node.parent.kind === 228; + case 145: return node.parent.body !== undefined - && (node.parent.kind === 150 - || node.parent.kind === 149 - || node.parent.kind === 152) - && node.parent.parent.kind === 227; + && (node.parent.kind === 151 + || node.parent.kind === 150 + || node.parent.kind === 153) + && node.parent.parent.kind === 228; } return false; } @@ -7864,19 +7975,19 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 227: + case 228: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 149: - case 152: + case 150: + case 153: return ts.forEach(node.parameters, nodeIsDecorated); } } ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 249 || - parent.kind === 248 || - parent.kind === 250) { + if (parent.kind === 250 || + parent.kind === 249 || + parent.kind === 251) { return parent.tagName === node; } return false; @@ -7890,96 +8001,96 @@ var ts; case 100: case 85: case 11: - case 175: case 176: case 177: case 178: case 179: case 180: case 181: - case 200: case 182: case 201: case 183: + case 202: case 184: - case 197: case 185: - case 188: + case 198: case 186: + case 189: case 187: - case 190: + case 188: case 191: case 192: case 193: - case 196: case 194: + case 197: + case 195: case 12: - case 198: - case 247: + case 199: case 248: - case 195: - case 189: - case 202: + case 249: + case 196: + case 190: + case 203: return true; - case 141: - while (node.parent.kind === 141) { + case 142: + while (node.parent.kind === 142) { node = node.parent; } - return node.parent.kind === 160 || isJSXTagName(node); + return node.parent.kind === 161 || isJSXTagName(node); case 70: - if (node.parent.kind === 160 || isJSXTagName(node)) { + if (node.parent.kind === 161 || isJSXTagName(node)) { return true; } case 8: case 9: case 98: - var parent_4 = node.parent; - switch (parent_4.kind) { - case 224: - case 144: + var parent = node.parent; + switch (parent.kind) { + case 225: + case 145: + case 148: case 147: - case 146: - case 261: - case 258: - case 174: - return parent_4.initializer === node; - case 208: + case 262: + case 259: + case 175: + return parent.initializer === node; case 209: case 210: case 211: - case 217: + case 212: case 218: case 219: - case 254: - case 221: - case 219: - return parent_4.expression === node; - case 212: - var forStatement = parent_4; - return (forStatement.initializer === node && forStatement.initializer.kind !== 225) || + case 220: + case 255: + case 222: + case 220: + return parent.expression === node; + case 213: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 226) || forStatement.condition === node || forStatement.incrementor === node; - case 213: case 214: - var forInStatement = parent_4; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 225) || + case 215: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 226) || forInStatement.expression === node; - case 182: - case 200: - return node === parent_4.expression; - case 203: - return node === parent_4.expression; - case 142: - return node === parent_4.expression; - case 145: + case 183: + case 201: + return node === parent.expression; + case 204: + return node === parent.expression; + case 143: + return node === parent.expression; + case 146: + case 254: case 253: - case 252: - case 260: + case 261: return true; - case 199: - return parent_4.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_4); + case 200: + return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: - if (isPartOfExpression(parent_4)) { + if (isPartOfExpression(parent)) { return true; } } @@ -7994,7 +8105,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 235 && node.moduleReference.kind === 246; + return node.kind === 236 && node.moduleReference.kind === 247; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -8003,7 +8114,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 235 && node.moduleReference.kind !== 246; + return node.kind === 236 && node.moduleReference.kind !== 247; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -8015,7 +8126,7 @@ var ts; } ts.isInJavaScriptFile = isInJavaScriptFile; function isRequireCall(expression, checkArgumentIsStringLiteral) { - var isRequire = expression.kind === 179 && + var isRequire = expression.kind === 180 && expression.expression.kind === 70 && expression.expression.text === "require" && expression.arguments.length === 1; @@ -8027,9 +8138,9 @@ var ts; } ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 224) { + if (s.valueDeclaration && s.valueDeclaration.kind === 225) { var declaration = s.valueDeclaration; - return declaration.initializer && declaration.initializer.kind === 184; + return declaration.initializer && declaration.initializer.kind === 185; } return false; } @@ -8038,11 +8149,11 @@ var ts; if (!isInJavaScriptFile(expression)) { return 0; } - if (expression.kind !== 192) { + if (expression.kind !== 193) { return 0; } var expr = expression; - if (expr.operatorToken.kind !== 57 || expr.left.kind !== 177) { + if (expr.operatorToken.kind !== 57 || expr.left.kind !== 178) { return 0; } var lhs = expr.left; @@ -8058,7 +8169,7 @@ var ts; else if (lhs.expression.kind === 98) { return 4; } - else if (lhs.expression.kind === 177) { + else if (lhs.expression.kind === 178) { var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 70) { var innerPropertyAccessIdentifier = innerPropertyAccess.expression; @@ -8074,35 +8185,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 236) { + if (node.kind === 237) { return node.moduleSpecifier; } - if (node.kind === 235) { + if (node.kind === 236) { var reference = node.moduleReference; - if (reference.kind === 246) { + if (reference.kind === 247) { return reference.expression; } } - if (node.kind === 242) { + if (node.kind === 243) { return node.moduleSpecifier; } - if (node.kind === 231 && node.name.kind === 9) { + if (node.kind === 232 && node.name.kind === 9) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 235) { + if (node.kind === 236) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 238) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 239) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 236 + return node.kind === 237 && node.importClause && !!node.importClause.name; } @@ -8110,13 +8221,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 144: + case 145: + case 150: case 149: - case 148: + case 260: case 259: - case 258: + case 148: case 147: - case 146: return node.questionToken !== undefined; } } @@ -8124,9 +8235,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 275 && + return node.kind === 276 && node.parameters.length > 0 && - node.parameters[0].type.kind === 277; + node.parameters[0].type.kind === 278; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { @@ -8139,7 +8250,7 @@ var ts; var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 282) { + if (doc.kind === 283) { if (doc.kind === kind) { result.push(doc); } @@ -8165,9 +8276,9 @@ var ts; var parent = node.parent; var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 206; + parent.parent.parent.kind === 207; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 206; + parent.parent.kind === 207; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -8175,19 +8286,19 @@ var ts; getJSDocsWorker(variableStatementNode); } var isSourceOfAssignmentExpressionStatement = parent && parent.parent && - parent.kind === 192 && + parent.kind === 193 && parent.operatorToken.kind === 57 && - parent.parent.kind === 208; + parent.parent.kind === 209; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 231 && - parent && parent.kind === 231; - var isPropertyAssignmentExpression = parent && parent.kind === 258; + var isModuleDeclaration = node.kind === 232 && + parent && parent.kind === 232; + var isPropertyAssignmentExpression = parent && parent.kind === 259; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } - if (node.kind === 144) { + if (node.kind === 145) { cache = ts.concatenate(cache, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { @@ -8201,17 +8312,17 @@ var ts; return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 282); + var tags = getJSDocTags(func, 283); if (!param.name) { var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 282; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 283; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70) { - var name_8 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 282 && tag.parameterName.text === name_8; }); + var name_1 = param.name.text; + return ts.filter(tags, function (tag) { return tag.kind === 283 && tag.parameterName.text === name_1; }); } else { return undefined; @@ -8219,8 +8330,8 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 284); - if (!tag && node.kind === 144) { + var tag = getFirstJSDocTag(node, 285); + if (!tag && node.kind === 145) { var paramTags = getJSDocParameterTags(node); if (paramTags) { tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); @@ -8230,15 +8341,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 281); + return getFirstJSDocTag(node, 282); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 283); + return getFirstJSDocTag(node, 284); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 285); + return getFirstJSDocTag(node, 286); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -8251,8 +8362,8 @@ var ts; ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { if (node && (node.flags & 65536)) { - if (node.type && node.type.kind === 276 || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 276; })) { + if (node.type && node.type.kind === 277 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 277; })) { return true; } } @@ -8267,28 +8378,33 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 192: + case 193: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 57 ? 1 : 2 : 0; - case 190: case 191: + case 192: var unaryOperator = parent.operator; return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0; - case 213: case 214: + case 215: return parent.initializer === node ? 1 : 0; - case 183: - case 175: - case 196: + case 184: + case 176: + case 197: node = parent; break; - case 259: + case 260: if (parent.name !== node) { return 0; } - case 258: + node = parent.parent; + break; + case 259: + if (parent.name === node) { + return 0; + } node = parent.parent; break; default: @@ -8303,14 +8419,14 @@ var ts; } ts.isAssignmentTarget = isAssignmentTarget; function isDeleteTarget(node) { - if (node.kind !== 177 && node.kind !== 178) { + if (node.kind !== 178 && node.kind !== 179) { return false; } node = node.parent; - while (node && node.kind === 183) { + while (node && node.kind === 184) { node = node.parent; } - return node && node.kind === 186; + return node && node.kind === 187; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -8324,7 +8440,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2) || (node.kind === 262 && node.isDeclarationFile)) { + if (hasModifier(node, 2) || (node.kind === 263 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -8337,7 +8453,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 240 || parent.kind === 244) { + if (parent.kind === 241 || parent.kind === 245) { if (parent.propertyName) { return true; } @@ -8350,48 +8466,48 @@ var ts; ts.isDeclarationName = isDeclarationName; function isLiteralComputedPropertyDeclarationName(node) { return (node.kind === 9 || node.kind === 8) && - node.parent.kind === 142 && + node.parent.kind === 143 && isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { + case 148: case 147: - case 146: + case 150: case 149: - case 148: - case 151: case 152: - case 261: - case 258: - case 177: + case 153: + case 262: + case 259: + case 178: return parent.name === node; - case 141: + case 142: if (parent.right === node) { - while (parent.kind === 141) { + while (parent.kind === 142) { parent = parent.parent; } - return parent.kind === 160; + return parent.kind === 161; } return false; - case 174: - case 240: + case 175: + case 241: return parent.propertyName === node; - case 244: + case 245: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 235 || - node.kind === 234 || - node.kind === 237 && !!node.name || - node.kind === 238 || - node.kind === 240 || - node.kind === 244 || - node.kind === 241 && exportAssignmentIsAlias(node); + return node.kind === 236 || + node.kind === 235 || + node.kind === 238 && !!node.name || + node.kind === 239 || + node.kind === 241 || + node.kind === 245 || + node.kind === 242 && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8477,7 +8593,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 71 <= token && token <= 140; + return 71 <= token && token <= 141; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -8499,7 +8615,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 142 && + return name.kind === 143 && !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } @@ -8509,10 +8625,10 @@ var ts; } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 144) { + if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 145) { return name.text; } - if (name.kind === 142) { + if (name.kind === 143) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -8557,11 +8673,11 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 144; + return root.kind === 145; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 174) { + while (node.kind === 175) { node = node.parent.parent; } return node; @@ -8569,15 +8685,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 150 - || kind === 184 - || kind === 226 + return kind === 151 || kind === 185 - || kind === 149 - || kind === 151 + || kind === 227 + || kind === 186 + || kind === 150 || kind === 152 - || kind === 231 - || kind === 262; + || kind === 153 + || kind === 232 + || kind === 263; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -8628,23 +8744,23 @@ var ts; ts.getOriginalNodeId = getOriginalNodeId; function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 180: + case 181: return hasArguments ? 0 : 1; - case 190: - case 187: + case 191: case 188: - case 186: case 189: - case 193: - case 195: + case 187: + case 190: + case 194: + case 196: return 1; - case 192: + case 193: switch (operator) { case 39: case 57: @@ -8668,15 +8784,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 192) { + if (expression.kind === 193) { return expression.operatorToken.kind; } - else if (expression.kind === 190 || expression.kind === 191) { + else if (expression.kind === 191 || expression.kind === 192) { return expression.operator; } else { @@ -8694,36 +8810,36 @@ var ts; case 85: case 8: case 9: - case 175: case 176: - case 184: + case 177: case 185: - case 197: - case 247: + case 186: + case 198: case 248: + case 249: case 11: case 12: - case 194: - case 183: - case 198: + case 195: + case 184: + case 199: return 19; - case 181: - case 177: + case 182: case 178: + case 179: return 18; - case 180: + case 181: return hasArguments ? 18 : 17; - case 179: + case 180: return 17; - case 191: + case 192: return 16; - case 190: - case 187: + case 191: case 188: - case 186: case 189: + case 187: + case 190: return 15; - case 192: + case 193: switch (operatorKind) { case 50: case 51: @@ -8781,11 +8897,11 @@ var ts; default: return -1; } - case 193: + case 194: return 4; - case 195: - return 2; case 196: + return 2; + case 197: return 1; default: return -1; @@ -8808,21 +8924,15 @@ var ts; return modificationCount; } function reattachFileDiagnostics(newFile) { - if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { - return; - } - for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { - var diagnostic = _a[_i]; - diagnostic.file = newFile; - } + ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } function add(diagnostic) { var diagnostics; if (diagnostic.file) { - diagnostics = fileDiagnostics[diagnostic.file.fileName]; + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); if (!diagnostics) { diagnostics = []; - fileDiagnostics[diagnostic.file.fileName] = diagnostics; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); } } else { @@ -8839,16 +8949,16 @@ var ts; function getDiagnostics(fileName) { sortAndDeduplicate(); if (fileName) { - return fileDiagnostics[fileName] || []; + return fileDiagnostics.get(fileName) || []; } var allDiagnostics = []; function pushDiagnostic(d) { allDiagnostics.push(d); } ts.forEach(nonFileDiagnostics, pushDiagnostic); - for (var key in fileDiagnostics) { - ts.forEach(fileDiagnostics[key], pushDiagnostic); - } + fileDiagnostics.forEach(function (diagnostics) { + ts.forEach(diagnostics, pushDiagnostic); + }); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function sortAndDeduplicate() { @@ -8857,14 +8967,14 @@ var ts; } diagnosticsModified = false; nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (var key in fileDiagnostics) { - fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); - } + fileDiagnostics.forEach(function (diagnostics, key) { + fileDiagnostics.set(key, ts.sortAndDeduplicateDiagnostics(diagnostics)); + }); } } ts.createDiagnosticCollection = createDiagnosticCollection; var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = ts.createMap({ + var escapedCharsMap = ts.createMapFromTemplate({ "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -8883,7 +8993,7 @@ var ts; } ts.escapeString = escapeString; function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); @@ -9027,129 +9137,62 @@ var ts; ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; function getSourceFilesToEmit(host, targetSourceFile) { var options = host.getCompilerOptions(); + var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); }; if (options.outFile || options.out) { var moduleKind = ts.getEmitModuleKind(options); - var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; - var sourceFiles = getAllEmittableSourceFiles(); - return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule); + var moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; + return ts.filter(host.getSourceFiles(), function (sourceFile) { + return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); + }); } else { - var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile]; - return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); }); - } - function getAllEmittableSourceFiles() { - return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles(); + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); }); } } ts.getSourceFilesToEmit = getSourceFilesToEmit; - function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) { - return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); }); - } - ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory; - function isNonDeclarationFile(sourceFile) { - return !isDeclarationFile(sourceFile); - } - function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) { - return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); + function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) { + return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !isDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); } - function isBundleEmitNonExternalModule(sourceFile) { - return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile); - } - function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) { + ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted; + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { + var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); var options = host.getCompilerOptions(); if (options.outFile || options.out) { - onBundledEmit(sourceFiles); + if (sourceFiles.length) { + var jsFilePath = options.outFile || options.out; + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFiles, true, emitOnlyDtsFiles); + } } else { for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { var sourceFile = sourceFiles_2[_i]; - if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { - onSingleFileEmit(host, sourceFile); - } - } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], false); - } - function onBundledEmit(sourceFiles) { - if (sourceFiles.length) { - var jsFilePath = options.outFile || options.out; + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, true); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, [sourceFile], false, emitOnlyDtsFiles); } } } - ts.forEachTransformedEmitFile = forEachTransformedEmitFile; + ts.forEachEmittedFile = forEachEmittedFile; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) { - var options = host.getCompilerOptions(); - if (options.outFile || options.out) { - onBundledEmit(host); - } - else { - var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile]; - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; - if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) { - onSingleFileEmit(host, sourceFile); + function getOutputExtension(sourceFile, options) { + if (options.jsx === 1) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + return ".jsx"; } } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: declarationFilePath - }; - action(emitFileNames, [sourceFile], false, emitOnlyDtsFiles); - } - function onBundledEmit(host) { - var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) && - !host.isSourceFileFromExternalLibrary(sourceFile) && - (!ts.isExternalModule(sourceFile) || - !!ts.getEmitModuleKind(options)); }); - if (bundledSources.length) { - var jsFilePath = options.outFile || options.out; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined - }; - action(emitFileNames, bundledSources, true, emitOnlyDtsFiles); + else if (sourceFile.languageVariant === 1) { + return ".jsx"; } } + return ".js"; } - ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); var commonSourceDirectory = host.getCommonSourceDirectory(); @@ -9174,7 +9217,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 150 && nodeIsPresent(member.body)) { + if (member.kind === 151 && nodeIsPresent(member.body)) { return member; } }); @@ -9215,10 +9258,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 151) { + if (accessor.kind === 152) { getAccessor = accessor; } - else if (accessor.kind === 152) { + else if (accessor.kind === 153) { setAccessor = accessor; } else { @@ -9227,7 +9270,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 151 || member.kind === 152) + if ((member.kind === 152 || member.kind === 153) && hasModifier(member, 32) === hasModifier(accessor, 32)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -9238,10 +9281,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 151 && !getAccessor) { + if (member.kind === 152 && !getAccessor) { getAccessor = member; } - if (member.kind === 152 && !setAccessor) { + if (member.kind === 153 && !setAccessor) { setAccessor = member; } } @@ -9459,7 +9502,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 199 && + if (node.kind === 200 && node.parent.token === 84 && isClassLike(node.parent.parent)) { return node.parent.parent; @@ -9477,8 +9520,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, true)) { var kind = node.left.kind; - return kind === 176 - || kind === 175; + return kind === 177 + || kind === 176; } return false; } @@ -9504,29 +9547,33 @@ var ts; ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isEntityNameExpression(node) { return node.kind === 70 || - node.kind === 177 && isEntityNameExpression(node.expression); + node.kind === 178 && isEntityNameExpression(node.expression); } ts.isEntityNameExpression = isEntityNameExpression; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 141 && node.parent.right === node) || - (node.parent.kind === 177 && node.parent.name === node); + return (node.parent.kind === 142 && node.parent.right === node) || + (node.parent.kind === 178 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 176) { + if (kind === 177) { return expression.properties.length === 0; } - if (kind === 175) { + if (kind === 176) { return expression.elements.length === 0; } return false; } ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512) ? symbol.valueDeclaration.localSymbol : undefined; + return isExportDefaultSymbol(symbol) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function isExportDefaultSymbol(symbol) { + return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512); + } + ts.isExportDefaultSymbol = isExportDefaultSymbol; function tryExtractTypeScriptExtension(fileName) { return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); } @@ -9618,39 +9665,39 @@ var ts; || kind === 94) { return true; } - else if (kind === 177) { + else if (kind === 178) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 178) { + else if (kind === 179) { return isSimpleExpressionWorker(node.expression, depth + 1) && isSimpleExpressionWorker(node.argumentExpression, depth + 1); } - else if (kind === 190 - || kind === 191) { + else if (kind === 191 + || kind === 192) { return isSimpleExpressionWorker(node.operand, depth + 1); } - else if (kind === 192) { + else if (kind === 193) { return node.operatorToken.kind !== 39 && isSimpleExpressionWorker(node.left, depth + 1) && isSimpleExpressionWorker(node.right, depth + 1); } - else if (kind === 193) { + else if (kind === 194) { return isSimpleExpressionWorker(node.condition, depth + 1) && isSimpleExpressionWorker(node.whenTrue, depth + 1) && isSimpleExpressionWorker(node.whenFalse, depth + 1); } - else if (kind === 188 - || kind === 187 - || kind === 186) { + else if (kind === 189 + || kind === 188 + || kind === 187) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 175) { + else if (kind === 176) { return node.elements.length === 0; } - else if (kind === 176) { + else if (kind === 177) { return node.properties.length === 0; } - else if (kind === 179) { + else if (kind === 180) { if (!isSimpleExpressionWorker(node.expression, depth + 1)) { return false; } @@ -9665,16 +9712,19 @@ var ts; } return false; } - var syntaxKindCache = ts.createMap(); + var syntaxKindCache = []; function formatSyntaxKind(kind) { var syntaxKindEnum = ts.SyntaxKind; if (syntaxKindEnum) { - if (syntaxKindCache[kind]) { - return syntaxKindCache[kind]; + var cached = syntaxKindCache[kind]; + if (cached !== undefined) { + return cached; } - for (var name_9 in syntaxKindEnum) { - if (syntaxKindEnum[name_9] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name_9 + ")"; + for (var name in syntaxKindEnum) { + if (syntaxKindEnum[name] === kind) { + var result = kind + " (" + name + ")"; + syntaxKindCache[kind] = result; + return result; } } } @@ -9760,8 +9810,8 @@ var ts; var parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 230: case 231: + case 232: return parseNode === parseNode.parent.name; } } @@ -9779,7 +9829,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 && declaration !== node) { + if (declaration.kind === 228 && declaration !== node) { return true; } } @@ -9831,7 +9881,7 @@ var ts; } ts.isIdentifier = isIdentifier; function isVoidExpression(node) { - return node.kind === 188; + return node.kind === 189; } ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { @@ -9843,16 +9893,16 @@ var ts; } ts.isModifier = isModifier; function isQualifiedName(node) { - return node.kind === 141; + return node.kind === 142; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 142; + return node.kind === 143; } ts.isComputedPropertyName = isComputedPropertyName; function isEntityName(node) { var kind = node.kind; - return kind === 141 + return kind === 142 || kind === 70; } ts.isEntityName = isEntityName; @@ -9861,7 +9911,7 @@ var ts; return kind === 70 || kind === 9 || kind === 8 - || kind === 142; + || kind === 143; } ts.isPropertyName = isPropertyName; function isModuleName(node) { @@ -9873,101 +9923,101 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 70 - || kind === 172 - || kind === 173; + || kind === 173 + || kind === 174; } ts.isBindingName = isBindingName; function isTypeParameter(node) { - return node.kind === 143; + return node.kind === 144; } ts.isTypeParameter = isTypeParameter; function isParameter(node) { - return node.kind === 144; + return node.kind === 145; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 145; + return node.kind === 146; } ts.isDecorator = isDecorator; function isMethodDeclaration(node) { - return node.kind === 149; + return node.kind === 150; } ts.isMethodDeclaration = isMethodDeclaration; function isClassElement(node) { var kind = node.kind; - return kind === 150 - || kind === 147 - || kind === 149 - || kind === 151 + return kind === 151 + || kind === 148 + || kind === 150 || kind === 152 - || kind === 155 - || kind === 204; + || kind === 153 + || kind === 156 + || kind === 205; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 258 - || kind === 259 + return kind === 259 || kind === 260 - || kind === 149 - || kind === 151 + || kind === 261 + || kind === 150 || kind === 152 - || kind === 245; + || kind === 153 + || kind === 246; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNodeKind(kind) { - return (kind >= 156 && kind <= 171) + return (kind >= 157 && kind <= 172) || kind === 118 || kind === 132 || kind === 121 - || kind === 134 || kind === 135 + || kind === 136 || kind === 104 || kind === 129 - || kind === 199; + || kind === 200; } function isTypeNode(node) { return isTypeNodeKind(node.kind); } ts.isTypeNode = isTypeNode; function isArrayBindingPattern(node) { - return node.kind === 173; + return node.kind === 174; } ts.isArrayBindingPattern = isArrayBindingPattern; function isObjectBindingPattern(node) { - return node.kind === 172; + return node.kind === 173; } ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 173 - || kind === 172; + return kind === 174 + || kind === 173; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 175 - || kind === 176; + return kind === 176 + || kind === 177; } ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { - return node.kind === 174; + return node.kind === 175; } ts.isBindingElement = isBindingElement; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 174 - || kind === 198; + return kind === 175 + || kind === 199; } ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 224: - case 144: - case 174: + case 225: + case 145: + case 175: return true; } return false; @@ -9980,8 +10030,8 @@ var ts; ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 172: - case 176: + case 173: + case 177: return true; } return false; @@ -9989,94 +10039,94 @@ var ts; ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 173: - case 175: + case 174: + case 176: return true; } return false; } ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; function isArrayLiteralExpression(node) { - return node.kind === 175; + return node.kind === 176; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 176; + return node.kind === 177; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 177; + return node.kind === 178; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 178; + return node.kind === 179; } ts.isElementAccessExpression = isElementAccessExpression; function isBinaryExpression(node) { - return node.kind === 192; + return node.kind === 193; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 193; + return node.kind === 194; } ts.isConditionalExpression = isConditionalExpression; function isCallExpression(node) { - return node.kind === 179; + return node.kind === 180; } ts.isCallExpression = isCallExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 194 + return kind === 195 || kind === 12; } ts.isTemplateLiteral = isTemplateLiteral; function isSpreadExpression(node) { - return node.kind === 196; + return node.kind === 197; } ts.isSpreadExpression = isSpreadExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 199; + return node.kind === 200; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isLeftHandSideExpressionKind(kind) { - return kind === 177 - || kind === 178 - || kind === 180 + return kind === 178 || kind === 179 - || kind === 247 - || kind === 248 || kind === 181 - || kind === 175 - || kind === 183 + || kind === 180 + || kind === 248 + || kind === 249 + || kind === 182 || kind === 176 - || kind === 197 || kind === 184 + || kind === 177 + || kind === 198 + || kind === 185 || kind === 70 || kind === 11 || kind === 8 || kind === 9 || kind === 12 - || kind === 194 + || kind === 195 || kind === 85 || kind === 94 || kind === 98 || kind === 100 || kind === 96 - || kind === 201 - || kind === 202; + || kind === 202 + || kind === 203; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isUnaryExpressionKind(kind) { - return kind === 190 - || kind === 191 - || kind === 186 + return kind === 191 + || kind === 192 || kind === 187 || kind === 188 || kind === 189 - || kind === 182 + || kind === 190 + || kind === 183 || isLeftHandSideExpressionKind(kind); } function isUnaryExpression(node) { @@ -10084,13 +10134,13 @@ var ts; } ts.isUnaryExpression = isUnaryExpression; function isExpressionKind(kind) { - return kind === 193 - || kind === 195 - || kind === 185 - || kind === 192 + return kind === 194 || kind === 196 - || kind === 200 - || kind === 198 + || kind === 186 + || kind === 193 + || kind === 197 + || kind === 201 + || kind === 199 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10099,16 +10149,16 @@ var ts; ts.isExpression = isExpression; function isAssertionExpression(node) { var kind = node.kind; - return kind === 182 - || kind === 200; + return kind === 183 + || kind === 201; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 295; + return node.kind === 296; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 294; + return node.kind === 295; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10117,15 +10167,15 @@ var ts; } ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isOmittedExpression(node) { - return node.kind === 198; + return node.kind === 199; } ts.isOmittedExpression = isOmittedExpression; function isTemplateSpan(node) { - return node.kind === 203; + return node.kind === 204; } ts.isTemplateSpan = isTemplateSpan; function isBlock(node) { - return node.kind === 205; + return node.kind === 206; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -10143,121 +10193,121 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 224; + return node.kind === 225; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 225; + return node.kind === 226; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 233; + return node.kind === 234; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 232 - || kind === 231; + return kind === 233 + || kind === 232; } ts.isModuleBody = isModuleBody; function isImportEqualsDeclaration(node) { - return node.kind === 235; + return node.kind === 236; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 237; + return node.kind === 238; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 239 - || kind === 238; + return kind === 240 + || kind === 239; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 240; + return node.kind === 241; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 243; + return node.kind === 244; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 244; + return node.kind === 245; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 231 || node.kind === 230; + return node.kind === 232 || node.kind === 231; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 185 - || kind === 174 + return kind === 186 + || kind === 175 + || kind === 228 + || kind === 198 + || kind === 151 + || kind === 231 + || kind === 262 + || kind === 245 || kind === 227 - || kind === 197 + || kind === 185 + || kind === 152 + || kind === 238 + || kind === 236 + || kind === 241 + || kind === 229 || kind === 150 - || kind === 230 - || kind === 261 - || kind === 244 - || kind === 226 - || kind === 184 - || kind === 151 - || kind === 237 - || kind === 235 - || kind === 240 - || kind === 228 || kind === 149 + || kind === 232 + || kind === 235 + || kind === 239 + || kind === 145 + || kind === 259 || kind === 148 - || kind === 231 - || kind === 234 - || kind === 238 - || kind === 144 - || kind === 258 || kind === 147 - || kind === 146 - || kind === 152 - || kind === 259 - || kind === 229 - || kind === 143 - || kind === 224 - || kind === 286; + || kind === 153 + || kind === 260 + || kind === 230 + || kind === 144 + || kind === 225 + || kind === 287; } function isDeclarationStatementKind(kind) { - return kind === 226 - || kind === 245 - || kind === 227 + return kind === 227 + || kind === 246 || kind === 228 || kind === 229 || kind === 230 || kind === 231 + || kind === 232 + || kind === 237 || kind === 236 - || kind === 235 + || kind === 243 || kind === 242 - || kind === 241 - || kind === 234; + || kind === 235; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 216 + return kind === 217 + || kind === 216 + || kind === 224 + || kind === 211 + || kind === 209 + || kind === 208 + || kind === 214 || kind === 215 - || kind === 223 + || kind === 213 || kind === 210 - || kind === 208 + || kind === 221 + || kind === 218 + || kind === 220 + || kind === 222 + || kind === 223 || kind === 207 - || kind === 213 - || kind === 214 || kind === 212 - || kind === 209 - || kind === 220 - || kind === 217 || kind === 219 - || kind === 221 - || kind === 222 - || kind === 206 - || kind === 211 - || kind === 218 - || kind === 294 - || kind === 297 - || kind === 296; + || kind === 295 + || kind === 298 + || kind === 297; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10275,87 +10325,87 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 205; + || kind === 206; } ts.isStatement = isStatement; function isModuleReference(node) { var kind = node.kind; - return kind === 246 - || kind === 141 + return kind === 247 + || kind === 142 || kind === 70; } ts.isModuleReference = isModuleReference; function isJsxOpeningElement(node) { - return node.kind === 249; + return node.kind === 250; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 250; + return node.kind === 251; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { var kind = node.kind; return kind === 98 || kind === 70 - || kind === 177; + || kind === 178; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 247 - || kind === 253 - || kind === 248 + return kind === 248 + || kind === 254 + || kind === 249 || kind === 10; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 251 - || kind === 252; + return kind === 252 + || kind === 253; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 252; + return node.kind === 253; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 251; + return node.kind === 252; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 253; + || kind === 254; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 254 - || kind === 255; + return kind === 255 + || kind === 256; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 256; + return node.kind === 257; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 257; + return node.kind === 258; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 258; + return node.kind === 259; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 259; + return node.kind === 260; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isEnumMember(node) { - return node.kind === 261; + return node.kind === 262; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 262; + return node.kind === 263; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -10494,9 +10544,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 143) { + if (d && d.kind === 144) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 228) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 229) { return current; } } @@ -10504,11 +10554,11 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return ts.hasModifier(node, 92) && node.parent.kind === 150 && ts.isClassLike(node.parent.parent); + return ts.hasModifier(node, 92) && node.parent.kind === 151 && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 174 || ts.isBindingPattern(node))) { + while (node && (node.kind === 175 || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -10516,14 +10566,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 224) { + if (node.kind === 225) { node = node.parent; } - if (node && node.kind === 225) { + if (node && node.kind === 226) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 206) { + if (node && node.kind === 207) { flags |= ts.getModifierFlags(node); } return flags; @@ -10532,14 +10582,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 224) { + if (node.kind === 225) { node = node.parent; } - if (node && node.kind === 225) { + if (node && node.kind === 226) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 206) { + if (node && node.kind === 207) { flags |= node.flags; } return flags; @@ -10598,7 +10648,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, location, flags) { - var ConstructorForKind = kind === 262 + var ConstructorForKind = kind === 263 ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); var node = location @@ -10768,7 +10818,7 @@ var ts; } ts.createNull = createNull; function createComputedPropertyName(expression, location) { - var node = createNode(142, location); + var node = createNode(143, location); node.expression = expression; return node; } @@ -10781,7 +10831,7 @@ var ts; } ts.updateComputedPropertyName = updateComputedPropertyName; function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) { - var node = createNode(144, location, flags); + var node = createNode(145, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.dotDotDotToken = dotDotDotToken; @@ -10800,7 +10850,7 @@ var ts; } ts.updateParameter = updateParameter; function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) { - var node = createNode(147, location); + var node = createNode(148, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10818,7 +10868,7 @@ var ts; } ts.updateProperty = updateProperty; function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(149, location, flags); + var node = createNode(150, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -10838,7 +10888,7 @@ var ts; } ts.updateMethod = updateMethod; function createConstructor(decorators, modifiers, parameters, body, location, flags) { - var node = createNode(150, location, flags); + var node = createNode(151, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.typeParameters = undefined; @@ -10856,7 +10906,7 @@ var ts; } ts.updateConstructor = updateConstructor; function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) { - var node = createNode(151, location, flags); + var node = createNode(152, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10875,7 +10925,7 @@ var ts; } ts.updateGetAccessor = updateGetAccessor; function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) { - var node = createNode(152, location, flags); + var node = createNode(153, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10893,7 +10943,7 @@ var ts; } ts.updateSetAccessor = updateSetAccessor; function createObjectBindingPattern(elements, location) { - var node = createNode(172, location); + var node = createNode(173, location); node.elements = createNodeArray(elements); return node; } @@ -10906,7 +10956,7 @@ var ts; } ts.updateObjectBindingPattern = updateObjectBindingPattern; function createArrayBindingPattern(elements, location) { - var node = createNode(173, location); + var node = createNode(174, location); node.elements = createNodeArray(elements); return node; } @@ -10919,7 +10969,7 @@ var ts; } ts.updateArrayBindingPattern = updateArrayBindingPattern; function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) { - var node = createNode(174, location); + var node = createNode(175, location); node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; node.dotDotDotToken = dotDotDotToken; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10935,7 +10985,7 @@ var ts; } ts.updateBindingElement = updateBindingElement; function createArrayLiteral(elements, location, multiLine) { - var node = createNode(175, location); + var node = createNode(176, location); node.elements = parenthesizeListElements(createNodeArray(elements)); if (multiLine) { node.multiLine = true; @@ -10951,7 +11001,7 @@ var ts; } ts.updateArrayLiteral = updateArrayLiteral; function createObjectLiteral(properties, location, multiLine) { - var node = createNode(176, location); + var node = createNode(177, location); node.properties = createNodeArray(properties); if (multiLine) { node.multiLine = true; @@ -10967,7 +11017,7 @@ var ts; } ts.updateObjectLiteral = updateObjectLiteral; function createPropertyAccess(expression, name, location, flags) { - var node = createNode(177, location, flags); + var node = createNode(178, location, flags); node.expression = parenthesizeForAccess(expression); (node.emitNode || (node.emitNode = {})).flags |= 65536; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10984,7 +11034,7 @@ var ts; } ts.updatePropertyAccess = updatePropertyAccess; function createElementAccess(expression, index, location) { - var node = createNode(178, location); + var node = createNode(179, location); node.expression = parenthesizeForAccess(expression); node.argumentExpression = typeof index === "number" ? createLiteral(index) : index; return node; @@ -10998,7 +11048,7 @@ var ts; } ts.updateElementAccess = updateElementAccess; function createCall(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(179, location, flags); + var node = createNode(180, location, flags); node.expression = parenthesizeForAccess(expression); if (typeArguments) { node.typeArguments = createNodeArray(typeArguments); @@ -11015,7 +11065,7 @@ var ts; } ts.updateCall = updateCall; function createNew(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(180, location, flags); + var node = createNode(181, location, flags); node.expression = parenthesizeForNew(expression); node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; @@ -11030,7 +11080,7 @@ var ts; } ts.updateNew = updateNew; function createTaggedTemplate(tag, template, location) { - var node = createNode(181, location); + var node = createNode(182, location); node.tag = parenthesizeForAccess(tag); node.template = template; return node; @@ -11044,7 +11094,7 @@ var ts; } ts.updateTaggedTemplate = updateTaggedTemplate; function createParen(expression, location) { - var node = createNode(183, location); + var node = createNode(184, location); node.expression = expression; return node; } @@ -11057,7 +11107,7 @@ var ts; } ts.updateParen = updateParen; function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(184, location, flags); + var node = createNode(185, location, flags); node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -11076,7 +11126,7 @@ var ts; } ts.updateFunctionExpression = updateFunctionExpression; function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) { - var node = createNode(185, location, flags); + var node = createNode(186, location, flags); node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; node.parameters = createNodeArray(parameters); @@ -11094,7 +11144,7 @@ var ts; } ts.updateArrowFunction = updateArrowFunction; function createDelete(expression, location) { - var node = createNode(186, location); + var node = createNode(187, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11107,7 +11157,7 @@ var ts; } ts.updateDelete = updateDelete; function createTypeOf(expression, location) { - var node = createNode(187, location); + var node = createNode(188, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11120,7 +11170,7 @@ var ts; } ts.updateTypeOf = updateTypeOf; function createVoid(expression, location) { - var node = createNode(188, location); + var node = createNode(189, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11133,7 +11183,7 @@ var ts; } ts.updateVoid = updateVoid; function createAwait(expression, location) { - var node = createNode(189, location); + var node = createNode(190, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11146,7 +11196,7 @@ var ts; } ts.updateAwait = updateAwait; function createPrefix(operator, operand, location) { - var node = createNode(190, location); + var node = createNode(191, location); node.operator = operator; node.operand = parenthesizePrefixOperand(operand); return node; @@ -11160,7 +11210,7 @@ var ts; } ts.updatePrefix = updatePrefix; function createPostfix(operand, operator, location) { - var node = createNode(191, location); + var node = createNode(192, location); node.operand = parenthesizePostfixOperand(operand); node.operator = operator; return node; @@ -11176,7 +11226,7 @@ var ts; function createBinary(left, operator, right, location) { var operatorToken = typeof operator === "number" ? createToken(operator) : operator; var operatorKind = operatorToken.kind; - var node = createNode(192, location); + var node = createNode(193, location); node.left = parenthesizeBinaryOperand(operatorKind, left, true, undefined); node.operatorToken = operatorToken; node.right = parenthesizeBinaryOperand(operatorKind, right, false, node.left); @@ -11191,7 +11241,7 @@ var ts; } ts.updateBinary = updateBinary; function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { - var node = createNode(193, whenFalse ? location : colonTokenOrLocation); + var node = createNode(194, whenFalse ? location : colonTokenOrLocation); node.condition = parenthesizeForConditionalHead(condition); if (whenFalse) { node.questionToken = questionTokenOrWhenTrue; @@ -11216,7 +11266,7 @@ var ts; } ts.updateConditional = updateConditional; function createTemplateExpression(head, templateSpans, location) { - var node = createNode(194, location); + var node = createNode(195, location); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; @@ -11230,7 +11280,7 @@ var ts; } ts.updateTemplateExpression = updateTemplateExpression; function createYield(asteriskToken, expression, location) { - var node = createNode(195, location); + var node = createNode(196, location); node.asteriskToken = asteriskToken; node.expression = expression; return node; @@ -11244,7 +11294,7 @@ var ts; } ts.updateYield = updateYield; function createSpread(expression, location) { - var node = createNode(196, location); + var node = createNode(197, location); node.expression = parenthesizeExpressionForList(expression); return node; } @@ -11257,7 +11307,7 @@ var ts; } ts.updateSpread = updateSpread; function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(197, location); + var node = createNode(198, location); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11275,12 +11325,12 @@ var ts; } ts.updateClassExpression = updateClassExpression; function createOmittedExpression(location) { - var node = createNode(198, location); + var node = createNode(199, location); return node; } ts.createOmittedExpression = createOmittedExpression; function createExpressionWithTypeArguments(typeArguments, expression, location) { - var node = createNode(199, location); + var node = createNode(200, location); node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; node.expression = parenthesizeForAccess(expression); return node; @@ -11294,7 +11344,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createTemplateSpan(expression, literal, location) { - var node = createNode(203, location); + var node = createNode(204, location); node.expression = expression; node.literal = literal; return node; @@ -11308,7 +11358,7 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createBlock(statements, location, multiLine, flags) { - var block = createNode(205, location, flags); + var block = createNode(206, location, flags); block.statements = createNodeArray(statements); if (multiLine) { block.multiLine = true; @@ -11324,7 +11374,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(206, location, flags); + var node = createNode(207, location, flags); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -11339,7 +11389,7 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(225, location, flags); + var node = createNode(226, location, flags); node.declarations = createNodeArray(declarations); return node; } @@ -11352,7 +11402,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(224, location, flags); + var node = createNode(225, location, flags); node.name = typeof name === "string" ? createIdentifier(name) : name; node.type = type; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11367,11 +11417,11 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createEmptyStatement(location) { - return createNode(207, location); + return createNode(208, location); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression, location, flags) { - var node = createNode(208, location, flags); + var node = createNode(209, location, flags); node.expression = parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -11384,7 +11434,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(209, location); + var node = createNode(210, location); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11399,7 +11449,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression, location) { - var node = createNode(210, location); + var node = createNode(211, location); node.statement = statement; node.expression = expression; return node; @@ -11413,7 +11463,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement, location) { - var node = createNode(211, location); + var node = createNode(212, location); node.expression = expression; node.statement = statement; return node; @@ -11427,7 +11477,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(212, location, undefined); + var node = createNode(213, location, undefined); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11443,7 +11493,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement, location) { - var node = createNode(213, location); + var node = createNode(214, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11458,7 +11508,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(initializer, expression, statement, location) { - var node = createNode(214, location); + var node = createNode(215, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11473,7 +11523,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label, location) { - var node = createNode(215, location); + var node = createNode(216, location); if (label) { node.label = label; } @@ -11488,7 +11538,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label, location) { - var node = createNode(216, location); + var node = createNode(217, location); if (label) { node.label = label; } @@ -11503,7 +11553,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression, location) { - var node = createNode(217, location); + var node = createNode(218, location); node.expression = expression; return node; } @@ -11516,7 +11566,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement, location) { - var node = createNode(218, location); + var node = createNode(219, location); node.expression = expression; node.statement = statement; return node; @@ -11530,7 +11580,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock, location) { - var node = createNode(219, location); + var node = createNode(220, location); node.expression = parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -11544,7 +11594,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement, location) { - var node = createNode(220, location); + var node = createNode(221, location); node.label = typeof label === "string" ? createIdentifier(label) : label; node.statement = statement; return node; @@ -11558,7 +11608,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression, location) { - var node = createNode(221, location); + var node = createNode(222, location); node.expression = expression; return node; } @@ -11571,7 +11621,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(222, location); + var node = createNode(223, location); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11586,7 +11636,7 @@ var ts; } ts.updateTry = updateTry; function createCaseBlock(clauses, location) { - var node = createNode(233, location); + var node = createNode(234, location); node.clauses = createNodeArray(clauses); return node; } @@ -11599,7 +11649,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(226, location, flags); + var node = createNode(227, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -11619,7 +11669,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(227, location); + var node = createNode(228, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11637,7 +11687,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(236, location); + var node = createNode(237, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.importClause = importClause; @@ -11653,7 +11703,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings, location) { - var node = createNode(237, location); + var node = createNode(238, location); node.name = name; node.namedBindings = namedBindings; return node; @@ -11667,7 +11717,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name, location) { - var node = createNode(238, location); + var node = createNode(239, location); node.name = name; return node; } @@ -11680,7 +11730,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements, location) { - var node = createNode(239, location); + var node = createNode(240, location); node.elements = createNodeArray(elements); return node; } @@ -11693,7 +11743,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name, location) { - var node = createNode(240, location); + var node = createNode(241, location); node.propertyName = propertyName; node.name = name; return node; @@ -11707,7 +11757,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(241, location); + var node = createNode(242, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.isExportEquals = isExportEquals; @@ -11723,7 +11773,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(242, location); + var node = createNode(243, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.exportClause = exportClause; @@ -11739,7 +11789,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements, location) { - var node = createNode(243, location); + var node = createNode(244, location); node.elements = createNodeArray(elements); return node; } @@ -11752,7 +11802,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(name, propertyName, location) { - var node = createNode(244, location); + var node = createNode(245, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; return node; @@ -11766,7 +11816,7 @@ var ts; } ts.updateExportSpecifier = updateExportSpecifier; function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(247, location); + var node = createNode(248, location); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11781,7 +11831,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(248, location); + var node = createNode(249, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11795,7 +11845,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(249, location); + var node = createNode(250, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11809,7 +11859,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName, location) { - var node = createNode(250, location); + var node = createNode(251, location); node.tagName = tagName; return node; } @@ -11822,7 +11872,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxAttribute(name, initializer, location) { - var node = createNode(251, location); + var node = createNode(252, location); node.name = name; node.initializer = initializer; return node; @@ -11836,7 +11886,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxSpreadAttribute(expression, location) { - var node = createNode(252, location); + var node = createNode(253, location); node.expression = expression; return node; } @@ -11849,7 +11899,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(expression, dotDotDotToken, location) { - var node = createNode(253, location); + var node = createNode(254, location); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -11863,7 +11913,7 @@ var ts; } ts.updateJsxExpression = updateJsxExpression; function createHeritageClause(token, types, location) { - var node = createNode(256, location); + var node = createNode(257, location); node.token = token; node.types = createNodeArray(types); return node; @@ -11877,7 +11927,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCaseClause(expression, statements, location) { - var node = createNode(254, location); + var node = createNode(255, location); node.expression = parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -11891,7 +11941,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements, location) { - var node = createNode(255, location); + var node = createNode(256, location); node.statements = createNodeArray(statements); return node; } @@ -11904,7 +11954,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createCatchClause(variableDeclaration, block, location) { - var node = createNode(257, location); + var node = createNode(258, location); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -11918,7 +11968,7 @@ var ts; } ts.updateCatchClause = updateCatchClause; function createPropertyAssignment(name, initializer, location) { - var node = createNode(258, location); + var node = createNode(259, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.questionToken = undefined; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11933,14 +11983,14 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(259, location); + var node = createNode(260, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; function createSpreadAssignment(expression, location) { - var node = createNode(260, location); + var node = createNode(261, location); node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; return node; } @@ -11961,7 +12011,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(262, node, node.flags); + var updated = createNode(263, node, node.flags); updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -12021,27 +12071,27 @@ var ts; } ts.updateSourceFileNode = updateSourceFileNode; function createNotEmittedStatement(original) { - var node = createNode(294, original); + var node = createNode(295, original); node.original = original; return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(297); + var node = createNode(298); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(296); + var node = createNode(297); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(295, location || original); + var node = createNode(296, location || original); node.expression = expression; node.original = original; return node; @@ -12221,7 +12271,7 @@ var ts; if (!outermostLabeledStatement) { return node; } - var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 220 + var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 221 ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); if (afterRestoreLabelCallback) { @@ -12239,13 +12289,13 @@ var ts; case 8: case 9: return false; - case 175: + case 176: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 176: + case 177: return target.properties.length > 0; default: return true; @@ -12265,7 +12315,7 @@ var ts; } else { switch (callee.kind) { - case 177: { + case 178: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = createTempVariable(recordTempVariable); target = createPropertyAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.name, callee); @@ -12276,7 +12326,7 @@ var ts; } break; } - case 178: { + case 179: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = createTempVariable(recordTempVariable); target = createElementAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.argumentExpression, callee); @@ -12326,14 +12376,14 @@ var ts; ts.createExpressionForPropertyName = createExpressionForPropertyName; function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { - case 151: case 152: + case 153: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 258: - return createExpressionForPropertyAssignment(property, receiver); case 259: + return createExpressionForPropertyAssignment(property, receiver); + case 260: return createExpressionForShorthandPropertyAssignment(property, receiver); - case 149: + case 150: return createExpressionForMethodDeclaration(property, receiver); } } @@ -12396,15 +12446,15 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_10 = getMutableClone(node.name); + var name = getMutableClone(node.name); emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) emitFlags |= 48; if (!allowComments) emitFlags |= 1536; if (emitFlags) - setEmitFlags(name_10, emitFlags); - return name_10; + setEmitFlags(name, emitFlags); + return name; } return getGeneratedNameForNode(node); } @@ -12499,7 +12549,7 @@ var ts; ts.ensureUseStrict = ensureUseStrict; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 183) { + if (skipped.kind === 184) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -12508,15 +12558,15 @@ var ts; } ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var binaryOperatorPrecedence = ts.getOperatorPrecedence(192, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(192, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(193, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(193, binaryOperator); var emittedOperand = skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { case -1: if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 - && operand.kind === 195) { + && operand.kind === 196) { return false; } return true; @@ -12555,7 +12605,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 192 && node.operatorToken.kind === 36) { + if (node.kind === 193 && node.operatorToken.kind === 36) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -12570,7 +12620,7 @@ var ts; return 0; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(193, 54); + var conditionalPrecedence = ts.getOperatorPrecedence(194, 54); var emittedCondition = skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { @@ -12580,16 +12630,16 @@ var ts; } ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; function parenthesizeSubexpressionOfConditionalExpression(e) { - return e.kind === 192 && e.operatorToken.kind === 25 + return e.kind === 193 && e.operatorToken.kind === 25 ? createParen(e) : e; } function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { - case 179: - return createParen(expression); case 180: + return createParen(expression); + case 181: return emittedExpression.arguments ? expression : createParen(expression); @@ -12600,7 +12650,7 @@ var ts; function parenthesizeForAccess(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 180 || emittedExpression.arguments) + && (emittedExpression.kind !== 181 || emittedExpression.arguments) && emittedExpression.kind !== 8) { return expression; } @@ -12638,7 +12688,7 @@ var ts; function parenthesizeExpressionForList(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(192, 25); + var commaPrecedence = ts.getOperatorPrecedence(193, 25); return expressionPrecedence > commaPrecedence ? expression : createParen(expression, expression); @@ -12649,7 +12699,7 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 184 || kind === 185) { + if (kind === 185 || kind === 186) { var mutableCall = getMutableClone(emittedExpression); mutableCall.expression = createParen(callee, callee); return recreatePartiallyEmittedExpressions(expression, mutableCall); @@ -12657,7 +12707,7 @@ var ts; } else { var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; - if (leftmostExpressionKind === 176 || leftmostExpressionKind === 184) { + if (leftmostExpressionKind === 177 || leftmostExpressionKind === 185) { return createParen(expression, expression); } } @@ -12675,21 +12725,21 @@ var ts; function getLeftmostExpression(node) { while (true) { switch (node.kind) { - case 191: + case 192: node = node.operand; continue; - case 192: + case 193: node = node.left; continue; - case 193: + case 194: node = node.condition; continue; + case 180: case 179: case 178: - case 177: node = node.expression; continue; - case 295: + case 296: node = node.expression; continue; } @@ -12698,7 +12748,7 @@ var ts; } function parenthesizeConciseBody(body) { var emittedBody = skipPartiallyEmittedExpressions(body); - if (emittedBody.kind === 176) { + if (emittedBody.kind === 177) { return createParen(body, body); } return body; @@ -12723,7 +12773,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipParentheses(node) { - while (node.kind === 183) { + while (node.kind === 184) { node = node.expression; } return node; @@ -12737,7 +12787,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 295) { + while (node.kind === 296) { node = node.expression; } return node; @@ -12778,8 +12828,10 @@ var ts; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { if (!destRanges) - destRanges = ts.createMap(); - ts.copyProperties(sourceRanges, destRanges); + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } return destRanges; } function disposeEmitNodes(sourceFile) { @@ -12797,7 +12849,7 @@ var ts; function getOrCreateEmitNode(node) { if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 262) { + if (node.kind === 263) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -12836,7 +12888,7 @@ var ts; ts.getTokenSourceMapRange = getTokenSourceMapRange; function setTokenSourceMapRange(node, token, range) { var emitNode = getOrCreateEmitNode(node); - var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); tokenSourceMapRanges[token] = range; return node; } @@ -12985,13 +13037,13 @@ var ts; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_11 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_11) ? name_11 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name) ? name : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 236 && node.importClause) { + if (node.kind === 237 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 242 && node.moduleSpecifier) { + if (node.kind === 243 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } return undefined; @@ -13008,10 +13060,8 @@ var ts; } ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral; function tryRenameExternalModule(moduleName, sourceFile) { - if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) { - return createLiteral(sourceFile.renamedDependencies[moduleName.text]); - } - return undefined; + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && createLiteral(rename); } function tryGetModuleNameFromFile(file, host, options) { if (!file) { @@ -13055,11 +13105,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 258: - return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 259: - return bindingElement.name; + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 260: + return bindingElement.name; + case 261: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -13075,11 +13125,11 @@ var ts; ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 144: - case 174: + case 145: + case 175: return bindingElement.dotDotDotToken; - case 196: - case 260: + case 197: + case 261: return bindingElement; } return undefined; @@ -13087,7 +13137,7 @@ var ts; ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 174: + case 175: if (bindingElement.propertyName) { var propertyName = bindingElement.propertyName; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -13095,7 +13145,7 @@ var ts; : propertyName; } break; - case 258: + case 259: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -13103,7 +13153,7 @@ var ts; : propertyName; } break; - case 260: + case 261: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -13117,11 +13167,11 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 172: case 173: - case 175: - return name.elements; + case 174: case 176: + return name.elements; + case 177: return name.properties; } } @@ -13158,11 +13208,11 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 173: - case 175: - return convertToArrayAssignmentPattern(node); - case 172: + case 174: case 176: + return convertToArrayAssignmentPattern(node); + case 173: + case 177: return convertToObjectAssignmentPattern(node); } } @@ -13193,8 +13243,8 @@ var ts; ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); + var exportSpecifiers = ts.createMultiMap(); + var exportedBindings = []; var uniqueExports = ts.createMap(); var exportedNames; var hasExportDefault = false; @@ -13208,15 +13258,15 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 236: + case 237: externalImports.push(node); break; - case 235: - if (node.moduleReference.kind === 246) { + case 236: + if (node.moduleReference.kind === 247) { externalImports.push(node); } break; - case 242: + case 243: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -13229,26 +13279,26 @@ var ts; else { for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_12 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_12.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_12) - || resolver.getReferencedValueDeclaration(name_12); + if (!uniqueExports.get(specifier.name.text)) { + var name = specifier.propertyName || specifier.name; + exportSpecifiers.add(name.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); if (decl) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); } - uniqueExports[specifier.name.text] = true; + uniqueExports.set(specifier.name.text, true); exportedNames = ts.append(exportedNames, specifier.name); } } } break; - case 241: + case 242: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 206: + case 207: if (ts.hasModifier(node, 1)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13256,38 +13306,38 @@ var ts; } } break; - case 226: + case 227: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_13 = node.name; - if (!uniqueExports[name_13.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_13); - uniqueExports[name_13.text] = true; - exportedNames = ts.append(exportedNames, name_13); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } break; - case 227: + case 228: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_14 = node.name; - if (!uniqueExports[name_14.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_14); - uniqueExports[name_14.text] = true; - exportedNames = ts.append(exportedNames, name_14); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } @@ -13307,13 +13357,23 @@ var ts; } } else if (!ts.isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = true; + if (!uniqueExports.get(decl.name.text)) { + uniqueExports.set(decl.name.text, true); exportedNames = ts.append(exportedNames, decl.name); } } return exportedNames; } + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } })(ts || (ts = {})); var ts; (function (ts) { @@ -13322,13 +13382,13 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 262) { + if (kind === 263) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } - else if (kind < 141) { + else if (kind < 142) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end); } else { @@ -13364,28 +13424,28 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 141: + case 142: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 143: + case 144: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 259: + case 260: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 260: + case 261: return visitNode(cbNode, node.expression); - case 144: + case 145: + case 148: case 147: - case 146: - case 258: - case 224: - case 174: + case 259: + case 225: + case 175: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -13394,24 +13454,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 158: case 159: - case 153: + case 160: case 154: case 155: + case 156: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 184: - case 226: + case 153: case 185: + case 227: + case 186: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -13422,323 +13482,323 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 157: + case 158: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 156: + case 157: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 160: - return visitNode(cbNode, node.exprName); case 161: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 162: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 163: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 164: + return visitNodes(cbNodes, node.elementTypes); case 165: - return visitNodes(cbNodes, node.types); case 166: - case 168: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); + case 167: case 169: + return visitNode(cbNode, node.type); + case 170: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); - case 170: + case 171: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); - case 171: - return visitNode(cbNode, node.literal); case 172: + return visitNode(cbNode, node.literal); case 173: - return visitNodes(cbNodes, node.elements); - case 175: + case 174: return visitNodes(cbNodes, node.elements); case 176: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 177: + return visitNodes(cbNodes, node.properties); + case 178: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 178: + case 179: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 179: case 180: + case 181: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 181: + case 182: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 182: + case 183: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 183: - return visitNode(cbNode, node.expression); - case 186: + case 184: return visitNode(cbNode, node.expression); case 187: return visitNode(cbNode, node.expression); case 188: return visitNode(cbNode, node.expression); - case 190: - return visitNode(cbNode, node.operand); - case 195: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 189: return visitNode(cbNode, node.expression); case 191: return visitNode(cbNode, node.operand); + case 196: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 190: + return visitNode(cbNode, node.expression); case 192: + return visitNode(cbNode, node.operand); + case 193: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 200: + case 201: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 201: - return visitNode(cbNode, node.expression); case 202: + return visitNode(cbNode, node.expression); + case 203: return visitNode(cbNode, node.name); - case 193: + case 194: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 196: + case 197: return visitNode(cbNode, node.expression); - case 205: - case 232: + case 206: + case 233: return visitNodes(cbNodes, node.statements); - case 262: + case 263: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 206: + case 207: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 225: + case 226: return visitNodes(cbNodes, node.declarations); - case 208: - return visitNode(cbNode, node.expression); case 209: + return visitNode(cbNode, node.expression); + case 210: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 210: + case 211: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 211: + case 212: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 212: + case 213: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 213: + case 214: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214: + case 215: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 215: case 216: - return visitNode(cbNode, node.label); case 217: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.label); case 218: + return visitNode(cbNode, node.expression); + case 219: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 219: + case 220: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 233: + case 234: return visitNodes(cbNodes, node.clauses); - case 254: + case 255: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 255: + case 256: return visitNodes(cbNodes, node.statements); - case 220: + case 221: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 221: - return visitNode(cbNode, node.expression); case 222: + return visitNode(cbNode, node.expression); + case 223: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 257: + case 258: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 145: + case 146: return visitNode(cbNode, node.expression); - case 227: - case 197: + case 228: + case 198: 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 228: + case 229: 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 229: + case 230: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 230: + case 231: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 261: + case 262: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 231: + case 232: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 235: + case 236: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 236: + case 237: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 237: + case 238: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 234: - return visitNode(cbNode, node.name); - case 238: + case 235: return visitNode(cbNode, node.name); case 239: - case 243: + return visitNode(cbNode, node.name); + case 240: + case 244: return visitNodes(cbNodes, node.elements); - case 242: + case 243: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 240: - case 244: + case 241: + case 245: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 241: + case 242: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 194: + case 195: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 203: + case 204: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 142: + case 143: return visitNode(cbNode, node.expression); - case 256: + case 257: return visitNodes(cbNodes, node.types); - case 199: + case 200: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 246: + case 247: return visitNode(cbNode, node.expression); - case 245: + case 246: return visitNodes(cbNodes, node.decorators); - case 247: + case 248: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 248: case 249: + case 250: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 251: + case 252: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 252: - return visitNode(cbNode, node.expression); case 253: + return visitNode(cbNode, node.expression); + case 254: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 250: + case 251: return visitNode(cbNode, node.tagName); - case 263: + case 264: return visitNode(cbNode, node.type); - case 267: - return visitNodes(cbNodes, node.types); case 268: return visitNodes(cbNodes, node.types); - case 266: + case 269: + return visitNodes(cbNodes, node.types); + case 267: return visitNode(cbNode, node.elementType); - case 270: + case 271: return visitNode(cbNode, node.type); - case 269: + case 270: return visitNode(cbNode, node.type); - case 271: + case 272: return visitNode(cbNode, node.literal); - case 273: + case 274: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 274: - return visitNode(cbNode, node.type); case 275: + return visitNode(cbNode, node.type); + case 276: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 276: - return visitNode(cbNode, node.type); case 277: return visitNode(cbNode, node.type); case 278: return visitNode(cbNode, node.type); - case 272: + case 279: + return visitNode(cbNode, node.type); + case 273: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 279: + case 280: return visitNodes(cbNodes, node.tags); - case 282: + case 283: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 283: - return visitNode(cbNode, node.typeExpression); case 284: return visitNode(cbNode, node.typeExpression); - case 281: - return visitNode(cbNode, node.typeExpression); case 285: - return visitNodes(cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 282: + return visitNode(cbNode, node.typeExpression); case 286: + return visitNodes(cbNodes, node.typeParameters); + case 287: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 288: + case 289: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 287: + case 288: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 295: + case 296: return visitNode(cbNode, node.expression); - case 289: + case 290: return visitNode(cbNode, node.literal); } } @@ -13902,7 +13962,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(262, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(263, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -14129,7 +14189,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return kind >= 141 ? new NodeConstructor(kind, pos, pos) : + return kind >= 142 ? new NodeConstructor(kind, pos, pos) : kind === 70 ? new IdentifierConstructor(kind, pos, pos) : new TokenConstructor(kind, pos, pos); } @@ -14166,7 +14226,11 @@ var ts; } function internIdentifier(text) { text = ts.escapeIdentifier(text); - return identifiers[text] || (identifiers[text] = text); + var identifier = identifiers.get(text); + if (identifier === undefined) { + identifiers.set(text, identifier = text); + } + return identifier; } function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; @@ -14211,7 +14275,7 @@ var ts; return token() === 9 || token() === 8 || ts.tokenIsIdentifierOrKeyword(token()); } function parseComputedPropertyName() { - var node = createNode(142); + var node = createNode(143); parseExpected(20); node.expression = allowInAnd(parseExpression); parseExpected(21); @@ -14516,14 +14580,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 150: - case 155: case 151: + case 156: case 152: - case 147: - case 204: + case 153: + case 148: + case 205: return true; - case 149: + case 150: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 70 && methodDeclaration.name.originalKeywordKind === 122; @@ -14535,8 +14599,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 254: case 255: + case 256: return true; } } @@ -14545,65 +14609,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 226: + case 227: + case 207: case 206: - case 205: + case 210: case 209: - case 208: - case 221: + case 222: + case 218: + case 220: case 217: - case 219: case 216: + case 214: case 215: case 213: - case 214: case 212: - case 211: - case 218: - case 207: - case 222: - case 220: - case 210: + case 219: + case 208: case 223: + case 221: + case 211: + case 224: + case 237: case 236: - case 235: + case 243: case 242: - case 241: - case 231: - case 227: + case 232: case 228: - case 230: case 229: + case 231: + case 230: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 261; + return node.kind === 262; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 154: - case 148: case 155: - case 146: - case 153: + case 149: + case 156: + case 147: + case 154: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 224) { + if (node.kind !== 225) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 144) { + if (node.kind !== 145) { return false; } var parameter = node; @@ -14699,7 +14763,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(22)) { - var node = createNode(141, entity.pos); + var node = createNode(142, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -14716,7 +14780,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(194); + var template = createNode(195); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 13, "Template head has wrong token kind"); var templateSpans = createNodeArray(); @@ -14728,7 +14792,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(203); + var span = createNode(204); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17) { @@ -14776,7 +14840,7 @@ var ts; } function parseTypeReference() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - var node = createNode(157, typeName.pos); + var node = createNode(158, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); @@ -14785,24 +14849,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(156, lhs.pos); + var node = createNode(157, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(167); + var node = createNode(168); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(160); + var node = createNode(161); parseExpected(102); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); if (parseOptional(84)) { if (isStartOfType() || !isStartOfExpression()) { @@ -14829,7 +14893,7 @@ var ts; return token() === 23 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 || token() === 98; } function parseParameter() { - var node = createNode(144); + var node = createNode(145); if (token() === 98) { node.name = createIdentifier(true, undefined); node.type = parseParameterType(); @@ -14889,7 +14953,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 154) { + if (kind === 155) { parseExpected(93); } fillSignature(55, false, false, false, node); @@ -14929,7 +14993,7 @@ var ts; return token() === 55 || token() === 25 || token() === 21; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(155, fullStart); + var node = createNode(156, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.parameters = parseBracketedList(16, parseParameter, 20, 21); @@ -14941,7 +15005,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(54); if (token() === 18 || token() === 26) { - var method = createNode(148, fullStart); + var method = createNode(149, fullStart); method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; @@ -14950,7 +15014,7 @@ var ts; return addJSDocComment(finishNode(method)); } else { - var property = createNode(146, fullStart); + var property = createNode(147, fullStart); property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; @@ -14990,10 +15054,10 @@ var ts; } function parseTypeMember() { if (token() === 18 || token() === 26) { - return parseSignatureMember(153); + return parseSignatureMember(154); } if (token() === 93 && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(154); + return parseSignatureMember(155); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -15007,7 +15071,7 @@ var ts; return token() === 18 || token() === 26; } function parseTypeLiteral() { - var node = createNode(161); + var node = createNode(162); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -15030,14 +15094,14 @@ var ts; return token() === 20 && nextTokenIsIdentifier() && nextToken() === 91; } function parseMappedTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); parseExpected(91); node.constraint = parseType(); return finishNode(node); } function parseMappedType() { - var node = createNode(170); + var node = createNode(171); parseExpected(16); node.readonlyToken = parseOptionalToken(130); parseExpected(20); @@ -15050,12 +15114,12 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(163); + var node = createNode(164); node.elementTypes = parseBracketedList(20, parseType, 20, 21); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(166); + var node = createNode(167); parseExpected(18); node.type = parseType(); parseExpected(19); @@ -15063,7 +15127,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 159) { + if (kind === 160) { parseExpected(93); } fillSignature(35, false, false, false, node); @@ -15074,7 +15138,7 @@ var ts; return token() === 22 ? undefined : node; } function parseLiteralTypeNode() { - var node = createNode(171); + var node = createNode(172); node.literal = parseSimpleUnaryExpression(); finishNode(node); return node; @@ -15085,12 +15149,13 @@ var ts; function parseNonArrayType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: - case 137: + case 136: + case 138: case 129: + case 133: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 9: @@ -15127,12 +15192,12 @@ var ts; function isStartOfType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: - case 137: + case 138: case 94: case 98: case 102: @@ -15147,6 +15212,7 @@ var ts; case 8: case 100: case 85: + case 133: return true; case 37: return lookAhead(nextTokenIsNumericLiteral); @@ -15164,14 +15230,14 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(20)) { if (isStartOfType()) { - var node = createNode(169, type.pos); + var node = createNode(170, type.pos); node.objectType = type; node.indexType = parseType(); parseExpected(21); type = finishNode(node); } else { - var node = createNode(162, type.pos); + var node = createNode(163, type.pos); node.elementType = type; parseExpected(21); type = finishNode(node); @@ -15180,7 +15246,7 @@ var ts; return type; } function parseTypeOperator(operator) { - var node = createNode(168); + var node = createNode(169); parseExpected(operator); node.operator = operator; node.type = parseTypeOperatorOrHigher(); @@ -15209,10 +15275,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(165, parseTypeOperatorOrHigher, 47); + return parseUnionOrIntersectionType(166, parseTypeOperatorOrHigher, 47); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(164, parseIntersectionTypeOrHigher, 48); + return parseUnionOrIntersectionType(165, parseIntersectionTypeOrHigher, 48); } function isStartOfFunctionType() { if (token() === 26) { @@ -15258,7 +15324,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(156, typePredicateVariable.pos); + var node = createNode(157, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -15279,10 +15345,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(158); + return parseFunctionOrConstructorType(159); } if (token() === 93) { - return parseFunctionOrConstructorType(159); + return parseFunctionOrConstructorType(160); } return parseUnionTypeOrHigher(); } @@ -15401,7 +15467,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(195); + var node = createNode(196); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token() === 38 || isStartOfExpression())) { @@ -15417,13 +15483,13 @@ var ts; ts.Debug.assert(token() === 35, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(185, asyncModifier.pos); + node = createNode(186, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(185, identifier.pos); + node = createNode(186, identifier.pos); } - var parameter = createNode(144, identifier.pos); + var parameter = createNode(145, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = createNodeArray([parameter], parameter.pos); @@ -15557,7 +15623,7 @@ var ts; return 0; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(185); + var node = createNode(186); node.modifiers = parseModifiersForArrowFunction(); var isAsync = !!(ts.getModifierFlags(node) & 256); fillSignature(55, false, isAsync, !allowAmbiguity, node); @@ -15589,7 +15655,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(193, leftOperand.pos); + var node = createNode(194, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -15602,7 +15668,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 91 || t === 140; + return t === 91 || t === 141; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -15680,39 +15746,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(192, left.pos); + var node = createNode(193, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(200, left.pos); + var node = createNode(201, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(186); + var node = createNode(187); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(187); + var node = createNode(188); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(188); + var node = createNode(189); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -15727,7 +15793,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(189); + var node = createNode(190); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -15743,7 +15809,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token() === 39) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 182) { + if (simpleUnaryExpression.kind === 183) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -15796,7 +15862,7 @@ var ts; } function parseIncrementExpression() { if (token() === 42 || token() === 43) { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -15808,7 +15874,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 42 || token() === 43) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(191, expression.pos); + var node = createNode(192, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -15831,7 +15897,7 @@ var ts; if (token() === 18 || token() === 22 || token() === 20) { return expression; } - var node = createNode(177, expression.pos); + var node = createNode(178, expression.pos); node.expression = expression; parseExpectedToken(22, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -15853,8 +15919,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 249) { - var node = createNode(247, opening.pos); + if (opening.kind === 250) { + var node = createNode(248, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -15864,14 +15930,14 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 248); + ts.Debug.assert(opening.kind === 249); result = opening; } if (inExpressionContext && token() === 26) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(192, result.pos); + var badNode = createNode(193, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -15924,7 +15990,7 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token() === 28) { - node = createNode(249, fullStart); + node = createNode(250, fullStart); scanJsxText(); } else { @@ -15936,7 +16002,7 @@ var ts; parseExpected(28, undefined, false); scanJsxText(); } - node = createNode(248, fullStart); + node = createNode(249, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -15947,7 +16013,7 @@ var ts; var expression = token() === 98 ? parseTokenNode() : parseIdentifierName(); while (parseOptional(22)) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -15955,7 +16021,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(253); + var node = createNode(254); parseExpected(16); if (token() !== 17) { node.dotDotDotToken = parseOptionalToken(23); @@ -15975,7 +16041,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(251); + var node = createNode(252); node.name = parseIdentifierName(); if (token() === 57) { switch (scanJsxAttributeValue()) { @@ -15990,7 +16056,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(252); + var node = createNode(253); parseExpected(16); parseExpected(23); node.expression = parseExpression(); @@ -15998,7 +16064,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(250); + var node = createNode(251); parseExpected(27); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -16011,7 +16077,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(182); + var node = createNode(183); parseExpected(26); node.type = parseType(); parseExpected(28); @@ -16022,7 +16088,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(22); if (dotToken) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -16030,13 +16096,13 @@ var ts; } if (token() === 50 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(201, expression.pos); + var nonNullExpression = createNode(202, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } if (!inDecoratorContext() && parseOptional(20)) { - var indexedAccess = createNode(178, expression.pos); + var indexedAccess = createNode(179, expression.pos); indexedAccess.expression = expression; if (token() !== 21) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -16050,7 +16116,7 @@ var ts; continue; } if (token() === 12 || token() === 13) { - var tagExpression = createNode(181, expression.pos); + var tagExpression = createNode(182, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 12 ? parseLiteralNode() @@ -16069,7 +16135,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -16077,7 +16143,7 @@ var ts; continue; } else if (token() === 18) { - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -16172,28 +16238,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(183); + var node = createNode(184); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); return finishNode(node); } function parseSpreadElement() { - var node = createNode(196); + var node = createNode(197); parseExpected(23); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 23 ? parseSpreadElement() : - token() === 25 ? createNode(198) : + token() === 25 ? createNode(199) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(175); + var node = createNode(176); parseExpected(20); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16204,18 +16270,18 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(124)) { - return parseAccessorDeclaration(151, fullStart, decorators, modifiers); - } - else if (parseContextualModifier(133)) { return parseAccessorDeclaration(152, fullStart, decorators, modifiers); } + else if (parseContextualModifier(134)) { + return parseAccessorDeclaration(153, fullStart, decorators, modifiers); + } return undefined; } function parseObjectLiteralElement() { var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23); if (dotDotDotToken) { - var spreadElement = createNode(260, fullStart); + var spreadElement = createNode(261, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -16234,7 +16300,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(259, fullStart); + var shorthandDeclaration = createNode(260, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57); @@ -16245,7 +16311,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(258, fullStart); + var propertyAssignment = createNode(259, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -16255,7 +16321,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(176); + var node = createNode(177); parseExpected(16); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16269,7 +16335,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(184); + var node = createNode(185); node.modifiers = parseModifiers(); parseExpected(88); node.asteriskToken = parseOptionalToken(38); @@ -16294,12 +16360,12 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(93); if (parseOptional(22)) { - var node_1 = createNode(202, fullStart); + var node_1 = createNode(203, fullStart); node_1.keywordToken = 93; node_1.name = parseIdentifierName(); return finishNode(node_1); } - var node = createNode(180, fullStart); + var node = createNode(181, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18) { @@ -16308,7 +16374,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(205); + var node = createNode(206); if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16339,12 +16405,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(207); + var node = createNode(208); parseExpected(24); return finishNode(node); } function parseIfStatement() { - var node = createNode(209); + var node = createNode(210); parseExpected(89); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16354,7 +16420,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(210); + var node = createNode(211); parseExpected(80); node.statement = parseStatement(); parseExpected(105); @@ -16365,7 +16431,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(211); + var node = createNode(212); parseExpected(105); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16388,21 +16454,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(91)) { - var forInStatement = createNode(213, pos); + var forInStatement = createNode(214, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(19); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(140)) { - var forOfStatement = createNode(214, pos); + else if (parseOptional(141)) { + var forOfStatement = createNode(215, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(212, pos); + var forStatement = createNode(213, pos); forStatement.initializer = initializer; parseExpected(24); if (token() !== 24 && token() !== 19) { @@ -16420,7 +16486,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 216 ? 71 : 76); + parseExpected(kind === 217 ? 71 : 76); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -16428,7 +16494,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(217); + var node = createNode(218); parseExpected(95); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -16437,7 +16503,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(218); + var node = createNode(219); parseExpected(106); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16446,7 +16512,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(254); + var node = createNode(255); parseExpected(72); node.expression = allowInAnd(parseExpression); parseExpected(55); @@ -16454,7 +16520,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(255); + var node = createNode(256); parseExpected(78); parseExpected(55); node.statements = parseList(3, parseStatement); @@ -16464,12 +16530,12 @@ var ts; return token() === 72 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(219); + var node = createNode(220); parseExpected(97); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); - var caseBlock = createNode(233, scanner.getStartPos()); + var caseBlock = createNode(234, scanner.getStartPos()); parseExpected(16); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(17); @@ -16477,14 +16543,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(221); + var node = createNode(222); parseExpected(99); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(222); + var node = createNode(223); parseExpected(101); node.tryBlock = parseBlock(false); node.catchClause = token() === 73 ? parseCatchClause() : undefined; @@ -16495,7 +16561,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(257); + var result = createNode(258); parseExpected(73); if (parseExpected(18)) { result.variableDeclaration = parseVariableDeclaration(); @@ -16505,7 +16571,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(223); + var node = createNode(224); parseExpected(77); parseSemicolon(); return finishNode(node); @@ -16514,13 +16580,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 && parseOptional(55)) { - var labeledStatement = createNode(220, fullStart); + var labeledStatement = createNode(221, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(208, fullStart); + var expressionStatement = createNode(209, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -16549,7 +16615,7 @@ var ts; case 82: return true; case 108: - case 136: + case 137: return nextTokenIsIdentifierOnSameLine(); case 127: case 128: @@ -16566,7 +16632,7 @@ var ts; return false; } continue; - case 139: + case 140: nextToken(); return token() === 16 || token() === 70 || token() === 83; case 90: @@ -16626,8 +16692,8 @@ var ts; case 108: case 127: case 128: - case 136: - case 139: + case 137: + case 140: return true; case 113: case 111: @@ -16672,9 +16738,9 @@ var ts; case 87: return parseForOrForInOrForOfStatement(); case 76: - return parseBreakOrContinueStatement(215); - case 71: return parseBreakOrContinueStatement(216); + case 71: + return parseBreakOrContinueStatement(217); case 95: return parseReturnStatement(); case 106: @@ -16693,7 +16759,7 @@ var ts; return parseDeclaration(); case 119: case 108: - case 136: + case 137: case 127: case 128: case 123: @@ -16707,7 +16773,7 @@ var ts; case 116: case 114: case 130: - case 139: + case 140: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -16730,11 +16796,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 108: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 136: + case 137: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 82: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 139: + case 140: case 127: case 128: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -16753,7 +16819,7 @@ var ts; } default: if (decorators || modifiers) { - var node = createMissingNode(245, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(246, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -16774,16 +16840,16 @@ var ts; } function parseArrayBindingElement() { if (token() === 25) { - return createNode(198); + return createNode(199); } - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -16799,14 +16865,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(172); + var node = createNode(173); parseExpected(16); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(17); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(173); + var node = createNode(174); parseExpected(20); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(21); @@ -16825,7 +16891,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(224); + var node = createNode(225); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -16834,7 +16900,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(225); + var node = createNode(226); switch (token()) { case 103: break; @@ -16848,7 +16914,7 @@ var ts; ts.Debug.fail(); } nextToken(); - if (token() === 140 && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 141 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -16863,7 +16929,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(206, fullStart); + var node = createNode(207, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(false); @@ -16871,7 +16937,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(226, fullStart); + var node = createNode(227, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88); @@ -16884,7 +16950,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(150, pos); + var node = createNode(151, pos); node.decorators = decorators; node.modifiers = modifiers; parseExpected(122); @@ -16893,7 +16959,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(149, fullStart); + var method = createNode(150, fullStart); method.decorators = decorators; method.modifiers = modifiers; method.asteriskToken = asteriskToken; @@ -16906,7 +16972,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(147, fullStart); + var property = createNode(148, fullStart); property.decorators = decorators; property.modifiers = modifiers; property.name = name; @@ -16976,7 +17042,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 133 || idToken === 124) { + if (!ts.isKeyword(idToken) || idToken === 134 || idToken === 124) { return true; } switch (token()) { @@ -16999,7 +17065,7 @@ var ts; if (!parseOptional(56)) { break; } - var decorator = createNode(145, decoratorStart); + var decorator = createNode(146, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); finishNode(decorator); if (!decorators) { @@ -17056,7 +17122,7 @@ var ts; } function parseClassElement() { if (token() === 24) { - var result = createNode(204); + var result = createNode(205); nextToken(); return finishNode(result); } @@ -17081,16 +17147,16 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_15 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_15, undefined); + var name = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 197); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 198); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 227); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 228); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -17125,7 +17191,7 @@ var ts; } function parseHeritageClause() { if (token() === 84 || token() === 107) { - var node = createNode(256); + var node = createNode(257); node.token = token(); nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -17134,7 +17200,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(199); + var node = createNode(200); node.expression = parseLeftHandSideExpressionOrHigher(); if (token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); @@ -17148,7 +17214,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228, fullStart); + var node = createNode(229, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108); @@ -17159,10 +17225,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229, fullStart); + var node = createNode(230, fullStart); node.decorators = decorators; node.modifiers = modifiers; - parseExpected(136); + parseExpected(137); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(57); @@ -17171,13 +17237,13 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(261, scanner.getStartPos()); + var node = createNode(262, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230, fullStart); + var node = createNode(231, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82); @@ -17192,7 +17258,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(232, scanner.getStartPos()); + var node = createNode(233, scanner.getStartPos()); if (parseExpected(16)) { node.statements = parseList(1, parseStatement); parseExpected(17); @@ -17203,7 +17269,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(231, fullStart); + var node = createNode(232, fullStart); var namespaceFlag = flags & 16; node.decorators = decorators; node.modifiers = modifiers; @@ -17215,10 +17281,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(231, fullStart); + var node = createNode(232, fullStart); node.decorators = decorators; node.modifiers = modifiers; - if (token() === 139) { + if (token() === 140) { node.name = parseIdentifier(); node.flags |= 512; } @@ -17235,7 +17301,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = 0; - if (token() === 139) { + if (token() === 140) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } else if (parseOptional(128)) { @@ -17260,7 +17326,7 @@ var ts; return nextToken() === 40; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(234, fullStart); + var exportDeclaration = createNode(235, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117); @@ -17275,8 +17341,8 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 25 && token() !== 138) { - var importEqualsDeclaration = createNode(235, fullStart); + if (token() !== 25 && token() !== 139) { + var importEqualsDeclaration = createNode(236, fullStart); importEqualsDeclaration.decorators = decorators; importEqualsDeclaration.modifiers = modifiers; importEqualsDeclaration.name = identifier; @@ -17286,27 +17352,27 @@ var ts; return addJSDocComment(finishNode(importEqualsDeclaration)); } } - var importDeclaration = createNode(236, fullStart); + var importDeclaration = createNode(237, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; if (identifier || token() === 38 || token() === 16) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(138); + parseExpected(139); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(237, fullStart); + var importClause = createNode(238, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(25)) { - importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(239); + importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(240); } return finishNode(importClause); } @@ -17316,7 +17382,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(246); + var node = createNode(247); parseExpected(131); parseExpected(18); node.expression = parseModuleSpecifier(); @@ -17334,7 +17400,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(238); + var namespaceImport = createNode(239); parseExpected(38); parseExpected(117); namespaceImport.name = parseIdentifier(); @@ -17342,14 +17408,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 239 ? parseImportSpecifier : parseExportSpecifier, 16, 17); + node.elements = parseBracketedList(22, kind === 240 ? parseImportSpecifier : parseExportSpecifier, 16, 17); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(244); + return parseImportOrExportSpecifier(245); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(240); + return parseImportOrExportSpecifier(241); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -17368,23 +17434,23 @@ var ts; else { node.name = identifierName; } - if (kind === 240 && checkIdentifierIsKeyword) { + if (kind === 241 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(242, fullStart); + var node = createNode(243, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38)) { - parseExpected(138); + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(243); - if (token() === 138 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(138); + node.exportClause = parseNamedImportsOrExports(244); + if (token() === 139 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -17392,7 +17458,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(241, fullStart); + var node = createNode(242, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57)) { @@ -17471,10 +17537,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 235 && node.moduleReference.kind === 246 - || node.kind === 236 - || node.kind === 241 + || node.kind === 236 && node.moduleReference.kind === 247 + || node.kind === 237 || node.kind === 242 + || node.kind === 243 ? node : undefined; }); @@ -17510,7 +17576,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression() { - var result = createNode(263, scanner.getTokenPos()); + var result = createNode(264, scanner.getTokenPos()); parseExpected(16); result.type = parseJSDocTopLevelType(); parseExpected(17); @@ -17521,12 +17587,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48) { - var unionType = createNode(267, type.pos); + var unionType = createNode(268, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57) { - var optionalType = createNode(274, type.pos); + var optionalType = createNode(275, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -17537,20 +17603,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20) { - var arrayType = createNode(266, type.pos); + var arrayType = createNode(267, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21); type = finishNode(arrayType); } else if (token() === 54) { - var nullableType = createNode(269, type.pos); + var nullableType = createNode(270, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50) { - var nonNullableType = createNode(270, type.pos); + var nonNullableType = createNode(271, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -17584,14 +17650,15 @@ var ts; case 98: return parseJSDocThisType(); case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: case 94: - case 137: + case 138: case 129: + case 133: return parseTokenNode(); case 9: case 8: @@ -17602,27 +17669,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(278); + var result = createNode(279); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(277); + var result = createNode(278); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(276); + var result = createNode(277); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(275); + var result = createNode(276); nextToken(); parseExpected(18); result.parameters = parseDelimitedList(23, parseJSDocParameter); @@ -17635,7 +17702,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(144); + var parameter = createNode(145); parameter.type = parseJSDocType(); if (parseOptional(57)) { parameter.questionToken = createNode(57); @@ -17643,7 +17710,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(273); + var result = createNode(274); result.name = parseSimplePropertyName(); if (token() === 26) { result.typeArguments = parseTypeArguments(); @@ -17677,24 +17744,24 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(141, left.pos); + var result = createNode(142, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(271); + var result = createNode(272); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(270); + var result = createNode(271); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(268); + var result = createNode(269); nextToken(); result.types = parseDelimitedList(26, parseJSDocType); checkForTrailingComma(result.types); @@ -17708,7 +17775,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(267); + var result = createNode(268); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19); @@ -17724,12 +17791,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(264); + var result = createNode(265); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(289); + var result = createNode(290); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -17742,11 +17809,11 @@ var ts; token() === 28 || token() === 57 || token() === 48) { - var result = createNode(265, pos); + var result = createNode(266, pos); return finishNode(result); } else { - var result = createNode(269, pos); + var result = createNode(270, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -17890,7 +17957,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(279, start); + var result = createNode(280, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -18000,7 +18067,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(280, atToken.pos); + var result = createNode(281, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -18055,7 +18122,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(282, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -18066,20 +18133,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(284, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -18094,7 +18161,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(287, atToken.pos); + var result = createNode(288, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -18103,7 +18170,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(281, atToken.pos); + var result = createNode(282, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -18112,25 +18179,28 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(286, atToken.pos); + var typedefTag = createNode(287, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); if (typedefTag.fullName) { var rightNode = typedefTag.fullName; - while (rightNode.kind !== 70) { + while (true) { + if (rightNode.kind === 70 || !rightNode.body) { + typedefTag.name = rightNode.kind === 70 ? rightNode : rightNode.name; + break; + } rightNode = rightNode.body; } - typedefTag.name = rightNode; } typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 273) { + if (typeExpression.type.kind === 274) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { - var name_16 = jsDocTypeReference.name; - if (name_16.text === "Object") { + var name = jsDocTypeReference.name; + if (name.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -18144,7 +18214,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(288, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(289, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -18185,7 +18255,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22)) { - var jsDocNamespaceNode = createNode(231, pos); + var jsDocNamespaceNode = createNode(232, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -18229,19 +18299,19 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 285; })) { + if (ts.forEach(tags, function (t) { return t.kind === 286; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); while (true) { - var name_17 = parseJSDocIdentifierName(); + var name = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_17) { + if (!name) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143, name_17.pos); - typeParameter.name = name_17; + var typeParameter = createNode(144, name.pos); + typeParameter.name = name; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25) { @@ -18252,7 +18322,7 @@ var ts; break; } } - var result = createNode(285, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -18571,16 +18641,16 @@ var ts; var ts; (function (ts) { function getModuleInstanceState(node) { - if (node.kind === 228 || node.kind === 229) { + if (node.kind === 229 || node.kind === 230) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 236 || node.kind === 235) && !(ts.hasModifier(node, 1))) { + else if ((node.kind === 237 || node.kind === 236) && !(ts.hasModifier(node, 1))) { return 0; } - else if (node.kind === 232) { + else if (node.kind === 233) { var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -18596,7 +18666,7 @@ var ts; }); return state_1; } - else if (node.kind === 231) { + else if (node.kind === 232) { var body = node.body; return body ? getModuleInstanceState(body) : 1; } @@ -18705,7 +18775,7 @@ var ts; if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 231)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 232)) { symbol.valueDeclaration = node; } } @@ -18715,7 +18785,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 142) { + if (node.name.kind === 143) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; @@ -18726,21 +18796,21 @@ var ts; return node.name.text; } switch (node.kind) { - case 150: + case 151: return "__constructor"; - case 158: - case 153: - return "__call"; case 159: case 154: - return "__new"; + return "__call"; + case 160: case 155: + return "__new"; + case 156: return "__index"; - case 242: + case 243: return "__export"; - case 241: + case 242: return node.isExportEquals ? "export=" : "default"; - case 192: + case 193: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2: return "export="; @@ -18752,20 +18822,20 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 226: case 227: + case 228: return ts.hasModifier(node, 512) ? "default" : undefined; - case 275: + case 276: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 144: - ts.Debug.assert(node.parent.kind === 275); + case 145: + ts.Debug.assert(node.parent.kind === 276); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 286: + case 287: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 206) { + if (parentNode && parentNode.kind === 207) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -18788,13 +18858,16 @@ var ts; symbol = createSymbol(0, "__missing"); } else { - symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0, name)); + symbol = symbolTable.get(name); + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(0, name)); + } if (name && (includes & 788448)) { - classifiableNames[name] = name; + classifiableNames.set(name, name); } if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { - symbol = symbolTable[name] = createSymbol(0, name); + symbolTable.set(name, symbol = createSymbol(0, name)); } else { if (node.name) { @@ -18809,7 +18882,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 241 && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 242 && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -18829,7 +18902,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 244 || (node.kind === 235 && hasExportModifier)) { + if (node.kind === 245 || (node.kind === 236 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -18837,7 +18910,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 286 && + var isJSDocTypedefInJSDocNamespace = node.kind === 287 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -18898,7 +18971,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 262) { + if (node.kind === 263) { node.flags |= emitFlags; } if (isIIFE) { @@ -18974,64 +19047,64 @@ var ts; return; } switch (node.kind) { - case 211: + case 212: bindWhileStatement(node); break; - case 210: + case 211: bindDoStatement(node); break; - case 212: + case 213: bindForStatement(node); break; - case 213: case 214: + case 215: bindForInOrForOfStatement(node); break; - case 209: + case 210: bindIfStatement(node); break; - case 217: - case 221: + case 218: + case 222: bindReturnOrThrow(node); break; + case 217: case 216: - case 215: bindBreakOrContinueStatement(node); break; - case 222: + case 223: bindTryStatement(node); break; - case 219: + case 220: bindSwitchStatement(node); break; - case 233: + case 234: bindCaseBlock(node); break; - case 254: + case 255: bindCaseClause(node); break; - case 220: + case 221: bindLabeledStatement(node); break; - case 190: + case 191: bindPrefixUnaryExpressionFlow(node); break; - case 191: + case 192: bindPostfixUnaryExpressionFlow(node); break; - case 192: + case 193: bindBinaryExpressionFlow(node); break; - case 186: + case 187: bindDeleteExpressionFlow(node); break; - case 193: + case 194: bindConditionalExpressionFlow(node); break; - case 224: + case 225: bindVariableDeclarationFlow(node); break; - case 179: + case 180: bindCallExpressionFlow(node); break; default: @@ -19043,15 +19116,15 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 178: return isNarrowableReference(expr); - case 179: + case 180: return hasNarrowableArgument(expr); - case 183: + case 184: return isNarrowingExpression(expr.expression); - case 192: + case 193: return isNarrowingBinaryExpression(expr); - case 190: + case 191: return expr.operator === 50 && isNarrowingExpression(expr.operand); } return false; @@ -19059,7 +19132,7 @@ var ts; function isNarrowableReference(expr) { return expr.kind === 70 || expr.kind === 98 || - expr.kind === 177 && isNarrowableReference(expr.expression); + expr.kind === 178 && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -19070,14 +19143,14 @@ var ts; } } } - if (expr.expression.kind === 177 && + if (expr.expression.kind === 178 && isNarrowableReference(expr.expression.expression)) { return true; } return false; } function isNarrowingTypeofOperands(expr1, expr2) { - return expr1.kind === 187 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; + return expr1.kind === 188 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { @@ -19098,9 +19171,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 183: + case 184: return isNarrowableOperand(expr.expression); - case 192: + case 193: switch (expr.operatorToken.kind) { case 57: return isNarrowableOperand(expr.left); @@ -19194,33 +19267,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 209: - case 211: case 210: - return parent.expression === node; case 212: - case 193: + case 211: + return parent.expression === node; + case 213: + case 194: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 183) { + if (node.kind === 184) { node = node.expression; } - else if (node.kind === 190 && node.operator === 50) { + else if (node.kind === 191 && node.operator === 50) { node = node.operand; } else { - return node.kind === 192 && (node.operatorToken.kind === 52 || + return node.kind === 193 && (node.operatorToken.kind === 52 || node.operatorToken.kind === 53); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 183 || - node.parent.kind === 190 && + while (node.parent.kind === 184 || + node.parent.kind === 191 && node.parent.operator === 50) { node = node.parent; } @@ -19262,7 +19335,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 220 + var enclosingLabeledStatement = node.parent.kind === 221 ? ts.lastOrUndefined(activeLabels) : undefined; var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); @@ -19297,7 +19370,7 @@ var ts; bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 225) { + if (node.initializer.kind !== 226) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -19319,7 +19392,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 217) { + if (node.kind === 218) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -19339,7 +19412,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 216 ? breakTarget : continueTarget; + var flowLabel = node.kind === 217 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -19396,7 +19469,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 255; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 256; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -19461,13 +19534,13 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 210) { + if (!node.statement || node.statement.kind !== 211) { addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 192 && node.operatorToken.kind === 57) { + if (node.kind === 193 && node.operatorToken.kind === 57) { bindAssignmentTargetFlow(node.left); } else { @@ -19478,10 +19551,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 175) { + else if (node.kind === 176) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 196) { + if (e.kind === 197) { bindAssignmentTargetFlow(e.expression); } else { @@ -19489,16 +19562,16 @@ var ts; } } } - else if (node.kind === 176) { + else if (node.kind === 177) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 258) { + if (p.kind === 259) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 259) { + else if (p.kind === 260) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 260) { + else if (p.kind === 261) { bindAssignmentTargetFlow(p.expression); } } @@ -19554,7 +19627,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 57 && node.left.kind === 178) { + if (operator === 57 && node.left.kind === 179) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -19565,7 +19638,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { bindAssignmentTargetFlow(node.expression); } } @@ -19598,16 +19671,16 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 213 || node.parent.parent.kind === 214) { + if (node.initializer || node.parent.parent.kind === 214 || node.parent.parent.kind === 215) { bindInitializedVariableFlow(node); } } function bindCallExpressionFlow(node) { var expr = node.expression; - while (expr.kind === 183) { + while (expr.kind === 184) { expr = expr.expression; } - if (expr.kind === 184 || expr.kind === 185) { + if (expr.kind === 185 || expr.kind === 186) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -19615,7 +19688,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -19624,52 +19697,52 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 197: - case 227: - case 230: - case 176: - case 161: - case 288: - case 271: - return 1; + case 198: case 228: - return 1 | 64; - case 275: case 231: + case 177: + case 162: + case 289: + case 272: + return 1; case 229: - case 170: + return 1 | 64; + case 276: + case 232: + case 230: + case 171: return 1 | 32; - case 262: + case 263: return 1 | 4 | 32; - case 149: + case 150: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 | 4 | 32 | 8 | 128; } - case 150: - case 226: - case 148: case 151: + case 227: + case 149: case 152: case 153: case 154: case 155: - case 158: + case 156: case 159: + case 160: return 1 | 4 | 32 | 8; - case 184: case 185: + case 186: return 1 | 4 | 32 | 8 | 16; - case 232: + case 233: return 4; - case 147: + case 148: return node.initializer ? 4 : 0; - case 257: - case 212: + case 258: case 213: case 214: - case 233: + case 215: + case 234: return 2; - case 205: + case 206: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -19685,37 +19758,37 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 231: + case 232: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 262: + case 263: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 197: - case 227: + case 198: + case 228: return declareClassMember(node, symbolFlags, symbolExcludes); - case 230: + case 231: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 161: - case 176: - case 228: - case 271: - case 288: + case 162: + case 177: + case 229: + case 272: + case 289: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 158: case 159: - case 153: + case 160: case 154: case 155: - case 149: - case 148: + case 156: case 150: + case 149: case 151: case 152: - case 226: - case 184: + case 153: + case 227: case 185: - case 275: - case 229: - case 170: + case 186: + case 276: + case 230: + case 171: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -19730,11 +19803,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 262 ? node : node.body; - if (body && (body.kind === 262 || body.kind === 232)) { + var body = node.kind === 263 ? node : node.body; + if (body && (body.kind === 263 || body.kind === 233)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 242 || stat.kind === 241) { + if (stat.kind === 243 || stat.kind === 242) { return true; } } @@ -19756,7 +19829,7 @@ var ts; errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (ts.isExternalModuleAugmentation(node)) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); + declareModuleSymbol(node); } else { var pattern = void 0; @@ -19776,12 +19849,8 @@ var ts; } } else { - var state = getModuleInstanceState(node); - if (state === 0) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); - } - else { - declareSymbolAndAddToSymbolTable(node, 512, 106639); + var state = declareModuleSymbol(node); + if (state !== 0) { if (node.symbol.flags & (16 | 32 | 256)) { node.symbol.constEnumOnlyModule = false; } @@ -19797,29 +19866,35 @@ var ts; } } } + function declareModuleSymbol(node) { + var state = getModuleInstanceState(node); + var instantiated = state !== 0; + declareSymbolAndAddToSymbolTable(node, instantiated ? 512 : 1024, instantiated ? 106639 : 0); + return state; + } function bindFunctionOrConstructorType(node) { var symbol = createSymbol(131072, getDeclarationName(node)); addDeclarationToSymbol(symbol, node, 131072); var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048); typeLiteralSymbol.members = ts.createMap(); - typeLiteralSymbol.members[symbol.name] = symbol; + typeLiteralSymbol.members.set(symbol.name, symbol); } function bindObjectLiteralExpression(node) { if (inStrictMode) { var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 260 || prop.name.kind !== 70) { + if (prop.kind === 261 || prop.name.kind !== 70) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 258 || prop.kind === 259 || prop.kind === 149 + var currentKind = prop.kind === 259 || prop.kind === 260 || prop.kind === 150 ? 1 : 2; - var existingKind = seen[identifier.text]; + var existingKind = seen.get(identifier.text); if (!existingKind) { - seen[identifier.text] = currentKind; + seen.set(identifier.text, currentKind); continue; } if (currentKind === 1 && existingKind === 1) { @@ -19836,10 +19911,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 231: + case 232: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 262: + case 263: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -19929,8 +20004,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 262 && - blockScopeContainer.kind !== 231 && + if (blockScopeContainer.kind !== 263 && + blockScopeContainer.kind !== 232 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -19973,7 +20048,7 @@ var ts; node.parent = parent; var saveInStrictMode = inStrictMode; bindWorker(node); - if (node.kind > 140) { + if (node.kind > 141) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -20013,23 +20088,23 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 286) { + while (parentNode && parentNode.kind !== 287) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); break; } case 98: - if (currentFlow && (ts.isExpression(node) || parent.kind === 259)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 260)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 177: + case 178: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } break; - case 192: + case 193: if (ts.isInJavaScriptFile(node)) { var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { @@ -20052,48 +20127,48 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 257: + case 258: return checkStrictModeCatchClause(node); - case 186: + case 187: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 191: + case 192: return checkStrictModePostfixUnaryExpression(node); - case 190: + case 191: return checkStrictModePrefixUnaryExpression(node); - case 218: + case 219: return checkStrictModeWithStatement(node); - case 167: + case 168: seenThisKeyword = true; return; - case 156: + case 157: return checkTypePredicate(node); - case 143: - return declareSymbolAndAddToSymbolTable(node, 262144, 530920); case 144: + return declareSymbolAndAddToSymbolTable(node, 262144, 530920); + case 145: return bindParameter(node); - case 224: - case 174: + case 225: + case 175: return bindVariableDeclarationOrBindingElement(node); + case 148: case 147: - case 146: - case 272: + case 273: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 287: + case 288: return bindJSDocProperty(node); - case 258: case 259: + case 260: return bindPropertyOrMethodOrAccessor(node, 4, 0); - case 261: + case 262: return bindPropertyOrMethodOrAccessor(node, 8, 900095); - case 260: - case 252: + case 261: + case 253: var root = container; var hasRest = false; while (root.parent) { - if (root.kind === 176 && - root.parent.kind === 192 && + if (root.kind === 177 && + root.parent.kind === 193 && root.parent.operatorToken.kind === 57 && root.parent.left === root) { hasRest = true; @@ -20102,78 +20177,78 @@ var ts; root = root.parent; } return; - case 153: case 154: case 155: + case 156: return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 150: case 149: - case 148: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); - case 226: + case 227: return bindFunctionDeclaration(node); - case 150: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 151: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 152: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 153: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 158: case 159: - case 275: + case 160: + case 276: return bindFunctionOrConstructorType(node); - case 161: - case 170: - case 288: - case 271: + case 162: + case 171: + case 289: + case 272: return bindAnonymousDeclaration(node, 2048, "__type"); - case 176: + case 177: return bindObjectLiteralExpression(node); - case 184: case 185: + case 186: return bindFunctionExpression(node); - case 179: + case 180: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 197: - case 227: + case 198: + case 228: inStrictMode = true; return bindClassLikeDeclaration(node); - case 228: + case 229: return bindBlockScopedDeclaration(node, 64, 792968); - case 286: + case 287: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } break; - case 229: - return bindBlockScopedDeclaration(node, 524288, 793064); case 230: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 524288, 793064); case 231: + return bindEnumDeclaration(node); + case 232: return bindModuleDeclaration(node); - case 235: - case 238: - case 240: - case 244: + case 236: + case 239: + case 241: + case 245: return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 234: + case 235: return bindNamespaceExportDeclaration(node); - case 237: + case 238: return bindImportClause(node); - case 242: + case 243: return bindExportDeclaration(node); - case 241: + case 242: return bindExportAssignment(node); - case 262: + case 263: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 205: + case 206: if (!ts.isFunctionLike(node.parent)) { return; } - case 232: + case 233: return updateStrictModeStatementList(node.statements); } } @@ -20182,7 +20257,7 @@ var ts; if (parameterName && parameterName.kind === 70) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 167) { + if (parameterName && parameterName.kind === 168) { seenThisKeyword = true; } bind(type); @@ -20201,7 +20276,7 @@ var ts; bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } else { - var flags = node.kind === 241 && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 242 && ts.exportAssignmentIsAlias(node) ? 8388608 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16); @@ -20211,17 +20286,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 262) { + if (node.parent.kind !== 263) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_5 = node.parent; - if (!ts.isExternalModule(parent_5)) { + var parent_1 = node.parent; + if (!ts.isExternalModule(parent_1)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_5.isDeclarationFile) { + if (!parent_1.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -20260,11 +20335,11 @@ var ts; } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); - if (container.kind === 226 || container.kind === 184) { + if (container.kind === 227 || container.kind === 185) { container.symbol.members = container.symbol.members || ts.createMap(); declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); } - else if (container.kind === 150) { + else if (container.kind === 151) { var saveContainer = container; container = container.parent; var symbol = bindPropertyOrMethodOrAccessor(node, 4, 0); @@ -20281,7 +20356,7 @@ var ts; leftSideOfAssignment.parent = node; constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - var funcSymbol = container.locals[constructorFunction.text]; + var funcSymbol = container.locals.get(constructorFunction.text); if (!funcSymbol || !(funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) { return; } @@ -20296,25 +20371,26 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 227) { + if (node.kind === 228) { bindBlockScopedDeclaration(node, 32, 899519); } else { var bindingName = node.name ? node.name.text : "__class"; bindAnonymousDeclaration(node, 32, bindingName); if (node.name) { - classifiableNames[node.name.text] = node.name.text; + classifiableNames.set(node.name.text, node.name.text); } } var symbol = node.symbol; var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); - if (symbol.exports[prototypeSymbol.name]) { + var symbolExport = symbol.exports.get(prototypeSymbol.name); + if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; + symbol.exports.set(prototypeSymbol.name, prototypeSymbol); prototypeSymbol.parent = symbol; } function bindEnumDeclaration(node) { @@ -20406,15 +20482,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 207) || - node.kind === 227 || - (node.kind === 231 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 230 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 208) || + node.kind === 228 || + (node.kind === 232 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 231 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 206 || + (node.kind !== 207 || ts.getCombinedNodeFlags(node.declarationList) & 3 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -20428,56 +20504,56 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 179: - return computeCallExpression(node, subtreeFlags); case 180: + return computeCallExpression(node, subtreeFlags); + case 181: return computeNewExpression(node, subtreeFlags); - case 231: + case 232: return computeModuleDeclaration(node, subtreeFlags); - case 183: + case 184: return computeParenthesizedExpression(node, subtreeFlags); - case 192: + case 193: return computeBinaryExpression(node, subtreeFlags); - case 208: + case 209: return computeExpressionStatement(node, subtreeFlags); - case 144: + case 145: return computeParameter(node, subtreeFlags); - case 185: + case 186: return computeArrowFunction(node, subtreeFlags); - case 184: + case 185: return computeFunctionExpression(node, subtreeFlags); - case 226: + case 227: return computeFunctionDeclaration(node, subtreeFlags); - case 224: - return computeVariableDeclaration(node, subtreeFlags); case 225: + return computeVariableDeclaration(node, subtreeFlags); + case 226: return computeVariableDeclarationList(node, subtreeFlags); - case 206: + case 207: return computeVariableStatement(node, subtreeFlags); - case 220: + case 221: return computeLabeledStatement(node, subtreeFlags); - case 227: + case 228: return computeClassDeclaration(node, subtreeFlags); - case 197: + case 198: return computeClassExpression(node, subtreeFlags); - case 256: - return computeHeritageClause(node, subtreeFlags); case 257: + return computeHeritageClause(node, subtreeFlags); + case 258: return computeCatchClause(node, subtreeFlags); - case 199: + case 200: return computeExpressionWithTypeArguments(node, subtreeFlags); - case 150: + case 151: return computeConstructor(node, subtreeFlags); - case 147: + case 148: return computePropertyDeclaration(node, subtreeFlags); - case 149: + case 150: return computeMethod(node, subtreeFlags); - case 151: case 152: + case 153: return computeAccessor(node, subtreeFlags); - case 235: + case 236: return computeImportEquals(node, subtreeFlags); - case 177: + case 178: return computePropertyAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -20502,8 +20578,8 @@ var ts; switch (kind) { case 96: return true; - case 177: case 178: + case 179: var expression = node.expression; var expressionKind = expression.kind; return expressionKind === 96; @@ -20525,10 +20601,10 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 57 && leftKind === 176) { + if (operatorTokenKind === 57 && leftKind === 177) { transformFlags |= 8 | 192 | 3072; } - else if (operatorTokenKind === 57 && leftKind === 175) { + else if (operatorTokenKind === 57 && leftKind === 176) { transformFlags |= 192 | 3072; } else if (operatorTokenKind === 39 @@ -20567,8 +20643,8 @@ var ts; var expression = node.expression; var expressionKind = expression.kind; var expressionTransformFlags = expression.transformFlags; - if (expressionKind === 200 - || expressionKind === 182) { + if (expressionKind === 201 + || expressionKind === 183) { transformFlags |= 3; } if (expressionTransformFlags & 1024) { @@ -20854,7 +20930,7 @@ var ts; var excludeFlags = 536872257; switch (kind) { case 119: - case 189: + case 190: transformFlags |= 16; break; case 113: @@ -20863,51 +20939,51 @@ var ts; case 116: case 123: case 75: - case 230: - case 261: - case 182: - case 200: + case 231: + case 262: + case 183: case 201: + case 202: case 130: transformFlags |= 3; break; - case 247: case 248: case 249: - case 10: case 250: + case 10: case 251: case 252: case 253: + case 254: transformFlags |= 4; break; - case 214: + case 215: transformFlags |= 8; case 12: case 13: case 14: case 15: - case 194: - case 181: - case 259: + case 195: + case 182: + case 260: case 114: - case 202: + case 203: transformFlags |= 192; break; - case 195: + case 196: transformFlags |= 192 | 16777216; break; case 118: case 132: case 129: - case 134: - case 121: + case 133: case 135: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: case 156: @@ -20921,26 +20997,27 @@ var ts; case 164: case 165: case 166: - case 228: - case 229: case 167: + case 229: + case 230: case 168: case 169: case 170: case 171: + case 172: transformFlags = 3; excludeFlags = -3; break; - case 142: + case 143: transformFlags |= 2097152; if (subtreeFlags & 16384) { transformFlags |= 65536; } break; - case 196: + case 197: transformFlags |= 192 | 524288; break; - case 260: + case 261: transformFlags |= 8 | 1048576; break; case 96: @@ -20949,27 +21026,27 @@ var ts; case 98: transformFlags |= 16384; break; - case 172: + case 173: transformFlags |= 192 | 8388608; if (subtreeFlags & 524288) { transformFlags |= 8 | 1048576; } excludeFlags = 537396545; break; - case 173: + case 174: transformFlags |= 192 | 8388608; excludeFlags = 537396545; break; - case 174: + case 175: transformFlags |= 192; if (node.dotDotDotToken) { transformFlags |= 524288; } break; - case 145: + case 146: transformFlags |= 3 | 4096; break; - case 176: + case 177: excludeFlags = 540087617; if (subtreeFlags & 2097152) { transformFlags |= 192; @@ -20981,29 +21058,29 @@ var ts; transformFlags |= 8; } break; - case 175: - case 180: + case 176: + case 181: excludeFlags = 537396545; if (subtreeFlags & 524288) { transformFlags |= 192; } break; - case 210: case 211: case 212: case 213: + case 214: if (subtreeFlags & 4194304) { transformFlags |= 192; } break; - case 262: + case 263: if (subtreeFlags & 32768) { transformFlags |= 192; } break; - case 217: - case 215: + case 218: case 216: + case 217: transformFlags |= 33554432; break; } @@ -21011,56 +21088,57 @@ var ts; return transformFlags & ~excludeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 156 && kind <= 171) { + if (kind >= 157 && kind <= 172) { return -3; } switch (kind) { - case 179: case 180: - case 175: + case 181: + case 176: return 537396545; - case 231: + case 232: return 574674241; - case 144: + case 145: return 536872257; - case 185: + case 186: return 601249089; - case 184: - case 226: + case 185: + case 227: return 601281857; - case 225: + case 226: return 546309441; - case 227: - case 197: + case 228: + case 198: return 539358529; - case 150: - return 601015617; - case 149: case 151: + return 601015617; + case 150: case 152: + case 153: return 601015617; case 118: case 132: case 129: - case 134: - case 121: case 135: + case 133: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: - case 228: + case 156: case 229: + case 230: return -3; - case 176: + case 177: return 540087617; - case 257: + case 258: return 537920833; - case 172: case 173: + case 174: return 537396545; default: return 536872257; @@ -21132,6 +21210,7 @@ var ts; getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, getTypeFromTypeNode: getTypeFromTypeNode, + getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, @@ -21156,6 +21235,7 @@ var ts; getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule, getAmbientModules: getAmbientModules, getJsxElementAttributesType: getJsxElementAttributesType, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, @@ -21191,6 +21271,7 @@ var ts; var voidType = createIntrinsicType(1024, "void"); var neverType = createIntrinsicType(8192, "never"); var silentNeverType = createIntrinsicType(8192, "never"); + var nonPrimitiveType = createIntrinsicType(16777216, "object"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); @@ -21200,6 +21281,7 @@ var ts; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); @@ -21261,7 +21343,7 @@ var ts; var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); - var typeofEQFacts = ts.createMap({ + var typeofEQFacts = ts.createMapFromTemplate({ "string": 1, "number": 2, "boolean": 4, @@ -21270,7 +21352,7 @@ var ts; "object": 16, "function": 32 }); - var typeofNEFacts = ts.createMap({ + var typeofNEFacts = ts.createMapFromTemplate({ "string": 128, "number": 256, "boolean": 512, @@ -21279,7 +21361,7 @@ var ts; "object": 2048, "function": 4096 }); - var typeofTypesByName = ts.createMap({ + var typeofTypesByName = ts.createMapFromTemplate({ "string": stringType, "number": numberType, "boolean": booleanType, @@ -21306,7 +21388,7 @@ var ts; var enumRelation = ts.createMap(); var _displayBuilder; var builtinGlobals = ts.createMap(); - builtinGlobals[undefinedSymbol.name] = undefinedSymbol; + builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); initializeTypeChecker(); return checker; function getJsxNamespace() { @@ -21404,7 +21486,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 231 && source.valueDeclaration.kind !== 231))) { + (target.valueDeclaration.kind === 232 && source.valueDeclaration.kind !== 232))) { target.valueDeclaration = source.valueDeclaration; } ts.addRange(target.declarations, source.declarations); @@ -21420,6 +21502,9 @@ var ts; } recordMergedSymbol(target, source); } + else if (target.flags & 1024) { + error(source.valueDeclaration.name, ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } else { var message_2 = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; @@ -21432,18 +21517,19 @@ var ts; } } function mergeSymbolTable(target, source) { - for (var id in source) { - var targetSymbol = target[id]; + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); if (!targetSymbol) { - target[id] = source[id]; + target.set(id, sourceSymbol); } else { if (!(targetSymbol.flags & 33554432)) { - target[id] = targetSymbol = cloneSymbol(targetSymbol); + targetSymbol = cloneSymbol(targetSymbol); + target.set(id, targetSymbol); } - mergeSymbol(targetSymbol, source[id]); + mergeSymbol(targetSymbol, sourceSymbol); } - } + }); } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; @@ -21473,14 +21559,15 @@ var ts; } } function addToSymbolTable(target, source, message) { - for (var id in source) { - if (target[id]) { - ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); + if (targetSymbol) { + ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); } else { - target[id] = source[id]; + target.set(id, sourceSymbol); } - } + }); function addDeclarationDiagnostic(id, message) { return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; } @@ -21499,11 +21586,11 @@ var ts; return type.flags & 32768 ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 262 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 263 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { - var symbol = symbols[name]; + var symbol = symbols.get(name); if (symbol) { ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { @@ -21543,15 +21630,15 @@ var ts; return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - if (declaration.kind === 174) { - var errorBindingElement = ts.getAncestor(usage, 174); + if (declaration.kind === 175) { + var errorBindingElement = ts.getAncestor(usage, 175); if (errorBindingElement) { return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || declaration.pos < errorBindingElement.pos; } - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 224), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 225), usage); } - else if (declaration.kind === 224) { + else if (declaration.kind === 225) { return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } return true; @@ -21561,17 +21648,17 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 206: - case 212: - case 214: + case 207: + case 213: + case 215: if (isSameScopeDescendentOf(usage, declaration, container)) { return true; } break; } switch (declaration.parent.parent.kind) { - case 213: case 214: + case 215: if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; } @@ -21588,7 +21675,7 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 147 && + current.parent.kind === 148 && (ts.getModifierFlags(current.parent) & 32) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { @@ -21620,18 +21707,18 @@ var ts; if (result = getSymbol(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 279) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 280) { useResult = result.flags & 262144 ? lastLocation === location.type || - lastLocation.kind === 144 || - lastLocation.kind === 143 + lastLocation.kind === 145 || + lastLocation.kind === 144 : false; } if (meaning & 107455 && result.flags & 1) { useResult = - lastLocation.kind === 144 || + lastLocation.kind === 145 || (lastLocation === location.type && - result.valueDeclaration.kind === 144); + result.valueDeclaration.kind === 145); } } if (useResult) { @@ -21643,23 +21730,24 @@ var ts; } } switch (location.kind) { - case 262: + case 263: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 231: + case 232: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 262 || ts.isAmbientModule(location)) { - if (result = moduleExports["default"]) { + if (location.kind === 263 || ts.isAmbientModule(location)) { + if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; } - if (moduleExports[name] && - moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 244)) { + var moduleExport = moduleExports.get(name); + if (moduleExport && + moduleExport.flags === 8388608 && + ts.getDeclarationOfKind(moduleExport, 245)) { break; } } @@ -21667,13 +21755,13 @@ var ts; break loop; } break; - case 230: + case 231: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 148: case 147: - case 146: if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -21683,9 +21771,9 @@ var ts; } } break; - case 227: - case 197: case 228: + case 198: + case 229: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) { if (lastLocation && ts.getModifierFlags(lastLocation) & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -21693,7 +21781,7 @@ var ts; } break loop; } - if (location.kind === 197 && meaning & 32) { + if (location.kind === 198 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -21701,28 +21789,28 @@ var ts; } } break; - case 142: + case 143: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 228) { + if (ts.isClassLike(grandparent) || grandparent.kind === 229) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 226: - case 185: + case 153: + case 227: + case 186: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 184: + case 185: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -21735,8 +21823,8 @@ var ts; } } break; - case 145: - if (location.parent && location.parent.kind === 144) { + case 146: + if (location.parent && location.parent.kind === 145) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -21779,7 +21867,7 @@ var ts; } if (result && isInExternalModule && (meaning & 107455) === 107455) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 234) { + if (decls && decls.length === 1 && decls[0].kind === 235) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } @@ -21826,9 +21914,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 70: - case 177: + case 178: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 199: + case 200: ts.Debug.assert(ts.isEntityNameExpression(node.expression)); return node.expression; default: @@ -21876,10 +21964,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 235) { + if (node.kind === 236) { return node; } - while (node && node.kind !== 236) { + while (node && node.kind !== 237) { node = node.parent; } return node; @@ -21889,7 +21977,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 246) { + if (node.moduleReference.kind === 247) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); @@ -21897,11 +21985,16 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ? - moduleSymbol : - moduleSymbol.exports["export="] ? - getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : - resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = void 0; + if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } + else { + var exportValue = moduleSymbol.exports.get("export="); + exportDefaultSymbol = exportValue + ? getPropertyOfType(getTypeOfSymbol(exportValue), "default") + : resolveSymbol(moduleSymbol.exports.get("default")); + } if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } @@ -21932,7 +22025,7 @@ var ts; } function getExportOfModule(symbol, name) { if (symbol.flags & 1536) { - var exportedSymbol = getExportsOfSymbol(symbol)[name]; + var exportedSymbol = getExportsOfSymbol(symbol).get(name); if (exportedSymbol) { return resolveSymbol(exportedSymbol); } @@ -21950,28 +22043,28 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_18 = specifier.propertyName || specifier.name; - if (name_18.text) { + var name = specifier.propertyName || specifier.name; + if (name.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; - if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_18.text); + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_18.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); } symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_18.text); - if (!symbolFromModule && allowSyntheticDefaultImports && name_18.text === "default") { + var symbolFromModule = getExportOfModule(targetSymbol, name.text); + if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_18, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_18)); + error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); } return symbol; } @@ -21993,19 +22086,19 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 235: + case 236: return getTargetOfImportEqualsDeclaration(node); - case 237: - return getTargetOfImportClause(node); case 238: + return getTargetOfImportClause(node); + case 239: return getTargetOfNamespaceImport(node); - case 240: + case 241: return getTargetOfImportSpecifier(node); - case 244: + case 245: return getTargetOfExportSpecifier(node); - case 241: + case 242: return getTargetOfExportAssignment(node); - case 234: + case 235: return getTargetOfNamespaceExportDeclaration(node); } } @@ -22049,10 +22142,10 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 241) { + if (node.kind === 242) { checkExpressionCached(node.expression); } - else if (node.kind === 244) { + else if (node.kind === 245) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -22064,11 +22157,11 @@ var ts; if (entityName.kind === 70 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 70 || entityName.parent.kind === 141) { + if (entityName.kind === 70 || entityName.parent.kind === 142) { return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 235); + ts.Debug.assert(entityName.parent.kind === 236); return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias); } } @@ -22087,9 +22180,9 @@ var ts; return undefined; } } - else if (name.kind === 141 || name.kind === 177) { - var left = name.kind === 141 ? name.left : name.expression; - var right = name.kind === 141 ? name.right : name.name; + else if (name.kind === 142 || name.kind === 178) { + var left = name.kind === 142 ? name.left : name.expression; + var right = name.kind === 142 ? name.right : name.name; var namespace = resolveEntityName(left, 1920, ignoreErrors, false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -22179,7 +22272,7 @@ var ts; return undefined; } function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="))) || moduleSymbol; } function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { var symbol = resolveExternalModuleSymbol(moduleSymbol); @@ -22190,15 +22283,23 @@ var ts; return symbol; } function hasExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="] !== undefined; + return moduleSymbol.exports.get("export=") !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function getExportsAndPropertiesOfModule(moduleSymbol) { + var exports = getExportsOfModuleAsArray(moduleSymbol); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + ts.addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))); + } + return exports; + } function tryGetMemberInModuleExports(memberName, moduleSymbol) { var symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { - return symbolTable[memberName]; + return symbolTable.get(memberName); } } function getExportsOfSymbol(symbol) { @@ -22209,24 +22310,28 @@ var ts; return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } function extendExportSymbols(target, source, lookupTable, exportNode) { - for (var id in source) { - if (id !== "default" && !target[id]) { - target[id] = source[id]; + source && source.forEach(function (sourceSymbol, id) { + if (id === "default") + return; + var targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); if (lookupTable && exportNode) { - lookupTable[id] = { + lookupTable.set(id, { specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) - }; + }); } } - else if (lookupTable && exportNode && id !== "default" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { - if (!lookupTable[id].exportsWithDuplicate) { - lookupTable[id].exportsWithDuplicate = [exportNode]; + else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + var collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; } else { - lookupTable[id].exportsWithDuplicate.push(exportNode); + collisionTracker.exportsWithDuplicate.push(exportNode); } } - } + }); } function getExportsForModule(moduleSymbol) { var visitedSymbols = []; @@ -22238,26 +22343,26 @@ var ts; } visitedSymbols.push(symbol); var symbols = ts.cloneMap(symbol.exports); - var exportStars = symbol.exports["__export"]; + var exportStars = symbol.exports.get("__export"); if (exportStars) { var nestedSymbols = ts.createMap(); - var lookupTable = ts.createMap(); + var lookupTable_1 = ts.createMap(); for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); var exportedSymbols = visit(resolvedModule); - extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node); } - for (var id in lookupTable) { - var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; - if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) { - continue; + lookupTable_1.forEach(function (_a, id) { + var exportsWithDuplicate = _a.exportsWithDuplicate; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; } - for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { - var node = exportsWithDuplicate_1[_b]; - diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { + var node = exportsWithDuplicate_1[_i]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, id)); } - } + }); extendExportSymbols(symbols, nestedSymbols); } return symbols; @@ -22294,7 +22399,7 @@ var ts; var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 150 && ts.nodeIsPresent(member.body)) { + if (member.kind === 151 && ts.nodeIsPresent(member.body)) { return member; } } @@ -22330,16 +22435,15 @@ var ts; } function getNamedMembers(members) { var result; - for (var id in members) { + members.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { if (!result) result = []; - var symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } } - } + }); return result || emptyArray; } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { @@ -22358,19 +22462,19 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { - if (location_1.locals && !isGlobalSourceFile(location_1)) { - if (result = callback(location_1.locals)) { + for (var location = enclosingDeclaration; location; location = location.parent) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { return result; } } - switch (location_1.kind) { - case 262: - if (!ts.isExternalOrCommonJsModule(location_1)) { + switch (location.kind) { + case 263: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 231: - if (result = callback(getSymbolOfNode(location_1).exports)) { + case 232: + if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; @@ -22407,13 +22511,13 @@ var ts; } } function trySymbolTable(symbols) { - if (isAccessible(symbols[symbol.name])) { + if (isAccessible(symbols.get(symbol.name))) { return [symbol]; } - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { + return ts.forEachEntry(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -22438,14 +22542,14 @@ var ts; function needsQualification(symbol, enclosingDeclaration, meaning) { var qualify = false; forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { - var symbolFromSymbolTable = symbolTable[symbol.name]; + var symbolFromSymbolTable = symbolTable.get(symbol.name); if (!symbolFromSymbolTable) { return false; } if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -22459,10 +22563,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 147: - case 149: - case 151: + case 148: + case 150: case 152: + case 153: continue; default: return false; @@ -22518,7 +22622,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 262 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 263 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -22552,11 +22656,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 160 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === 161 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning = 107455 | 1048576; } - else if (entityName.kind === 141 || entityName.kind === 177 || - entityName.parent.kind === 235) { + else if (entityName.kind === 142 || entityName.kind === 178 || + entityName.parent.kind === 236) { meaning = 1920; } else { @@ -22648,10 +22752,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 166) { + while (node.kind === 167) { node = node.parent; } - if (node.kind === 229) { + if (node.kind === 230) { return getSymbolOfNode(node); } } @@ -22659,29 +22763,29 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 232 && + node.parent.kind === 233 && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { return type.flags & 32 ? "\"" + ts.escapeString(type.text) + "\"" : type.text; } - function getSymbolDisplayBuilder() { - function getNameOfSymbol(symbol) { - if (symbol.declarations && symbol.declarations.length) { - var declaration = symbol.declarations[0]; - if (declaration.name) { - return ts.declarationNameToString(declaration.name); - } - switch (declaration.kind) { - case 197: - return "(Anonymous class)"; - case 184: - case 185: - return "(Anonymous function)"; - } + function getNameOfSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + switch (declaration.kind) { + case 198: + return "(Anonymous class)"; + case 185: + case 186: + return "(Anonymous function)"; } - return symbol.name; } + return symbol.name; + } + function getSymbolDisplayBuilder() { function appendSymbolNameOnly(symbol, writer) { writer.writeSymbol(getNameOfSymbol(symbol), symbol); } @@ -22728,9 +22832,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_6) { - walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false); + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + walkSymbol(parent, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -22760,7 +22864,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { var nextFlags = flags & ~512; - if (type.flags & 16015) { + if (type.flags & 16793231) { writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type) ? "any" : type.intrinsicName); @@ -22863,12 +22967,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); + writeSymbolTypeReference(parent, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -22894,7 +22998,8 @@ var ts; function writeAnonymousType(type, flags) { var symbol = type.symbol; if (symbol) { - if (symbol.flags & (32 | 384 | 512)) { + if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 | 512)) { writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -22927,7 +23032,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 262 || declaration.parent.kind === 232; + return declaration.parent.kind === 263 || declaration.parent.kind === 233; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -23109,12 +23214,12 @@ var ts; buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { writePunctuation(writer, 16); buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 17); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { writePunctuation(writer, 20); var elements = bindingPattern.elements; buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); @@ -23128,7 +23233,7 @@ var ts; if (ts.isOmittedExpression(bindingElement)) { return; } - ts.Debug.assert(bindingElement.kind === 174); + ts.Debug.assert(bindingElement.kind === 175); if (bindingElement.propertyName) { writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55); @@ -23250,7 +23355,7 @@ var ts; writeKeyword(writer, 132); break; case 0: - writeKeyword(writer, 134); + writeKeyword(writer, 135); break; } writePunctuation(writer, 21); @@ -23286,63 +23391,63 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174: + case 175: return isDeclarationVisible(node.parent.parent); - case 224: + case 225: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 231: - case 227: + case 232: case 228: case 229: - case 226: case 230: - case 235: + case 227: + case 231: + case 236: if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_8 = getDeclarationContainer(node); + var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 235 && parent_8.kind !== 262 && ts.isInAmbientContext(parent_8))) { - return isGlobalSourceFile(parent_8); + !(node.kind !== 236 && parent.kind !== 263 && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent); } - return isDeclarationVisible(parent_8); + return isDeclarationVisible(parent); + case 148: case 147: - case 146: - case 151: case 152: + case 153: + case 150: case 149: - case 148: if (ts.getModifierFlags(node) & (8 | 16)) { return false; } - case 150: - case 154: - case 153: + case 151: case 155: - case 144: - case 232: - case 158: + case 154: + case 156: + case 145: + case 233: case 159: - case 161: - case 157: + case 160: case 162: + case 158: case 163: case 164: case 165: case 166: + case 167: return isDeclarationVisible(node.parent); - case 237: case 238: - case 240: + case 239: + case 241: return false; - case 143: - case 262: - case 234: + case 144: + case 263: + case 235: return true; - case 241: + case 242: return false; default: return false; @@ -23351,10 +23456,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 241) { + if (node.parent && node.parent.kind === 242) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 244) { + else if (node.parent.kind === 245) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -23432,12 +23537,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 224: case 225: + case 226: + case 241: case 240: case 239: case 238: - case 237: node = node.parent; break; default: @@ -23461,7 +23566,7 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); } function isComputedNonLiteralName(name) { - return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression); + return name.kind === 143 && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { source = filterType(source, function (t) { return !(t.flags & 6144); }); @@ -23474,17 +23579,16 @@ var ts; var members = ts.createMap(); var names = ts.createMap(); for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_19 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_19)] = true; + var name = properties_2[_i]; + names.set(ts.getTextOfPropertyName(name), true); } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; - var inNamesToRemove = prop.name in names; + var inNamesToRemove = names.has(prop.name); var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16); - var isMethod = prop.flags & 8192; var isSetOnlyAccessor = prop.flags & 65536 && !(prop.flags & 32768); - if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { - members[prop.name] = prop; + if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { + members.set(prop.name, prop); } } var stringIndexInfo = getIndexInfoOfType(source, 0); @@ -23504,7 +23608,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 172) { + if (pattern.kind === 173) { if (declaration.dotDotDotToken) { if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); @@ -23520,19 +23624,19 @@ var ts; type = getRestType(parentType, literalMembers, declaration.symbol); } else { - var name_20 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_20)) { + var name = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name)) { return anyType; } if (declaration.initializer) { getContextualType(declaration.initializer); } - var text = ts.getTextOfPropertyName(name_20); + var text = ts.getTextOfPropertyName(name); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_20)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } @@ -23578,7 +23682,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 175 && expr.elements.length === 0; + return expr.kind === 176 && expr.elements.length === 0; } function addOptionality(type, optional) { return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type; @@ -23590,11 +23694,11 @@ var ts; return type; } } - if (declaration.parent.parent.kind === 213) { + if (declaration.parent.parent.kind === 214) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 | 262144) ? indexType : stringType; } - if (declaration.parent.parent.kind === 214) { + if (declaration.parent.parent.kind === 215) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -23604,7 +23708,7 @@ var ts; return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); } if ((compilerOptions.noImplicitAny || declaration.flags & 65536) && - declaration.kind === 224 && !ts.isBindingPattern(declaration.name) && + declaration.kind === 225 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -23613,10 +23717,10 @@ var ts; return autoArrayType; } } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var func = declaration.parent; - if (func.kind === 152 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151); + if (func.kind === 153 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 152); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -23642,7 +23746,7 @@ var ts; var type = checkDeclarationInitializer(declaration); return addOptionality(type, declaration.questionToken && includeOptionality); } - if (declaration.kind === 259) { + if (declaration.kind === 260) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -23681,7 +23785,7 @@ var ts; var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members[symbol.name] = symbol; + members.set(symbol.name, symbol); }); var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { @@ -23707,7 +23811,7 @@ var ts; return result; } function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 172 + return pattern.kind === 173 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -23717,7 +23821,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 258) { + if (declaration.kind === 259) { return type; } return getWidenedType(type); @@ -23732,7 +23836,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 144 ? root.parent : root; + var memberDeclaration = root.kind === 145 ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol) { @@ -23745,25 +23849,25 @@ var ts; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } - if (declaration.kind === 241) { + if (declaration.kind === 242) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 65536 && declaration.kind === 287 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 288 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { return unknownType; } var type = void 0; - if (declaration.kind === 192 || - declaration.kind === 177 && declaration.parent.kind === 192) { + if (declaration.kind === 193 || + declaration.kind === 178 && declaration.parent.kind === 193) { if (declaration.flags & 65536) { var jsdocType = ts.getJSDocType(declaration.parent); if (jsdocType) { return links.type = getTypeFromTypeNode(jsdocType); } } - var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ? + var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 193 ? checkExpressionCached(decl.right) : checkExpressionCached(decl.parent.right); }); type = getUnionType(declaredTypes, true); @@ -23780,7 +23884,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 151) { + if (accessor.kind === 152) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -23800,8 +23904,8 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - var getter = ts.getDeclarationOfKind(symbol, 151); - var setter = ts.getDeclarationOfKind(symbol, 152); + var getter = ts.getDeclarationOfKind(symbol, 152); + var setter = ts.getDeclarationOfKind(symbol, 153); if (getter && getter.flags & 65536) { var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); if (jsDocType) { @@ -23842,7 +23946,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 151); + var getter_1 = ts.getDeclarationOfKind(symbol, 152); 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)); } } @@ -23850,6 +23954,10 @@ var ts; } return links.type; } + function getBaseTypeVariableOfClass(symbol) { + var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); + return baseConstructorType.flags & 540672 ? baseConstructorType : undefined; + } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -23858,8 +23966,13 @@ var ts; } else { var type = createObjectType(16, symbol); - links.type = strictNullChecks && symbol.flags & 536870912 ? - includeFalsyTypes(type, 2048) : type; + if (symbol.flags & 32) { + var baseTypeVariable = getBaseTypeVariableOfClass(symbol); + links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; + } + else { + links.type = strictNullChecks && symbol.flags & 536870912 ? includeFalsyTypes(type, 2048) : type; + } } } return links.type; @@ -23932,8 +24045,13 @@ var ts; function hasBaseType(type, checkBase) { return check(type); function check(type) { - var target = getTargetType(type); - return target === checkBase || ts.forEach(getBaseTypes(target), check); + if (getObjectFlags(type) & (3 | 4)) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(getBaseTypes(target), check); + } + else if (type.flags & 131072) { + return ts.forEach(type.types, check); + } } } function appendTypeParameters(typeParameters, declarations) { @@ -23955,9 +24073,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 227 || node.kind === 197 || - node.kind === 226 || node.kind === 184 || - node.kind === 149 || node.kind === 185) { + if (node.kind === 228 || node.kind === 198 || + node.kind === 227 || node.kind === 185 || + node.kind === 150 || node.kind === 186) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -23966,15 +24084,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 228); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 229); 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 === 228 || node.kind === 227 || - node.kind === 197 || node.kind === 229) { + if (node.kind === 229 || node.kind === 228 || + node.kind === 198 || node.kind === 230) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -23986,8 +24104,23 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); } + function isMixinConstructorType(type) { + var signatures = getSignaturesOfType(type, 1); + if (signatures.length === 1) { + var s = signatures[0]; + return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType; + } + return false; + } function isConstructorType(type) { - return type.flags & 32768 && getSignaturesOfType(type, 1).length > 0; + if (isValidBaseType(type) && getSignaturesOfType(type, 1).length > 0) { + return true; + } + if (type.flags & 540672) { + var constraint = getBaseConstraintOfType(type); + return isValidBaseType(constraint) && isMixinConstructorType(constraint); + } + return false; } function getBaseTypeNodeOfClass(type) { return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); @@ -24014,7 +24147,7 @@ var ts; return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072)) { resolveStructuredTypeMembers(baseConstructorType); } if (!popTypeResolution()) { @@ -24050,8 +24183,8 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseConstructorType = getBaseConstructorTypeOfClass(type); - if (!(baseConstructorType.flags & 32768)) { + var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); + if (!(baseConstructorType.flags & (32768 | 131072))) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -24079,7 +24212,7 @@ var ts; if (baseType === unknownType) { return; } - if (!(getObjectFlags(getTargetType(baseType)) & 3)) { + if (!isValidBaseType(baseType)) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); return; } @@ -24103,16 +24236,20 @@ var ts; } return true; } + function isValidBaseType(type) { + return type.flags & 32768 && !isGenericMappedType(type) || + type.flags & 131072 && !ts.forEach(type.types, function (t) { return !isValidBaseType(t); }); + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 228 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 229 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { - if (getObjectFlags(getTargetType(baseType)) & 3) { + if (isValidBaseType(baseType)) { if (type !== baseType && !hasBaseType(baseType, type)) { if (type.resolvedBaseTypes === emptyArray) { type.resolvedBaseTypes = [baseType]; @@ -24136,7 +24273,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 228) { + if (declaration.kind === 229) { if (declaration.flags & 64) { return false; } @@ -24169,7 +24306,7 @@ var ts; type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -24186,7 +24323,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 286); + var declaration = ts.getDeclarationOfKind(symbol, 287); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -24197,7 +24334,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 229); + declaration = ts.getDeclarationOfKind(symbol, 230); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -24205,7 +24342,7 @@ var ts; if (typeParameters) { links.typeParameters = typeParameters; links.instantiations = ts.createMap(); - links.instantiations[getTypeListId(typeParameters)] = type; + links.instantiations.set(getTypeListId(typeParameters), type); } } else { @@ -24222,14 +24359,14 @@ var ts; return !ts.isInAmbientContext(member); } return expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8 || - expr.kind === 70 && !!symbol.exports[expr.text]; + expr.kind === 70 && !!symbol.exports.get(expr.text); } function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 230) { + if (declaration.kind === 231) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -24254,10 +24391,10 @@ var ts; enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { var memberTypeList = []; - var memberTypes = ts.createMap(); + var memberTypes = []; for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 230) { + if (declaration.kind === 231) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -24274,7 +24411,7 @@ var ts; if (memberTypeList.length > 1) { enumType.flags |= 65536; enumType.types = memberTypeList; - unionTypes[getTypeListId(memberTypeList)] = enumType; + unionTypes.set(getTypeListId(memberTypeList), enumType); } } } @@ -24295,9 +24432,6 @@ var ts; if (!links.declaredType) { var type = createType(16384); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 143).constraint) { - type.constraint = noConstraintType; - } links.declaredType = type; } return links.declaredType; @@ -24310,7 +24444,6 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 16777216) === 0); if (symbol.flags & (32 | 64)) { return getDeclaredTypeOfClassOrInterface(symbol); } @@ -24345,19 +24478,20 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: + case 133: case 104: - case 137: + case 138: case 94: case 129: - case 171: + case 172: return true; - case 162: + case 163: return isIndependentType(node.elementType); - case 157: + case 158: return isIndependentTypeReference(node); } return false; @@ -24366,7 +24500,7 @@ var ts; return node.type && isIndependentType(node.type) || !node.type && !node.initializer; } function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 150 && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 151 && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -24382,12 +24516,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { + case 148: case 147: - case 146: return isIndependentVariableLikeDeclaration(declaration); - case 149: - case 148: case 150: + case 149: + case 151: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -24398,7 +24532,7 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; - result[symbol.name] = symbol; + result.set(symbol.name, symbol); } return result; } @@ -24406,15 +24540,15 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; - result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; - if (!symbols[s.name]) { - symbols[s.name] = s; + if (!symbols.has(s.name)) { + symbols.set(s.name, s); } } } @@ -24422,8 +24556,8 @@ var ts; if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get("__call")); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get("__new")); type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0); type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1); } @@ -24431,7 +24565,14 @@ var ts; } function getTypeWithThisArgument(type, thisArgument) { if (getObjectFlags(type) & 4) { - return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + var target = type.target; + var typeArguments = type.typeArguments; + if (ts.length(target.typeParameters) === ts.length(typeArguments)) { + return createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType])); + } + } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument); })); } return type; } @@ -24467,7 +24608,7 @@ var ts; for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0); @@ -24612,17 +24753,44 @@ var ts; function unionSpreadIndexInfos(info1, info2) { return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly); } + function includeMixinType(type, types, index) { + var mixedTypes = []; + for (var i = 0; i < types.length; i++) { + if (i === index) { + mixedTypes.push(type); + } + else if (isMixinConstructorType(types[i])) { + mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1)[0])); + } + } + return getIntersectionType(mixedTypes); + } function resolveIntersectionTypeMembers(type) { var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexInfo = undefined; - var numberIndexInfo = undefined; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; + var stringIndexInfo; + var numberIndexInfo; + var types = type.types; + var mixinCount = ts.countWhere(types, isMixinConstructorType); + var _loop_3 = function (i) { + var t = type.types[i]; + if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) { + var signatures = getSignaturesOfType(t, 1); + if (signatures.length && mixinCount > 0) { + signatures = ts.map(signatures, function (s) { + var clone = cloneSignature(s); + clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i); + return clone; + }); + } + constructSignatures = ts.concatenate(constructSignatures, signatures); + } callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1)); stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0)); numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1)); + }; + for (var i = 0; i < types.length; i++) { + _loop_3(i); } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } @@ -24638,8 +24806,8 @@ var ts; } else if (symbol.flags & 2048) { var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var callSignatures = getSignaturesOfSymbol(members.get("__call")); + var constructSignatures = getSignaturesOfSymbol(members.get("__new")); var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0); var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); @@ -24652,14 +24820,14 @@ var ts; } if (symbol.flags & 32) { var classType = getDeclaredTypeOfClassOrInterface(symbol); - constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); } var baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072 | 540672)) { members = createSymbolTable(getNamedMembers(members)); - addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); + addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); } } var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined; @@ -24679,8 +24847,11 @@ var ts; var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); var templateReadonly = !!type.declaration.readonlyToken; var templateOptional = !!type.declaration.questionToken; - if (type.declaration.typeParameter.constraint.kind === 168) { - forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + if (type.declaration.typeParameter.constraint.kind === 169) { + for (var _i = 0, _a = getPropertiesOfType(modifiersType); _i < _a.length; _i++) { + var propertySymbol = _a[_i]; + addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); + } if (getIndexInfoOfType(modifiersType, 0)) { addMemberForKeyType(stringType); } @@ -24691,8 +24862,8 @@ var ts; forEachType(iterationType, addMemberForKeyType); } setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); - function addMemberForKeyType(t) { - var iterationMapper = createUnaryTypeMapper(typeParameter, t); + function addMemberForKeyType(t, propertySymbol) { + var iterationMapper = createTypeMapper([typeParameter], [t]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); if (t.flags & 32) { @@ -24702,7 +24873,10 @@ var ts; var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName); prop.type = propType; prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); - members[propName] = prop; + if (propertySymbol) { + prop.mappedTypeOrigin = propertySymbol; + } + members.set(propName, prop); } else if (t.flags & 2) { stringIndexInfo = createIndexInfo(propType, templateReadonly); @@ -24726,7 +24900,7 @@ var ts; function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { var constraintDeclaration = type.declaration.typeParameter.constraint; - if (constraintDeclaration.kind === 168) { + if (constraintDeclaration.kind === 169) { type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); } else { @@ -24738,9 +24912,6 @@ var ts; } return type.modifiersType; } - function getErasedTemplateTypeFromMappedType(type) { - return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); - } function isGenericMappedType(type) { if (getObjectFlags(type) & 32) { var constraintType = getConstraintTypeFromMappedType(type); @@ -24782,35 +24953,33 @@ var ts; function getPropertyOfObjectType(type, name) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } } } function getPropertiesOfUnionOrIntersectionType(type) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var current = _a[_i]; - for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { - var prop = _c[_b]; - getUnionOrIntersectionProperty(type, prop.name); - } - if (type.flags & 65536) { - break; - } - } - var props = type.resolvedProperties; - if (props) { - var result = []; - for (var key in props) { - var prop = props[key]; - if (!(prop.flags & 268435456 && prop.isPartial)) { - result.push(prop); + if (!type.resolvedProperties) { + var members = ts.createMap(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.name)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.name); + if (combinedProp) { + members.set(prop.name, combinedProp); + } + } + } + if (type.flags & 65536) { + break; } } - return result; + type.resolvedProperties = getNamedMembers(members); } - return emptyArray; + return type.resolvedProperties; } function getPropertiesOfType(type) { type = getApparentType(type); @@ -24818,36 +24987,96 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } - function getApparentTypeOfTypeVariable(type) { - if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeVariable(type); - while (constraintType && constraintType.flags & 16384) { - constraintType = getConstraintOfTypeVariable(constraintType); + function getConstraintOfType(type) { + return type.flags & 16384 ? getConstraintOfTypeParameter(type) : getBaseConstraintOfType(type); + } + function getConstraintOfTypeParameter(typeParameter) { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; + } + function getBaseConstraintOfType(type) { + var constraint = getResolvedBaseConstraint(type); + return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined; + } + function hasNonCircularBaseConstraint(type) { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } + function getResolvedBaseConstraint(type) { + var typeStack; + var circular; + if (!type.resolvedBaseConstraint) { + typeStack = []; + var constraint = getBaseConstraint(type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + } + return type.resolvedBaseConstraint; + function getBaseConstraint(t) { + if (ts.contains(typeStack, t)) { + circular = true; + return undefined; + } + typeStack.push(t); + var result = computeBaseConstraint(t); + typeStack.pop(); + return result; + } + function computeBaseConstraint(t) { + if (t.flags & 16384) { + var constraint = getConstraintFromTypeParameter(t); + return t.isThisType ? constraint : + constraint ? getBaseConstraint(constraint) : undefined; + } + if (t.flags & 196608) { + var types = t.types; + var baseTypes = []; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var type_1 = types_2[_i]; + var baseType = getBaseConstraint(type_1); + if (baseType) { + baseTypes.push(baseType); + } + } + return t.flags & 65536 && baseTypes.length === types.length ? getUnionType(baseTypes) : + t.flags & 131072 && baseTypes.length ? getIntersectionType(baseTypes) : + undefined; + } + if (t.flags & 262144) { + return stringType; } - type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + if (t.flags & 524288) { + var baseObjectType = getBaseConstraint(t.objectType); + var baseIndexType = getBaseConstraint(t.indexType); + var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; + return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; + } + return t; } - return type.resolvedApparentType; + } + function getApparentTypeOfIntersectionType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type)); } function getApparentType(type) { - var t = type.flags & 540672 ? getApparentTypeOfTypeVariable(type) : type; - return t.flags & 262178 ? globalStringType : - t.flags & 340 ? globalNumberType : - t.flags & 136 ? globalBooleanType : - t.flags & 512 ? getGlobalESSymbolType() : - t; + var t = type.flags & 540672 ? getBaseConstraintOfType(type) || emptyObjectType : type; + return t.flags & 131072 ? getApparentTypeOfIntersectionType(t) : + t.flags & 262178 ? globalStringType : + t.flags & 340 ? globalNumberType : + t.flags & 136 ? globalBooleanType : + t.flags & 512 ? getGlobalESSymbolType() : + t.flags & 16777216 ? globalObjectType : + t; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; + var excludeModifiers = containingType.flags & 65536 ? 8 | 16 : 0; var props; var commonFlags = (containingType.flags & 131072) ? 536870912 : 0; var isReadonly = false; var isPartial = false; - for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { - var current = types_2[_i]; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var current = types_3[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16))) { + if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & excludeModifiers)) { commonFlags &= prop.flags; if (!props) { props = [prop]; @@ -24898,12 +25127,12 @@ var ts; return result; } function getUnionOrIntersectionProperty(type, name) { - var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap()); - var property = properties[name]; + var properties = type.propertyCache || (type.propertyCache = ts.createMap()); + var property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); if (property) { - properties[name] = property; + properties.set(name, property); } } return property; @@ -24916,7 +25145,7 @@ var ts; type = getApparentType(type); if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -24995,16 +25224,16 @@ var ts; } function symbolsToArray(symbols) { var result = []; - for (var id in symbols) { + symbols.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { - result.push(symbols[id]); + result.push(symbol); } - } + }); return result; } function isJSDocOptionalParameter(node) { if (node.flags & 65536) { - if (node.type && node.type.kind === 274) { + if (node.type && node.type.kind === 275) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -25015,7 +25244,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 274; + return paramTag.typeExpression.type.kind === 275; } } } @@ -25063,9 +25292,10 @@ var ts; if (!links.resolvedSignature) { var parameters = []; var hasLiteralTypes = false; - var minArgumentCount = -1; + var minArgumentCount = 0; var thisParameter = undefined; var hasThisParameter = void 0; + var iife = ts.getImmediatelyInvokedFunctionExpression(declaration); var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; @@ -25081,41 +25311,33 @@ var ts; else { parameters.push(paramSymbol); } - if (param.type && param.type.kind === 171) { + if (param.type && param.type.kind === 172) { hasLiteralTypes = true; } - if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { - if (minArgumentCount < 0) { - minArgumentCount = i - (hasThisParameter ? 1 : 0); - } - } - else { - minArgumentCount = -1; + var isOptionalParameter_1 = param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !param.type || + isJSDocOptionalParameter(param); + if (!isOptionalParameter_1) { + minArgumentCount = parameters.length; } } - if ((declaration.kind === 151 || declaration.kind === 152) && + if ((declaration.kind === 152 || declaration.kind === 153) && !ts.hasDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 151 ? 152 : 151; + var otherKind = declaration.kind === 152 ? 153 : 152; var other = ts.getDeclarationOfKind(declaration.symbol, otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); - } - if (isJSConstructSignature) { - minArgumentCount--; - } - var classType = declaration.kind === 150 ? + var classType = declaration.kind === 151 ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : getTypeParametersFromJSDocTemplate(declaration); var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType); - var typePredicate = declaration.type && declaration.type.kind === 156 ? + var typePredicate = declaration.type && declaration.type.kind === 157 ? createTypePredicateFromTypePredicateNode(declaration.type) : undefined; links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes); @@ -25138,8 +25360,8 @@ var ts; return type; } } - if (declaration.kind === 151 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 152); + if (declaration.kind === 152 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 153); return getAnnotatedAccessorType(setter); } if (ts.nodeIsMissing(declaration.body)) { @@ -25153,20 +25375,20 @@ var ts; for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 158: case 159: - case 226: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 275: + case 186: + case 276: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -25236,7 +25458,11 @@ var ts; function getSignatureInstantiation(signature, typeArguments) { var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()); var id = getTypeListId(typeArguments); - return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + var instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; } function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); @@ -25251,7 +25477,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 150 || signature.declaration.kind === 154; + var isConstructor = signature.declaration.kind === 151 || signature.declaration.kind === 155; var type = createObjectType(16); type.members = emptySymbols; type.properties = emptyArray; @@ -25262,10 +25488,10 @@ var ts; return signature.isolatedSignatureType; } function getIndexSymbol(symbol) { - return symbol.members["__index"]; + return symbol.members.get("__index"); } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 132 : 134; + var syntaxKind = kind === 1 ? 132 : 135; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -25292,21 +25518,9 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 143).constraint; - } - function hasConstraintReferenceTo(type, target) { - var checked; - while (type && type.flags & 16384 && !(type.isThisType) && !ts.contains(checked, type)) { - if (type === target) { - return true; - } - (checked || (checked = [])).push(type); - var constraintDeclaration = getConstraintDeclaration(type); - type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); - } - return false; + return ts.getDeclarationOfKind(type.symbol, 144).constraint; } - function getConstraintOfTypeParameter(typeParameter) { + function getConstraintFromTypeParameter(typeParameter) { if (!typeParameter.constraint) { if (typeParameter.target) { var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); @@ -25314,23 +25528,13 @@ var ts; } else { var constraintDeclaration = getConstraintDeclaration(typeParameter); - var constraint = getTypeFromTypeNode(constraintDeclaration); - if (hasConstraintReferenceTo(constraint, typeParameter)) { - error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); - constraint = unknownType; - } - typeParameter.constraint = constraint; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } - function getConstraintOfTypeVariable(type) { - return type.flags & 16384 ? getConstraintOfTypeParameter(type) : - type.flags & 524288 ? type.constraint : - undefined; - } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 144).parent); } function getTypeListId(types) { var result = ""; @@ -25357,8 +25561,8 @@ var ts; } function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; - for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { - var type = types_3[_i]; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var type = types_4[_i]; if (!(type.flags & excludeKinds)) { result |= type.flags; } @@ -25367,9 +25571,10 @@ var ts; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); - var type = target.instantiations[id]; + var type = target.instantiations.get(id); if (!type) { - type = target.instantiations[id] = createObjectType(4, target.symbol); + type = createObjectType(4, target.symbol); + target.instantiations.set(id, type); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -25408,7 +25613,11 @@ var ts; var links = getSymbolLinks(symbol); var typeParameters = links.typeParameters; var id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + var instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + } + return instantiation; } function getTypeFromTypeAliasReference(node, symbol) { var type = getDeclaredTypeOfSymbol(symbol); @@ -25436,11 +25645,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 157: + case 158: return node.typeName; - case 273: + case 274: return node.name; - case 199: + case 200: var expr = node.expression; if (ts.isEntityNameExpression(expr)) { return expr; @@ -25464,7 +25673,7 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 && node.kind === 273) { + if (symbol.flags & 107455 && node.kind === 274) { return getTypeOfSymbol(symbol); } return getTypeFromNonGenericTypeReference(node, symbol); @@ -25474,13 +25683,13 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 273) { + if (node.kind === 274) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(typeReferenceName); type = getTypeReferenceType(node, symbol); } else { - var typeNameOrExpression = node.kind === 157 + var typeNameOrExpression = node.kind === 158 ? node.typeName : ts.isEntityNameExpression(node.expression) ? node.expression @@ -25509,9 +25718,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 227: case 228: - case 230: + case 229: + case 231: return declaration; } } @@ -25588,7 +25797,7 @@ var ts; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -25670,14 +25879,14 @@ var ts; } } function addTypesToUnion(typeSet, types) { - for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { - var type = types_4[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; addTypeToUnion(typeSet, type); } } function containsIdenticalType(types, type) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var t = types_5[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -25685,8 +25894,8 @@ var ts; return false; } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var type = types_7[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } @@ -25765,10 +25974,11 @@ var ts; return types[0]; } var id = getTypeListId(types); - var type = unionTypes[id]; + var type = unionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, 6144); - type = unionTypes[id] = createType(65536 | propagatedFlags); + type = createType(65536 | propagatedFlags); + unionTypes.set(id, type); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -25797,8 +26007,8 @@ var ts; } } function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var type = types_8[_i]; addTypeToIntersection(typeSet, type); } } @@ -25820,10 +26030,11 @@ var ts; return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), false, aliasSymbol, aliasTypeArguments); } var id = getTypeListId(typeSet); - var type = intersectionTypes[id]; + var type = intersectionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 6144); - type = intersectionTypes[id] = createType(131072 | propagatedFlags); + type = createType(131072 | propagatedFlags); + intersectionTypes.set(id, type); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -25873,21 +26084,10 @@ var ts; var type = createType(524288); type.objectType = objectType; type.indexType = indexType; - if (type.objectType.flags & 229376) { - type.constraint = getIndexTypeOfType(type.objectType, 0); - } - else if (type.objectType.flags & 540672) { - var apparentType = getApparentTypeOfTypeVariable(type.objectType); - if (apparentType !== emptyObjectType) { - type.constraint = isTypeOfKind(type.indexType, 262178) ? - getIndexedAccessType(apparentType, type.indexType) : - getIndexTypeOfType(apparentType, 0); - } - } return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; var propName = indexType.flags & (32 | 64 | 256) ? indexType.text : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ? @@ -25935,7 +26135,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 178 ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 179 ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 | 64)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType)); } @@ -25949,33 +26149,31 @@ var ts; return unknownType; } function getIndexedAccessForMappedType(type, indexType, accessNode) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); return unknownType; } - var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } function getIndexedAccessType(objectType, indexType, accessNode) { if (maybeTypeOfKind(indexType, 540672 | 262144) || - maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 178) || + maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 179) || isGenericMappedType(objectType)) { if (objectType.flags & 1) { return objectType; } - if (accessNode) { - if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } - } if (isGenericMappedType(objectType)) { return getIndexedAccessForMappedType(objectType, indexType, accessNode); } var id = objectType.id + "," + indexType.id; - return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + var type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); + } + return type; } var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 && !(indexType.flags & 8190)) { @@ -26015,7 +26213,7 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { var aliasSymbol = getAliasSymbolForTypeNode(node); - if (ts.isEmpty(node.symbol.members) && !aliasSymbol) { + if (node.symbol.members.size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -26028,13 +26226,13 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 229 ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 230 ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; } - function getSpreadType(left, right, isFromObjectLiteral) { + function getSpreadType(left, right) { if (left.flags & 1 || right.flags & 1) { return anyType; } @@ -26047,10 +26245,13 @@ var ts; return left; } if (left.flags & 65536) { - return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); }); + return mapType(left, function (t) { return getSpreadType(t, right); }); } if (right.flags & 65536) { - return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); }); + return mapType(right, function (t) { return getSpreadType(left, t); }); + } + if (right.flags & 16777216) { + return emptyObjectType; } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); @@ -26066,23 +26267,23 @@ var ts; } for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { var rightProp = _a[_i]; - var isOwnProperty = !(rightProp.flags & 8192) || isFromObjectLiteral; var isSetterWithoutGetter = rightProp.flags & 65536 && !(rightProp.flags & 32768); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 | 16)) { - skippedPrivateMembers[rightProp.name] = true; + skippedPrivateMembers.set(rightProp.name, true); } - else if (isOwnProperty && !isSetterWithoutGetter) { - members[rightProp.name] = rightProp; + else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { + members.set(rightProp.name, rightProp); } } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (leftProp.flags & 65536 && !(leftProp.flags & 32768) - || leftProp.name in skippedPrivateMembers) { + || skippedPrivateMembers.has(leftProp.name) + || isClassMethod(leftProp)) { continue; } - if (leftProp.name in members) { - var rightProp = members[leftProp.name]; + if (members.has(leftProp.name)) { + var rightProp = members.get(leftProp.name); var rightType = getTypeOfSymbol(rightProp); if (maybeTypeOfKind(rightType, 2048) || rightProp.flags & 536870912) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); @@ -26093,15 +26294,18 @@ var ts; result.rightSpread = rightProp; result.declarations = declarations; result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); - members[leftProp.name] = result; + members.set(leftProp.name, result); } } else { - members[leftProp.name] = leftProp; + members.set(leftProp.name, leftProp); } } return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } + function isClassMethod(prop) { + return prop.flags & 8192 && ts.find(prop.declarations, function (decl) { return ts.isClassLike(decl.parent); }); + } function createLiteralType(flags, text) { var type = createType(flags); type.text = text; @@ -26123,7 +26327,11 @@ var ts; } function getLiteralTypeForText(flags, text) { var map = flags & 32 ? stringLiteralTypes : numericLiteralTypes; - return map[text] || (map[text] = createLiteralType(flags, text)); + var type = map.get(text); + if (!type) { + map.set(text, type = createLiteralType(flags, text)); + } + return type; } function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); @@ -26151,9 +26359,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 228)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 229)) { if (!(ts.getModifierFlags(container) & 32) && - (container.kind !== 150 || ts.isNodeDescendantOf(node, container.body))) { + (container.kind !== 151 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -26170,85 +26378,87 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118: - case 264: case 265: + case 266: return anyType; - case 134: + case 135: return stringType; case 132: return numberType; case 121: return booleanType; - case 135: + case 136: return esSymbolType; case 104: return voidType; - case 137: + case 138: return undefinedType; case 94: return nullType; case 129: return neverType; - case 290: - return nullType; + case 133: + return nonPrimitiveType; case 291: - return undefinedType; + return nullType; case 292: + return undefinedType; + case 293: return neverType; - case 167: + case 168: case 98: return getTypeFromThisTypeNode(node); - case 171: + case 172: return getTypeFromLiteralTypeNode(node); - case 289: + case 290: return getTypeFromLiteralTypeNode(node.literal); - case 157: - case 273: + case 158: + case 274: return getTypeFromTypeReference(node); - case 156: + case 157: return booleanType; - case 199: + case 200: return getTypeFromTypeReference(node); - case 160: + case 161: return getTypeFromTypeQueryNode(node); - case 162: - case 266: - return getTypeFromArrayTypeNode(node); case 163: - return getTypeFromTupleTypeNode(node); - case 164: case 267: - return getTypeFromUnionTypeNode(node); + return getTypeFromArrayTypeNode(node); + case 164: + return getTypeFromTupleTypeNode(node); case 165: - return getTypeFromIntersectionTypeNode(node); + case 268: + return getTypeFromUnionTypeNode(node); case 166: - case 269: + return getTypeFromIntersectionTypeNode(node); + case 167: case 270: - case 277: + case 271: case 278: - case 274: + case 279: + case 275: return getTypeFromTypeNode(node.type); - case 271: + case 272: return getTypeFromTypeNode(node.literal); - case 158: case 159: - case 161: - case 288: - case 275: + case 160: + case 162: + case 289: + case 276: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 168: - return getTypeFromTypeOperatorNode(node); case 169: - return getTypeFromIndexedAccessTypeNode(node); + return getTypeFromTypeOperatorNode(node); case 170: + return getTypeFromIndexedAccessTypeNode(node); + case 171: return getTypeFromMappedTypeNode(node); case 70: - case 141: + case 142: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 268: + case 269: return getTypeFromJSDocTupleType(node); - case 276: + case 277: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -26275,13 +26485,13 @@ var ts; var instantiations = mapper.instantiations || (mapper.instantiations = []); return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); } - function createUnaryTypeMapper(source, target) { + function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } - function createBinaryTypeMapper(source1, target1, source2, target2) { + function makeBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createArrayTypeMapper(sources, targets) { + function makeArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { @@ -26292,10 +26502,9 @@ var ts; }; } function createTypeMapper(sources, targets) { - var count = sources.length; - var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : - count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : - createArrayTypeMapper(sources, targets); + var mapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + makeArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; return mapper; } @@ -26325,7 +26534,12 @@ var ts; } function combineTypeMappers(mapper1, mapper2) { var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; - mapper.mappedTypes = mapper1.mappedTypes; + mapper.mappedTypes = ts.concatenate(mapper1.mappedTypes, mapper2.mappedTypes); + return mapper; + } + function createReplacementMapper(source, target, baseMapper) { + var mapper = function (t) { return t === source ? target : baseMapper(t); }; + mapper.mappedTypes = baseMapper.mappedTypes; return mapper; } function cloneTypeParameter(typeParameter) { @@ -26402,10 +26616,7 @@ var ts; if (typeVariable_1 !== mappedTypeVariable) { return mapType(mappedTypeVariable, function (t) { if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); + return instantiateMappedObjectType(type, createReplacementMapper(typeVariable_1, t, mapper)); } return t; }); @@ -26433,23 +26644,23 @@ var ts; var node = symbol.declarations[0]; while (node) { switch (node.kind) { - case 158: case 159: - case 226: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 227: - case 197: + case 186: case 228: + case 198: case 229: + case 230: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -26459,14 +26670,19 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 228) { + if (ts.isClassLike(node) || node.kind === 229) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 275: + case 171: + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)))) { + return true; + } + break; + case 276: var func = node; for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { var p = _c[_b]; @@ -26475,8 +26691,8 @@ var ts; } } break; - case 231: - case 262: + case 232: + case 263: return false; } node = node.parent; @@ -26486,7 +26702,7 @@ var ts; function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 262 || parentKind === 232; + return parentKind === 263 || parentKind === 233; } return false; } @@ -26538,27 +26754,27 @@ var ts; return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 184: case 185: + case 186: return isContextSensitiveFunctionLikeDeclaration(node); - case 176: + case 177: return ts.forEach(node.properties, isContextSensitive); - case 175: + case 176: return ts.forEach(node.elements, isContextSensitive); - case 193: + case 194: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 192: + case 193: return node.operatorToken.kind === 53 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 258: + case 259: return isContextSensitive(node.initializer); + case 150: case 149: - case 148: return isContextSensitiveFunctionLikeDeclaration(node); - case 183: + case 184: return isContextSensitive(node.expression); } return false; @@ -26570,7 +26786,7 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !p.type; })) { return true; } - if (node.kind === 185) { + if (node.kind === 186) { return false; } var parameter = ts.firstOrUndefined(node.parameters); @@ -26588,9 +26804,12 @@ var ts; result.properties = resolved.properties; result.callSignatures = emptyArray; result.constructSignatures = emptyArray; - type = result; + return result; } } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures)); + } return type; } function isTypeIdenticalTo(source, target) { @@ -26757,13 +26976,15 @@ var ts; return true; } var id = source.id + "," + target.id; - if (enumRelation[id] !== undefined) { - return enumRelation[id]; + var relation = enumRelation.get(id); + if (relation !== undefined) { + return relation; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256) || !(target.symbol.flags & 256) || (source.flags & 65536) !== (target.flags & 65536)) { - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } var targetEnumType = getTypeOfSymbol(target.symbol); for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { @@ -26774,11 +26995,13 @@ var ts; if (errorReporter) { errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); } - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } } } - return enumRelation[id] = true; + enumRelation.set(id, true); + return true; } function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { if (target.flags & 8192) @@ -26799,6 +27022,8 @@ var ts; return true; if (source.flags & 4096 && (!strictNullChecks || target.flags & 4096)) return true; + if (source.flags & 32768 && target.flags & 16777216) + return true; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & 1) return true; @@ -26830,12 +27055,12 @@ var ts; } if (source.flags & 32768 && target.flags & 32768) { var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { return related === 1; } } - if (source.flags & 507904 || target.flags & 507904) { + if (source.flags & 1032192 || target.flags & 1032192) { return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); } return false; @@ -26974,14 +27199,6 @@ var ts; } } } - else { - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; - } - } - } } else if (target.flags & 262144) { if (source.flags & 262144) { @@ -26989,12 +27206,10 @@ var ts; return result; } } - if (target.type.flags & 540672) { - var constraint = getConstraintOfTypeVariable(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; - } + var constraint = getConstraintOfType(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; } } } @@ -27004,8 +27219,9 @@ var ts; return result; } } - if (target.constraint) { - if (result = isRelatedTo(source, target.constraint, reportErrors)) { + var constraint = getBaseConstraintOfType(target); + if (constraint) { + if (result = isRelatedTo(source, constraint, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -27022,20 +27238,23 @@ var ts; } else { var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1) { - constraint = emptyObjectType; - } - constraint = getTypeWithThisArgument(constraint, source); - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; - return result; + if (constraint || !(target.flags & 16777216)) { + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; + } + constraint = getTypeWithThisArgument(constraint, source); + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } } } } else if (source.flags & 524288) { - if (source.constraint) { - if (result = isRelatedTo(source.constraint, target, reportErrors)) { + var constraint = getBaseConstraintOfType(source); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -27090,7 +27309,7 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) || + if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyResolvedType(resolved)) || resolved.stringIndexInfo || (resolved.numberIndexInfo && isNumericLiteralName(name)) || getPropertyOfType(type, name)) { @@ -27107,13 +27326,16 @@ var ts; } return false; } - function isEmptyObjectType(t) { + function isEmptyResolvedType(t) { return t.properties.length === 0 && t.callSignatures.length === 0 && t.constructSignatures.length === 0 && !t.stringIndexInfo && !t.numberIndexInfo; } + function isEmptyObjectType(type) { + return type.flags & 32768 && isEmptyResolvedType(resolveStructuredTypeMembers(type)); + } function hasExcessProperties(source, target, reportErrors) { if (maybeTypeOfKind(target, 32768) && !(getObjectFlags(target) & 512)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { @@ -27219,10 +27441,10 @@ var ts; return 0; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { if (reportErrors && related === 2) { - relation[id] = 3; + relation.set(id, 3); } else { return related === 1 ? -1 : 0; @@ -27230,7 +27452,7 @@ var ts; } if (depth > 0) { for (var i = 0; i < depth; i++) { - if (maybeStack[i][id]) { + if (maybeStack[i].get(id)) { return 1; } } @@ -27248,7 +27470,7 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = ts.createMap(); - maybeStack[depth][id] = 1; + maybeStack[depth].set(id, 1); depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) @@ -27282,38 +27504,38 @@ var ts; if (result) { var maybeCache = maybeStack[depth]; var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; - ts.copyProperties(maybeCache, destinationCache); + ts.copyEntries(maybeCache, destinationCache); } else { - relation[id] = reportErrors ? 3 : 2; + relation.set(id, reportErrors ? 3 : 2); } return result; } function mappedTypeRelatedTo(source, target, reportErrors) { if (isGenericMappedType(target)) { if (isGenericMappedType(source)) { - var result_2; - if (relation === identityRelation) { - var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; - var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else { - if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); - } + var sourceReadonly = !!source.declaration.readonlyToken; + var sourceOptional = !!source.declaration.questionToken; + var targetReadonly = !!target.declaration.readonlyToken; + var targetOptional = !!target.declaration.questionToken; + var modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + var result_2; + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); } } } + else if (target.declaration.questionToken && isEmptyObjectType(source)) { + return -1; + } } else if (relation !== identityRelation) { var resolved = resolveStructuredTypeMembers(target); - if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { + if (isEmptyResolvedType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { return -1; } } @@ -27675,8 +27897,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var t = types_9[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -27684,8 +27906,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -27776,8 +27998,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; result |= getFalsyFlags(t); } return result; @@ -27838,7 +28060,7 @@ var ts; var property = _a[_i]; var original = getTypeOfSymbol(property); var updated = f(original); - members[property.name] = updated === original ? property : createTransientSymbol(property, updated); + members.set(property.name, updated === original ? property : createTransientSymbol(property, updated)); } ; return members; @@ -27924,25 +28146,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 148: case 147: - case 146: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 144: + case 145: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 174: + case 175: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 226: + case 227: + case 150: case 149: - case 148: - case 151: case 152: - case 184: + case 153: case 185: + case 186: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -28039,7 +28261,7 @@ var ts; inferredProp.declarations = prop.declarations; inferredProp.type = inferredPropType; inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); - members[prop.name] = inferredProp; + members.set(prop.name, inferredProp); } if (indexInfo) { var inferredIndexType = inferTargetType(indexInfo.type); @@ -28182,10 +28404,10 @@ var ts; return; } var key = source.id + "," + target.id; - if (visited[key]) { + if (visited.get(key)) { return; } - visited[key] = true; + visited.set(key, true); if (depth === 0) { sourceStack = []; targetStack = []; @@ -28277,8 +28499,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -28354,10 +28576,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 160: + case 161: return true; case 70: - case 141: + case 142: node = node.parent; continue; default: @@ -28374,7 +28596,7 @@ var ts; if (node.kind === 98) { return "0"; } - if (node.kind === 177) { + if (node.kind === 178) { var key = getFlowCacheKey(node.expression); return key && key + "." + node.name.text; } @@ -28385,7 +28607,7 @@ var ts; case 70: case 98: return node; - case 177: + case 178: return getLeftmostIdentifierOrThis(node.expression); } return undefined; @@ -28394,19 +28616,19 @@ var ts; switch (source.kind) { case 70: return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 224 || target.kind === 174) && + (target.kind === 225 || target.kind === 175) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98: return target.kind === 98; - case 177: - return target.kind === 177 && + case 178: + return target.kind === 178 && source.name.text === target.name.text && isMatchingReference(source.expression, target.expression); } return false; } function containsMatchingReference(source, target) { - while (source.kind === 177) { + while (source.kind === 178) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -28415,7 +28637,7 @@ var ts; return false; } function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 177 && + return target.kind === 178 && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); } @@ -28423,7 +28645,7 @@ var ts; if (expr.kind === 70) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 177) { + if (expr.kind === 178) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.text); } @@ -28453,7 +28675,7 @@ var ts; } } } - if (callExpression.expression.kind === 177 && + if (callExpression.expression.kind === 178 && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -28492,8 +28714,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; result |= getTypeFacts(t); } return result; @@ -28501,7 +28723,7 @@ var ts; function isFunctionObjectType(type) { var resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || - resolved.members["bind"] && isTypeSubtypeOf(type, globalFunctionType)); + resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type) { var flags = type.flags; @@ -28544,6 +28766,9 @@ var ts; if (flags & 512) { return strictNullChecks ? 1981320 : 4193160; } + if (flags & 16777216) { + return strictNullChecks ? 6166480 : 8378320; + } if (flags & 16384) { var constraint = getConstraintOfTypeParameter(type); return getTypeFacts(constraint || emptyObjectType); @@ -28579,7 +28804,7 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 || node.parent.kind === 258 ? + return node.parent.kind === 176 || node.parent.kind === 259 ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } @@ -28598,21 +28823,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 213: - return stringType; case 214: + return stringType; + case 215: return checkRightHandSideOfForOf(parent.expression) || unknownType; - case 192: + case 193: return getAssignedTypeOfBinaryExpression(parent); - case 186: + case 187: return undefinedType; - case 175: + case 176: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 196: + case 197: return getAssignedTypeOfSpreadExpression(parent); - case 258: - return getAssignedTypeOfPropertyAssignment(parent); case 259: + return getAssignedTypeOfPropertyAssignment(parent); + case 260: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -28620,7 +28845,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 172 ? + var type = pattern.kind === 173 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : @@ -28635,35 +28860,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 213) { + if (node.parent.parent.kind === 214) { return stringType; } - if (node.parent.parent.kind === 214) { + if (node.parent.parent.kind === 215) { return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 224 ? + return node.kind === 225 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 224 || node.kind === 174 ? + return node.kind === 225 || node.kind === 175 ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 224 && node.initializer && + return node.kind === 225 && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 174 && node.parent.kind === 192 && + node.kind !== 175 && node.parent.kind === 193 && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 183: + case 184: return getReferenceCandidate(node.expression); - case 192: + case 193: switch (node.operatorToken.kind) { case 57: return getReferenceCandidate(node.left); @@ -28675,13 +28900,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 183 || - parent.kind === 192 && parent.operatorToken.kind === 57 && parent.left === node || - parent.kind === 192 && parent.operatorToken.kind === 25 && parent.right === node ? + return parent.kind === 184 || + parent.kind === 193 && parent.operatorToken.kind === 57 && parent.left === node || + parent.kind === 193 && parent.operatorToken.kind === 25 && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 254) { + if (clause.kind === 255) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -28783,8 +29008,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var t = types_13[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var t = types_14[_i]; if (!(t.flags & 8192)) { if (!(getObjectFlags(t) & 256)) { return false; @@ -28802,11 +29027,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 177 && (parent.name.text === "length" || - parent.parent.kind === 179 && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 178 && + var isLengthPushOrUnshift = parent.kind === 178 && (parent.name.text === "length" || + parent.parent.kind === 180 && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 179 && parent.expression === root && - parent.parent.kind === 192 && + parent.parent.kind === 193 && parent.parent.operatorToken.kind === 57 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -28835,7 +29060,7 @@ var ts; } function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) { var key; - if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215)) { + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 17810431)) { return declaredType; } var initialType = assumeInitialized ? declaredType : @@ -28845,7 +29070,7 @@ var ts; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); visitedFlowCount = visitedFlowStart; var resultType = getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent.kind === 201 && getTypeWithFacts(resultType, 524288).flags & 8192) { + if (reference.parent.kind === 202 && getTypeWithFacts(resultType, 524288).flags & 8192) { return declaredType; } return resultType; @@ -28890,7 +29115,7 @@ var ts; } else if (flow.flags & 2) { var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 177) { + if (container && container !== flowContainer && reference.kind !== 178) { flow = container.flowNode; continue; } @@ -28933,7 +29158,7 @@ var ts; } function getTypeAtFlowArrayMutation(flow) { var node = flow.node; - var expr = node.kind === 179 ? + var expr = node.kind === 180 ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -28941,7 +29166,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256) { var evolvedType_1 = type; - if (node.kind === 179) { + if (node.kind === 180) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -29016,8 +29241,9 @@ var ts; if (!key) { key = getFlowCacheKey(reference); } - if (cache[key]) { - return cache[key]; + var cached = cache.get(key); + if (cached) { + return cached; } for (var i = flowLoopStart; i < flowLoopCount; i++) { if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) { @@ -29039,8 +29265,9 @@ var ts; firstAntecedentType = flowType; } var type = getTypeFromFlowType(flowType); - if (cache[key]) { - return cache[key]; + var cached_1 = cache.get(key); + if (cached_1) { + return cached_1; } if (!ts.contains(antecedentTypes, type)) { antecedentTypes.push(type); @@ -29056,10 +29283,11 @@ var ts; if (isIncomplete(firstAntecedentType)) { return createFlowType(result, true); } - return cache[key] = result; + cache.set(key, result); + return result; } function isMatchingReferenceDiscriminant(expr) { - return expr.kind === 177 && + return expr.kind === 178 && declaredType.flags & 65536 && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(declaredType, expr.name.text); @@ -29093,10 +29321,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 187 && right_1.kind === 9) { + if (left_1.kind === 188 && right_1.kind === 9) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 187 && left_1.kind === 9) { + if (right_1.kind === 188 && left_1.kind === 9) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -29142,7 +29370,7 @@ var ts; assumeTrue ? 16384 : 131072; return getTypeWithFacts(type, facts); } - if (type.flags & 33281) { + if (type.flags & 16810497) { return type; } if (assumeTrue) { @@ -29167,14 +29395,14 @@ var ts; assumeTrue = !assumeTrue; } if (assumeTrue && !(type.flags & 65536)) { - var targetType = typeofTypesByName[literal.text]; + var targetType = typeofTypesByName.get(literal.text); if (targetType && isTypeSubtypeOf(targetType, type)) { return targetType; } } var facts = assumeTrue ? - typeofEQFacts[literal.text] || 64 : - typeofNEFacts[literal.text] || 8192; + typeofEQFacts.get(literal.text) || 64 : + typeofNEFacts.get(literal.text) || 8192; return getTypeWithFacts(type, facts); } function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { @@ -29274,7 +29502,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 178 || invokedExpression.kind === 177) { + if (invokedExpression.kind === 179 || invokedExpression.kind === 178) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -29291,15 +29519,15 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 178: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 179: + case 180: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 183: + case 184: return narrowType(type, expr.expression, assumeTrue); - case 192: + case 193: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 190: + case 191: if (expr.operator === 50) { return narrowType(type, expr.operand, !assumeTrue); } @@ -29326,9 +29554,9 @@ var ts; while (true) { node = node.parent; if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 232 || - node.kind === 262 || - node.kind === 147) { + node.kind === 233 || + node.kind === 263 || + node.kind === 148) { return node; } } @@ -29359,7 +29587,7 @@ var ts; if (node.kind === 70) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 145) { symbol.isAssigned = true; } } @@ -29379,7 +29607,7 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2) { - if (container.kind === 185) { + if (container.kind === 186) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (ts.hasModifier(container, 256)) { @@ -29397,7 +29625,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (declaration_1.kind === 227 + if (declaration_1.kind === 228 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -29409,11 +29637,11 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration_1.kind === 197) { + else if (declaration_1.kind === 198) { var container = ts.getThisContainer(node, false); while (container !== undefined) { if (container.parent === declaration_1) { - if (container.kind === 147 && ts.hasModifier(container, 32)) { + if (container.kind === 148 && ts.hasModifier(container, 32)) { getNodeLinks(declaration_1).flags |= 8388608; getNodeLinks(node).flags |= 16777216; } @@ -29443,12 +29671,12 @@ var ts; if (!(localOrExportSymbol.flags & 3) || assignmentKind === 1 || !declaration) { return type; } - var isParameter = ts.getRootDeclaration(declaration).kind === 144; + var isParameter = ts.getRootDeclaration(declaration).kind === 145; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; - while (flowContainer !== declarationContainer && (flowContainer.kind === 184 || - flowContainer.kind === 185 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 185 || + flowContainer.kind === 186 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -29484,7 +29712,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 257) { + symbol.valueDeclaration.parent.kind === 258) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -29502,8 +29730,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 212 && - ts.getAncestor(symbol.valueDeclaration, 225).parent === container && + if (container.kind === 213 && + ts.getAncestor(symbol.valueDeclaration, 226).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -29515,14 +29743,14 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 183) { + while (current.parent.kind === 184) { current = current.parent; } var isAssigned = false; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 190 || current.parent.kind === 191)) { + else if ((current.parent.kind === 191 || current.parent.kind === 192)) { var expr = current.parent; isAssigned = expr.operator === 42 || expr.operator === 43; } @@ -29541,7 +29769,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 147 || container.kind === 150) { + if (container.kind === 148 || container.kind === 151) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -29585,32 +29813,32 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 150) { + if (container.kind === 151) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } - if (container.kind === 185) { + if (container.kind === 186) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 231: + case 232: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 230: + case 231: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 150: + case 151: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 148: case 147: - case 146: if (ts.getModifierFlags(container) & 32) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 142: + case 143: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -29619,7 +29847,7 @@ var ts; } if (ts.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { - if (container.kind === 184 && + if (container.kind === 185 && ts.isInJavaScriptFile(container.parent) && ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { var className = container.parent @@ -29654,27 +29882,27 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 275) { + if (jsdocType && jsdocType.kind === 276) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 278) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 279) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 144) { + if (n.kind === 145) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 179 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 180 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 185) { + while (container && container.kind === 186) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -29683,16 +29911,16 @@ var ts; var nodeCheckFlag = 0; if (!canUseSuperExpression) { var current = node; - while (current && current !== container && current.kind !== 142) { + while (current && current !== container && current.kind !== 143) { current = current.parent; } - if (current && current.kind === 142) { + if (current && current.kind === 143) { 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 if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 177)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -29700,7 +29928,7 @@ var ts; } return unknownType; } - if (!isCallExpression && container.kind === 150) { + if (!isCallExpression && container.kind === 151) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if ((ts.getModifierFlags(container) & 32) || isCallExpression) { @@ -29710,7 +29938,7 @@ var ts; nodeCheckFlag = 256; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 149 && ts.getModifierFlags(container) & 256) { + if (container.kind === 150 && ts.getModifierFlags(container) & 256) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096; } @@ -29721,7 +29949,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 176) { + if (container.parent.kind === 177) { if (languageVersion < 2) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -29739,7 +29967,7 @@ var ts; } return unknownType; } - if (container.kind === 150 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 151 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -29751,24 +29979,24 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 150; + return container.kind === 151; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 176) { + if (ts.isClassLike(container.parent) || container.parent.kind === 177) { if (ts.getModifierFlags(container) & 32) { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || - container.kind === 152; + return container.kind === 150 || + container.kind === 149 || + container.kind === 152 || + container.kind === 153; } else { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || + return container.kind === 150 || + container.kind === 149 || container.kind === 152 || + container.kind === 153 || + container.kind === 148 || container.kind === 147 || - container.kind === 146 || - container.kind === 150; + container.kind === 151; } } } @@ -29776,7 +30004,7 @@ var ts; } } function getContextualThisParameterType(func) { - if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185) { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 186) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { var thisParameter = contextualSignature.thisParameter; @@ -29791,23 +30019,23 @@ var ts; var func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var iife = ts.getImmediatelyInvokedFunctionExpression(func); - if (iife) { + if (iife && iife.arguments) { var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (iife.arguments && indexOfParameter < iife.arguments.length) { - if (parameter.dotDotDotToken) { - var restTypes = []; - for (var i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); - } - return createArrayType(getUnionType(restTypes)); - } - var links = getNodeLinks(iife); - var cached = links.resolvedSignature; - links.resolvedSignature = anySignature; - var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); - links.resolvedSignature = cached; - return type; - } + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); + } + return restTypes.length ? createArrayType(getUnionType(restTypes)) : undefined; + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = indexOfParameter < iife.arguments.length ? + getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : + parameter.initializer ? undefined : undefinedWideningType; + links.resolvedSignature = cached; + return type; } var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -29832,7 +30060,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -29843,11 +30071,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_21 = declaration.propertyName || declaration.name; + var name = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_21)) { - var text = ts.getTextOfPropertyName(name_21); + !ts.isBindingPattern(name)) { + var text = ts.getTextOfPropertyName(name); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -29884,7 +30112,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 144 && node.parent.initializer === node) { + if (node.parent.kind === 145 && node.parent.initializer === node) { return true; } node = node.parent; @@ -29893,8 +30121,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 150 || - functionDecl.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152))) { + functionDecl.kind === 151 || + functionDecl.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 153))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -29913,7 +30141,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 181) { + if (template.parent.kind === 182) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -29950,8 +30178,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -30021,13 +30249,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 251) { + if (attribute.kind === 252) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 252) { + else if (attribute.kind === 253) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -30045,41 +30273,41 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 224: - case 144: + case 225: + case 145: + case 148: case 147: - case 146: - case 174: + case 175: return getContextualTypeForInitializerExpression(node); - case 185: - case 217: + case 186: + case 218: return getContextualTypeForReturnExpression(node); - case 195: + case 196: return getContextualTypeForYieldOperand(parent); - case 179: case 180: + case 181: return getContextualTypeForArgument(parent, node); - case 182: - case 200: + case 183: + case 201: return getTypeFromTypeNode(parent.type); - case 192: + case 193: return getContextualTypeForBinaryOperand(node); - case 258: case 259: + case 260: return getContextualTypeForObjectLiteralElement(parent); - case 175: + case 176: return getContextualTypeForElementExpression(node); - case 193: + case 194: return getContextualTypeForConditionalOperand(node); - case 203: - ts.Debug.assert(parent.parent.kind === 194); + case 204: + ts.Debug.assert(parent.parent.kind === 195); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 183: + case 184: return getContextualType(parent); - case 253: + case 254: return getContextualType(parent); - case 251: case 252: + case 253: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -30108,7 +30336,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 184 || node.kind === 185; + return node.kind === 185 || node.kind === 186; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -30121,7 +30349,7 @@ var ts; getApparentTypeOfContextualType(node); } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; @@ -30131,8 +30359,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var current = types_15[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var current = types_16[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -30162,8 +30390,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { - return (node.kind === 174 && !!node.initializer) || - (node.kind === 192 && node.operatorToken.kind === 57); + return (node.kind === 175 && !!node.initializer) || + (node.kind === 193 && node.operatorToken.kind === 57); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -30172,7 +30400,7 @@ var ts; var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 196) { + if (inDestructuringPattern && e.kind === 197) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -30184,7 +30412,7 @@ var ts; var type = checkExpressionForMutableLocation(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 196; + hasSpreadElement = hasSpreadElement || e.kind === 197; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -30195,7 +30423,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 173 || pattern.kind === 175)) { + if (pattern && (pattern.kind === 174 || pattern.kind === 176)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -30203,7 +30431,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 198) { + if (patternElement.kind !== 199) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -30220,7 +30448,7 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 142 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 143 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 340); @@ -30266,7 +30494,7 @@ var ts; var propagatedFlags = 0; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 172 || contextualType.pattern.kind === 176); + (contextualType.pattern.kind === 173 || contextualType.pattern.kind === 177); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -30275,25 +30503,25 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 258 || - memberDecl.kind === 259 || + if (memberDecl.kind === 259 || + memberDecl.kind === 260 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 258) { + if (memberDecl.kind === 259) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 149) { + else if (memberDecl.kind === 150) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 259); + ts.Debug.assert(memberDecl.kind === 260); type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 258 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 259 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 259 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 260 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912; } @@ -30319,12 +30547,12 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 260) { - if (languageVersion < 5) { + else if (memberDecl.kind === 261) { + if (languageVersion < 2) { checkExternalEmitHelpers(memberDecl, 2); } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; propertiesTable = ts.createMap(); hasComputedStringProperty = false; @@ -30336,12 +30564,12 @@ var ts; error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } - spread = getSpreadType(spread, type, false); + spread = getSpreadType(spread, type); offset = i + 1; continue; } else { - ts.Debug.assert(memberDecl.kind === 151 || memberDecl.kind === 152); + ts.Debug.assert(memberDecl.kind === 152 || memberDecl.kind === 153); checkAccessorDeclaration(memberDecl); } if (ts.hasDynamicName(memberDecl)) { @@ -30353,25 +30581,25 @@ var ts; } } else { - propertiesTable[member.name] = member; + propertiesTable.set(member.name, member); } propertiesArray.push(member); } if (contextualTypeHasPattern) { for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; - if (!propertiesTable[prop.name]) { + if (!propertiesTable.get(prop.name)) { if (!(prop.flags & 536870912)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable[prop.name] = prop; + propertiesTable.set(prop.name, prop); propertiesArray.push(prop); } } } if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); } if (spread.flags & 32768) { spread.flags |= propagatedFlags; @@ -30400,7 +30628,7 @@ var ts; } } function isValidSpreadType(type) { - return !!(type.flags & (1 | 4096 | 2048) || + return !!(type.flags & (1 | 4096 | 2048 | 16777216) || type.flags & 32768 && !isGenericMappedType(type) || type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); } @@ -30419,13 +30647,13 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 253: + case 254: checkJsxExpression(child); break; - case 247: + case 248: checkJsxElement(child); break; - case 248: + case 249: checkJsxSelfClosingElement(child); break; } @@ -30436,7 +30664,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 177 || tagName.kind === 98) { + if (tagName.kind === 178 || tagName.kind === 98) { return false; } else { @@ -30445,6 +30673,13 @@ var ts; } function checkJsxAttribute(node, elementAttributesType, nameTable) { var correspondingPropType = undefined; + var exprType; + if (node.initializer) { + exprType = checkExpression(node.initializer); + } + else { + exprType = booleanType; + } if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) { error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); } @@ -30464,17 +30699,10 @@ var ts; } } } - var exprType; - if (node.initializer) { - exprType = checkExpression(node.initializer); - } - else { - exprType = booleanType; - } if (correspondingPropType) { checkTypeAssignableTo(exprType, correspondingPropType, node); } - nameTable[node.name.text] = true; + nameTable.set(node.name.text, true); return exprType; } function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { @@ -30485,22 +30713,23 @@ var ts; var props = getPropertiesOfType(type); for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { var prop = props_2[_i]; - if (!nameTable[prop.name]) { + if (!nameTable.get(prop.name)) { var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); if (targetPropSym) { var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); } - nameTable[prop.name] = true; + nameTable.set(prop.name, true); } } return type; } function getJsxType(name) { - if (jsxTypes[name] === undefined) { - return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + var jsxType = jsxTypes.get(name); + if (jsxType === undefined) { + jsxTypes.set(name, jsxType = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } - return jsxTypes[name]; + return jsxType; } function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); @@ -30720,11 +30949,11 @@ var ts; var nameTable = ts.createMap(); var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 251) { + if (node.attributes[i].kind === 252) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 252); + ts.Debug.assert(node.attributes[i].kind === 253); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -30733,10 +30962,10 @@ var ts; } if (targetAttributesType && !sawSpreadedAny) { var targetProperties = getPropertiesOfType(targetAttributesType); - for (var i = 0; i < targetProperties.length; i++) { - if (!(targetProperties[i].flags & 536870912) && - !nameTable[targetProperties[i].name]) { - error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); + for (var _i = 0, targetProperties_1 = targetProperties; _i < targetProperties_1.length; _i++) { + var targetProperty = targetProperties_1[_i]; + if (!(targetProperty.flags & 536870912) && !nameTable.get(targetProperty.name)) { + error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperty.name, typeToString(targetAttributesType)); } } } @@ -30754,7 +30983,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 147; + return s.valueDeclaration ? s.valueDeclaration.kind : 148; } function getDeclarationModifierFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0; @@ -30765,13 +30994,16 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 || node.kind === 224 ? + var errorNode = node.kind === 178 || node.kind === 225 ? node.name : node.right; if (left.kind === 96) { - if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 149) { - error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); - return false; + if (languageVersion < 2) { + var propKind = getDeclarationKindFromSymbol(prop); + if (propKind !== 150 && propKind !== 149) { + error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + return false; + } } if (flags & 128) { error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass)); @@ -30813,16 +31045,17 @@ var ts; return true; } function checkNonNullExpression(node) { - var type = checkExpression(node); - if (strictNullChecks) { - var kind = getFalsyFlags(type) & 6144; - if (kind) { - error(node, kind & 2048 ? kind & 4096 ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); - } - return getNonNullableType(type); + return checkNonNullType(checkExpression(node), node); + } + function checkNonNullType(type, errorNode) { + var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 6144; + if (kind) { + error(errorNode, kind & 2048 ? kind & 4096 ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + var t = getNonNullableType(type); + return t.flags & (6144 | 8192) ? unknownType : t; } return type; } @@ -30870,6 +31103,10 @@ var ts; } var prop = getPropertyOfType(apparentType, right.text); if (!prop) { + var stringIndexType = getIndexTypeOfType(apparentType, 0); + if (stringIndexType) { + return stringIndexType; + } if (right.text && !checkAndReportErrorForExtendingInterface(node)) { reportNonexistentProperty(right, type.flags & 16384 && type.isThisType ? apparentType : type); } @@ -30888,7 +31125,7 @@ var ts; return unknownType; } } - if (node.kind !== 177 || assignmentKind === 1 || + if (node.kind !== 178 || assignmentKind === 1 || !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 65536)) { return propType; @@ -30897,7 +31134,7 @@ var ts; return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 177 + var left = node.kind === 178 ? node.expression : node.left; var type = checkExpression(left); @@ -30911,7 +31148,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 225) { + if (initializer.kind === 226) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -30933,7 +31170,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 213 && + if (node.kind === 214 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -30951,7 +31188,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 180 && node.parent.expression === node) { + if (node.parent.kind === 181 && 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); @@ -30971,7 +31208,7 @@ var ts; error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } - return getIndexedAccessType(objectType, indexType, node); + return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node); } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) { @@ -31004,10 +31241,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 181) { + if (node.kind === 182) { checkExpression(node.template); } - else if (node.kind !== 145) { + else if (node.kind !== 146) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -31029,19 +31266,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_9 = signature.declaration && signature.declaration.parent; + var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_9 === lastParent) { + if (lastParent && parent === lastParent) { index++; } else { - lastParent = parent_9; + lastParent = parent; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_9; + lastParent = parent; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -31058,7 +31295,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 196) { + if (arg && arg.kind === 197) { return i; } } @@ -31071,11 +31308,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 181) { + if (node.kind === 182) { var tagExpression = node; argCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 194) { + if (tagExpression.template.kind === 195) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -31087,7 +31324,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 145) { + else if (node.kind === 146) { isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, undefined, signature); @@ -31095,7 +31332,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 180); + ts.Debug.assert(callExpression.kind === 181); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -31154,7 +31391,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 !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { @@ -31201,7 +31438,7 @@ var ts; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 180) { + if (thisType && thisType !== voidType && node.kind !== 181) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; @@ -31214,7 +31451,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 !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { @@ -31229,28 +31466,28 @@ var ts; return true; } function getThisArgumentOfCall(node) { - if (node.kind === 179) { + if (node.kind === 180) { var callee = node.expression; - if (callee.kind === 177) { + if (callee.kind === 178) { return callee.expression; } - else if (callee.kind === 178) { + else if (callee.kind === 179) { return callee.expression; } } } function getEffectiveCallArguments(node) { var args; - if (node.kind === 181) { + if (node.kind === 182) { var template = node.template; args = [undefined]; - if (template.kind === 194) { + if (template.kind === 195) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 145) { + else if (node.kind === 146) { return undefined; } else { @@ -31259,21 +31496,21 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 145) { + if (node.kind === 146) { switch (node.parent.kind) { - case 227: - case 197: + case 228: + case 198: return 1; - case 147: + case 148: return 2; - case 149: - case 151: + case 150: case 152: + case 153: if (languageVersion === 0) { return 2; } return signature.parameters.length >= 3 ? 3 : 2; - case 144: + case 145: return 3; } } @@ -31282,48 +31519,48 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 227) { + if (node.kind === 228) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { return getParentTypeOfClassElement(node); } ts.Debug.fail("Unsupported decorator target."); return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 227) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { return anyType; } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var element = node; switch (element.name.kind) { case 70: case 8: case 9: return getLiteralTypeForText(32, element.name.text); - case 142: + case 143: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 512)) { return nameType; @@ -31340,20 +31577,20 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 227) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { return numberType; } - if (node.kind === 147) { + if (node.kind === 148) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); } @@ -31374,26 +31611,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex) { - if (node.kind === 145) { + if (node.kind === 146) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 145 || - (argIndex === 0 && node.kind === 181)) { + if (node.kind === 146 || + (argIndex === 0 && node.kind === 182)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 145) { + if (node.kind === 146) { return node.expression; } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return node.template; } else { @@ -31401,8 +31638,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 181; - var isDecorator = node.kind === 145; + var isTaggedTemplate = node.kind === 182; + var isDecorator = node.kind === 146; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -31432,7 +31669,7 @@ var ts; var candidateForTypeArgumentError; var resultOfFailedInference; var result; - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 180 && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma); } @@ -31701,16 +31938,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 227: - case 197: + case 228: + case 198: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 144: + case 145: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 147: + case 148: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 149: - case 151: + case 150: case 152: + case 153: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -31737,13 +31974,13 @@ var ts; } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 179: - return resolveCallExpression(node, candidatesOutArray); case 180: - return resolveNewExpression(node, candidatesOutArray); + return resolveCallExpression(node, candidatesOutArray); case 181: + return resolveNewExpression(node, candidatesOutArray); + case 182: return resolveTaggedTemplateExpression(node, candidatesOutArray); - case 145: + case 146: return resolveDecorator(node, candidatesOutArray); } ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); @@ -31775,12 +32012,12 @@ var ts; if (node.expression.kind === 96) { return voidType; } - if (node.kind === 180) { + if (node.kind === 181) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 150 && - declaration.kind !== 154 && - declaration.kind !== 159 && + declaration.kind !== 151 && + declaration.kind !== 155 && + declaration.kind !== 160 && !ts.isJSDocConstructSignature(declaration)) { var funcSymbol = node.expression.kind === 70 ? getResolvedSymbol(node.expression) : @@ -31811,9 +32048,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 226 + ? 227 : resolvedRequire.flags & 3 - ? 224 + ? 225 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -31847,7 +32084,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return unknownType; } - else if (container.kind === 150) { + else if (container.kind === 151) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -31923,8 +32160,8 @@ var ts; if (!links.type) { links.type = instantiateType(contextualType, mapper); if (links.type === emptyObjectType && - (parameter.valueDeclaration.name.kind === 172 || - parameter.valueDeclaration.name.kind === 173)) { + (parameter.valueDeclaration.name.kind === 173 || + parameter.valueDeclaration.name.kind === 174)) { links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); } assignBindingElementTypes(parameter.valueDeclaration); @@ -31963,7 +32200,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 205) { + if (func.body.kind !== 206) { 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); @@ -32042,7 +32279,7 @@ var ts; return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 219 && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 220 && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; @@ -32071,7 +32308,7 @@ var ts; } }); if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || - func.kind === 184 || func.kind === 185)) { + func.kind === 185 || func.kind === 186)) { return undefined; } if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) { @@ -32088,7 +32325,7 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 205 || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 206 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256; @@ -32115,9 +32352,9 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 184) { + if (!hasGrammarError && node.kind === 185) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -32151,7 +32388,7 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 149) { + if (produceDiagnostics && node.kind !== 150) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithCapturedNewTargetVariable(node, node.name); @@ -32159,7 +32396,7 @@ var ts; return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); if (!node.asteriskToken) { @@ -32169,7 +32406,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 205) { + if (node.body.kind === 206) { checkSourceElement(node.body); } else { @@ -32204,10 +32441,10 @@ var ts; function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { if (symbol.flags & 4 && - (expr.kind === 177 || expr.kind === 178) && + (expr.kind === 178 || expr.kind === 179) && expr.expression.kind === 98) { var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 150)) + if (!(func && func.kind === 151)) return true; return !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent); } @@ -32216,13 +32453,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 177 || expr.kind === 178) { + if (expr.kind === 178 || expr.kind === 179) { var node = ts.skipParentheses(expr.expression); if (node.kind === 70) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 238; + return declaration && declaration.kind === 239; } } } @@ -32230,7 +32467,7 @@ var ts; } function checkReferenceExpression(expr, invalidReferenceMessage) { var node = ts.skipParentheses(expr); - if (node.kind !== 70 && node.kind !== 177 && node.kind !== 178) { + if (node.kind !== 70 && node.kind !== 178 && node.kind !== 179) { error(expr, invalidReferenceMessage); return false; } @@ -32239,7 +32476,7 @@ var ts; function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); - if (expr.kind !== 177 && expr.kind !== 178) { + if (expr.kind !== 178 && expr.kind !== 179) { error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } @@ -32282,6 +32519,7 @@ var ts; case 36: case 37: case 51: + checkNonNullType(operandType, node.operand); if (maybeTypeOfKind(operandType, 512)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } @@ -32293,7 +32531,7 @@ var ts; booleanType; case 42: case 43: - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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_or_a_property_access); } @@ -32306,7 +32544,7 @@ var ts; if (operandType === silentNeverType) { return silentNeverType; } - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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_or_a_property_access); } @@ -32318,8 +32556,8 @@ var ts; } if (type.flags & 196608) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var t = types_17[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -32333,8 +32571,8 @@ var ts; } if (type.flags & 65536) { var types = type.types; - for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { - var t = types_17[_i]; + for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { + var t = types_18[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -32343,8 +32581,8 @@ var ts; } if (type.flags & 131072) { var types = type.types; - for (var _a = 0, types_18 = types; _a < types_18.length; _a++) { - var t = types_18[_a]; + for (var _a = 0, types_19 = types; _a < types_19.length; _a++) { + var t = types_19[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -32365,7 +32603,10 @@ var ts; if (isTypeOfKind(leftType, 8190)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } - if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(isTypeAny(rightType) || + getSignaturesOfType(rightType, 0).length || + getSignaturesOfType(rightType, 1).length || + isTypeSubtypeOf(rightType, globalFunctionType))) { error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; @@ -32374,6 +32615,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } @@ -32391,22 +32634,22 @@ var ts; return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 258 || property.kind === 259) { - var name_22 = property.name; - if (name_22.kind === 142) { - checkComputedPropertyName(name_22); + if (property.kind === 259 || property.kind === 260) { + var name = property.name; + if (name.kind === 143) { + checkComputedPropertyName(name); } - if (isComputedNonLiteralName(name_22)) { + if (isComputedNonLiteralName(name)) { return undefined; } - var text = ts.getTextOfPropertyName(name_22); + var text = ts.getTextOfPropertyName(name); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 259) { + if (property.kind === 260) { return checkDestructuringAssignment(property, type); } else { @@ -32414,10 +32657,10 @@ var ts; } } else { - error(name_22, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_22)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 260) { + else if (property.kind === 261) { if (languageVersion < 5) { checkExternalEmitHelpers(property, 4); } @@ -32445,8 +32688,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 198) { - if (element.kind !== 196) { + if (element.kind !== 199) { + if (element.kind !== 197) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -32472,7 +32715,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 192 && restExpression.operatorToken.kind === 57) { + if (restExpression.kind === 193 && restExpression.operatorToken.kind === 57) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -32485,7 +32728,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 259) { + if (exprOrAssignment.kind === 260) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -32499,21 +32742,21 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 192 && target.operatorToken.kind === 57) { + if (target.kind === 193 && target.operatorToken.kind === 57) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 176) { + if (target.kind === 177) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 175) { + if (target.kind === 176) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 260 ? + var error = target.parent.kind === 261 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -32527,35 +32770,35 @@ var ts; case 70: case 9: case 11: - case 181: - case 194: + case 182: + case 195: case 12: case 8: case 100: case 85: case 94: - case 137: - case 184: - case 197: + case 138: case 185: - case 175: + case 198: + case 186: case 176: - case 187: - case 201: + case 177: + case 188: + case 202: + case 249: case 248: - case 247: return true; - case 193: + case 194: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 192: + case 193: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 190: case 191: + case 192: switch (node.operator) { case 50: case 36: @@ -32564,9 +32807,9 @@ var ts; return true; } return false; - case 188: - case 182: - case 200: + case 189: + case 183: + case 201: default: return false; } @@ -32586,7 +32829,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 57 && (left.kind === 176 || left.kind === 175)) { + if (operator === 57 && (left.kind === 177 || left.kind === 176)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -32617,12 +32860,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); var suggestedOperator = void 0; if ((leftType.flags & 136) && (rightType.flags & 136) && @@ -32642,12 +32881,10 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + if (!isTypeOfKind(leftType, 1 | 262178) && !isTypeOfKind(rightType, 1 | 262178)) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } var resultType = void 0; if (isTypeOfKind(leftType, 340) && isTypeOfKind(rightType, 340)) { resultType = numberType; @@ -32676,8 +32913,8 @@ var ts; case 29: case 30: if (checkForDisallowedESSymbolOperand(operator)) { - leftType = getBaseTypeOfLiteralType(leftType); - rightType = getBaseTypeOfLiteralType(rightType); + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -32846,7 +33083,7 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 182 || node.kind === 200; + return node.kind === 183 || node.kind === 201; } function checkDeclarationInitializer(declaration) { var type = checkExpressionCached(declaration.initializer); @@ -32857,11 +33094,11 @@ var ts; function isLiteralContextualType(contextualType) { if (contextualType) { if (contextualType.flags & 540672) { - var apparentType = getApparentTypeOfTypeVariable(contextualType); - if (apparentType.flags & (2 | 4 | 8 | 16)) { + var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; + if (constraint.flags & (2 | 4 | 8 | 16)) { return true; } - contextualType = apparentType; + contextualType = constraint; } return maybeTypeOfKind(contextualType, (480 | 262144)); } @@ -32872,14 +33109,14 @@ var ts; return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type); } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -32901,7 +33138,7 @@ var ts; return type; } function getTypeOfExpression(node) { - if (node.kind === 179 && node.expression.kind !== 96) { + if (node.kind === 180 && node.expression.kind !== 96) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -32912,7 +33149,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 141) { + if (node.kind === 142) { type = checkQualifiedName(node); } else { @@ -32920,9 +33157,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 177 && node.parent.expression === node) || - (node.parent.kind === 178 && node.parent.expression === node) || - ((node.kind === 70 || node.kind === 141) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 178 && node.parent.expression === node) || + (node.parent.kind === 179 && node.parent.expression === node) || + ((node.kind === 70 || node.kind === 142) && 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); } @@ -32944,68 +33181,68 @@ var ts; case 100: case 85: return checkLiteralExpression(node); - case 194: + case 195: return checkTemplateExpression(node); case 12: return stringType; case 11: return globalRegExpType; - case 175: - return checkArrayLiteral(node, contextualMapper); case 176: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, contextualMapper); case 177: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, contextualMapper); case 178: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 179: + return checkIndexedAccess(node); case 180: - return checkCallExpression(node); case 181: + return checkCallExpression(node); + case 182: return checkTaggedTemplateExpression(node); - case 183: + case 184: return checkExpression(node.expression, contextualMapper); - case 197: + case 198: return checkClassExpression(node); - case 184: case 185: + case 186: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 187: + case 188: return checkTypeOfExpression(node); - case 182: - case 200: - return checkAssertion(node); + case 183: case 201: - return checkNonNullAssertion(node); + return checkAssertion(node); case 202: + return checkNonNullAssertion(node); + case 203: return checkMetaProperty(node); - case 186: + case 187: return checkDeleteExpression(node); - case 188: - return checkVoidExpression(node); case 189: - return checkAwaitExpression(node); + return checkVoidExpression(node); case 190: - return checkPrefixUnaryExpression(node); + return checkAwaitExpression(node); case 191: - return checkPostfixUnaryExpression(node); + return checkPrefixUnaryExpression(node); case 192: - return checkBinaryExpression(node, contextualMapper); + return checkPostfixUnaryExpression(node); case 193: + return checkBinaryExpression(node, contextualMapper); + case 194: return checkConditionalExpression(node, contextualMapper); - case 196: + case 197: return checkSpreadExpression(node, contextualMapper); - case 198: + case 199: return undefinedWideningType; - case 195: + case 196: return checkYieldExpression(node); - case 253: + case 254: return checkJsxExpression(node); - case 247: - return checkJsxElement(node); case 248: - return checkJsxSelfClosingElement(node); + return checkJsxElement(node); case 249: + return checkJsxSelfClosingElement(node); + case 250: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -33015,6 +33252,10 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!hasNonCircularBaseConstraint(typeParameter)) { + error(node.constraint, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + } getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); if (produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); @@ -33026,7 +33267,7 @@ var ts; var func = ts.getContainingFunction(node); if (ts.getModifierFlags(node) & 92) { func = ts.getContainingFunction(node); - if (!(func.kind === 150 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 151 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -33037,7 +33278,7 @@ var ts; if (ts.indexOf(func.parameters, node) !== 0) { error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); } - if (func.kind === 150 || func.kind === 154 || func.kind === 159) { + if (func.kind === 151 || func.kind === 155 || func.kind === 160) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } } @@ -33049,9 +33290,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 149 || - node.kind === 226 || - node.kind === 184; + return node.kind === 150 || + node.kind === 227 || + node.kind === 185; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -33092,9 +33333,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_23 = _a[_i].name; - if (ts.isBindingPattern(name_23) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, parameterName, typePredicate.parameterName)) { + var name = _a[_i].name; + if (ts.isBindingPattern(name) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -33107,16 +33348,16 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { + case 186: + case 154: + case 227: case 185: - case 153: - case 226: - case 184: - case 158: + case 159: + case 150: case 149: - case 148: - var parent_10 = node.parent; - if (node === parent_10.type) { - return parent_10; + var parent = node.parent; + if (node === parent.type) { + return parent; } } } @@ -33126,27 +33367,27 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_24 = element.name; - if (name_24.kind === 70 && - name_24.text === predicateVariableName) { + var name = element.name; + if (name.kind === 70 && + name.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_24.kind === 173 || - name_24.kind === 172) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, predicateVariableNode, predicateVariableName)) { + else if (name.kind === 174 || + name.kind === 173) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } } } } function checkSignatureDeclaration(node) { - if (node.kind === 155) { + if (node.kind === 156) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 || node.kind === 226 || node.kind === 159 || - node.kind === 153 || node.kind === 150 || - node.kind === 154) { + else if (node.kind === 159 || node.kind === 227 || node.kind === 160 || + node.kind === 154 || node.kind === 151 || + node.kind === 155) { checkGrammarFunctionLikeDeclaration(node); } if (ts.isAsyncFunctionLike(node) && languageVersion < 4) { @@ -33164,10 +33405,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 154: + case 155: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 153: + case 154: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -33198,7 +33439,7 @@ var ts; var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150) { + if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param)) { @@ -33207,18 +33448,18 @@ var ts; } } else { - var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114; }); + var isStatic = ts.getModifierFlags(member) & 32; var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { switch (member.kind) { - case 151: + case 152: addName(names, member.name, memberName, 1); break; - case 152: + case 153: addName(names, member.name, memberName, 2); break; - case 147: + case 148: addName(names, member.name, memberName, 3); break; } @@ -33226,17 +33467,38 @@ var ts; } } function addName(names, location, name, meaning) { - var prev = names[name]; + var prev = names.get(name); if (prev) { if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { - names[name] = prev | meaning; + names.set(name, prev | meaning); } } else { - names[name] = meaning; + names.set(name, meaning); + } + } + } + function checkClassForStaticPropertyNameConflicts(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var memberNameNode = member.name; + var isStatic = ts.getModifierFlags(member) & 32; + if (isStatic && memberNameNode) { + var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); + switch (memberName) { + case "name": + case "length": + case "caller": + case "arguments": + case "prototype": + var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; + var className = getNameOfSymbol(getSymbolOfNode(node)); + error(memberNameNode, message, memberName, className); + break; + } } } } @@ -33244,7 +33506,7 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind == 146) { + if (member.kind == 147) { var memberName = void 0; switch (member.name.kind) { case 9: @@ -33255,18 +33517,18 @@ var ts; default: continue; } - if (names[memberName]) { + if (names.get(memberName)) { error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName); error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName); } else { - names[memberName] = true; + names.set(memberName, true); } } } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 228) { + if (node.kind === 229) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -33281,7 +33543,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 134: + case 135: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -33348,12 +33610,12 @@ var ts; if (n.kind === 98) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 && n.kind !== 226) { + else if (n.kind !== 185 && n.kind !== 227) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 147 && + return n.kind === 148 && !(ts.getModifierFlags(n) & 32) && !!n.initializer; } @@ -33373,7 +33635,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -33396,18 +33658,18 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 151) { + if (node.kind === 152) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128)) { if (!(node.flags & 256)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); } } } - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 151 ? 152 : 151; + var otherKind = node.kind === 152 ? 153 : 152; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if ((ts.getModifierFlags(node) & 28) !== (ts.getModifierFlags(otherAccessor) & 28)) { @@ -33421,11 +33683,11 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 151) { + if (node.kind === 152) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } - if (node.parent.kind !== 176) { + if (node.parent.kind !== 177) { checkSourceElement(node.body); registerForUnusedIdentifiersCheck(node); } @@ -33506,25 +33768,42 @@ var ts; function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement); } + function checkIndexedAccessIndexType(type, accessNode) { + if (!(type.flags & 524288)) { + return type; + } + var objectType = type.objectType; + var indexType = type.indexType; + if (isTypeAssignableTo(indexType, getIndexType(objectType))) { + return type; + } + if (maybeTypeOfKind(objectType, 540672) && isTypeOfKind(indexType, 340)) { + var constraint = getBaseConstraintOfType(objectType); + if (constraint && getIndexInfoOfType(constraint, 1)) { + return type; + } + } + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return type; + } function checkIndexedAccessType(node) { - getTypeFromIndexedAccessTypeNode(node); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node) { checkSourceElement(node.typeParameter); checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 540672 ? getApparentTypeOfTypeVariable(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 228 && - n.parent.kind !== 227 && - n.parent.kind !== 197 && + if (n.parent.kind !== 229 && + n.parent.kind !== 228 && + n.parent.kind !== 198 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; @@ -33601,7 +33880,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) { - var reportError = (node.kind === 149 || node.kind === 148) && + var reportError = (node.kind === 150 || node.kind === 149) && (ts.getModifierFlags(node) & 32) !== (ts.getModifierFlags(subsequentNode) & 32); if (reportError) { var diagnostic = ts.getModifierFlags(node) & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; @@ -33634,11 +33913,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 228 || node.parent.kind === 161 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 229 || node.parent.kind === 162 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 226 || node.kind === 149 || node.kind === 148 || node.kind === 150) { + if (node.kind === 227 || node.kind === 150 || node.kind === 149 || node.kind === 151) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -33749,16 +34028,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 228: + case 229: return 2097152; - case 231: + case 232: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 227: - case 230: + case 228: + case 231: return 2097152 | 1048576; - case 235: + case 236: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -33906,22 +34185,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 227: + case 228: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 144: + case 145: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 147: + case 148: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 149: - case 151: + case 150: case 152: + case 153: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -33955,13 +34234,13 @@ var ts; } var firstDecorator = node.decorators[0]; checkExternalEmitHelpers(firstDecorator, 8); - if (node.kind === 144) { + if (node.kind === 145) { checkExternalEmitHelpers(firstDecorator, 32); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 227: + case 228: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -33970,19 +34249,19 @@ var ts; } } break; - case 149: - case 151: + case 150: case 152: + case 153: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; - case 147: + case 148: markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); break; - case 144: + case 145: markTypeNodeAsReferenced(node.type); break; } @@ -34003,7 +34282,7 @@ var ts; checkDecorators(node); checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); - if (node.name && node.name.kind === 142) { + if (node.name && node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -34045,43 +34324,43 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 262: - case 231: + case 263: + case 232: checkUnusedModuleMembers(node); break; - case 227: - case 197: + case 228: + case 198: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 228: + case 229: checkUnusedTypeParameters(node); break; - case 205: - case 233: - case 212: + case 206: + case 234: case 213: case 214: + case 215: checkUnusedLocalsAndParameters(node); break; - case 150: - case 184: - case 226: - case 185: - case 149: case 151: + case 185: + case 227: + case 186: + case 150: case 152: + case 153: if (node.body) { checkUnusedLocalsAndParameters(node); } checkUnusedTypeParameters(node); break; - case 148: - case 153: + case 149: case 154: case 155: - case 158: + case 156: case 159: + case 160: checkUnusedTypeParameters(node); break; } @@ -34090,11 +34369,10 @@ var ts; } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 228 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_2 = function (key) { - var local = node.locals[key]; + if (node.parent.kind !== 229 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + node.locals.forEach(function (local) { if (!local.isReferenced) { - if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144) { + if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 145) { var parameter = ts.getRootDeclaration(local.valueDeclaration); if (compilerOptions.noUnusedParameters && !ts.isParameterPropertyDeclaration(parameter) && @@ -34107,10 +34385,7 @@ var ts; ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); }); } } - }; - for (var key in node.locals) { - _loop_2(key); - } + }); } } function isRemovedPropertyFromObjectSpread(node) { @@ -34123,9 +34398,9 @@ var ts; function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 224 && - (declaration.parent.parent.kind === 213 || - declaration.parent.parent.kind === 214)) { + if (declaration.kind === 225 && + (declaration.parent.parent.kind === 214 || + declaration.parent.parent.kind === 215)) { return; } } @@ -34144,12 +34419,12 @@ var ts; if (node.members) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 149 || member.kind === 147) { + if (member.kind === 150 || member.kind === 148) { if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8) { error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); } } - else if (member.kind === 150) { + else if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8) { @@ -34180,8 +34455,7 @@ var ts; } function checkUnusedModuleMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { - for (var key in node.locals) { - var local = node.locals[key]; + node.locals.forEach(function (local) { if (!local.isReferenced && !local.exportSymbol) { for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; @@ -34190,11 +34464,11 @@ var ts; } } } - } + }); } } function checkBlock(node) { - if (node.kind === 205) { + if (node.kind === 206) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -34216,19 +34490,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 147 || - node.kind === 146 || + if (node.kind === 148 || + node.kind === 147 || + node.kind === 150 || node.kind === 149 || - node.kind === 148 || - node.kind === 151 || - node.kind === 152) { + node.kind === 152 || + node.kind === 153) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 144 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 145 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -34300,11 +34574,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 263 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -34312,11 +34586,11 @@ var ts; if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { + if (parent.kind === 263 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -34324,7 +34598,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 224 && !node.initializer) { + if (node.kind === 225 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -34334,25 +34608,25 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 225); - var container = varDeclList.parent.kind === 206 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 226); + var container = varDeclList.parent.kind === 207 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 205 && ts.isFunctionLike(container.parent) || + (container.kind === 206 && ts.isFunctionLike(container.parent) || + container.kind === 233 || container.kind === 232 || - container.kind === 231 || - container.kind === 262); + container.kind === 263); if (!namesShareScope) { - var name_25 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_25, name_25); + var name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 144) { + if (ts.getRootDeclaration(node).kind !== 145) { return; } var func = ts.getContainingFunction(node); @@ -34361,7 +34635,7 @@ var ts; if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { return; } - if (n.kind === 177) { + if (n.kind === 178) { return visit(n.expression); } else if (n.kind === 70) { @@ -34375,8 +34649,8 @@ var ts; } var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144 || - symbol.valueDeclaration.kind === 174) { + if (symbol.valueDeclaration.kind === 145 || + symbol.valueDeclaration.kind === 175) { if (symbol.valueDeclaration.pos < node.pos) { return; } @@ -34385,7 +34659,7 @@ var ts; if (ts.isFunctionLike(current.parent)) { return; } - if (current.parent.kind === 147 && + if (current.parent.kind === 148 && !(ts.hasModifier(current.parent, 32)) && ts.isClassLike(current.parent.parent)) { return; @@ -34407,37 +34681,37 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 174) { - if (node.parent.kind === 172 && languageVersion < 5 && !ts.isInAmbientContext(node)) { + if (node.kind === 175) { + if (node.parent.kind === 173 && languageVersion < 5 && !ts.isInAmbientContext(node)) { checkExternalEmitHelpers(node, 4); } - if (node.propertyName && node.propertyName.kind === 142) { + if (node.propertyName && node.propertyName.kind === 143) { checkComputedPropertyName(node.propertyName); } - var parent_11 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_11); - var name_26 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_26)); + var parent = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent); + var name = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name)); markPropertyAsReferenced(property); - if (parent_11.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + if (parent.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent, parent.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 144 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 145 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 213) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -34446,7 +34720,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol)); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 213) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -34464,9 +34738,9 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 147 && node.kind !== 146) { + if (node.kind !== 148 && node.kind !== 147) { checkExportsOnMergedDeclarations(node); - if (node.kind === 224 || node.kind === 174) { + if (node.kind === 225 || node.kind === 175) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -34477,8 +34751,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 && right.kind === 224) || - (left.kind === 224 && right.kind === 144)) { + if ((left.kind === 145 && right.kind === 225) || + (left.kind === 225 && right.kind === 145)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -34505,7 +34779,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 176) { + if (node.modifiers && node.parent.kind === 177) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -34524,7 +34798,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 207) { + if (node.thenStatement.kind === 208) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -34541,12 +34815,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 225) { + if (node.initializer && node.initializer.kind === 226) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 225) { + if (node.initializer.kind === 226) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -34564,13 +34838,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 225) { + if (node.initializer.kind === 226) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 175 || varExpr.kind === 176) { + if (varExpr.kind === 176 || varExpr.kind === 177) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -34589,7 +34863,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); - if (node.initializer.kind === 225) { + if (node.initializer.kind === 226) { 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); @@ -34599,7 +34873,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 175 || varExpr.kind === 176) { + if (varExpr.kind === 176 || varExpr.kind === 177) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -34775,7 +35049,7 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152))); + return !!(node.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 153))); } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; @@ -34797,30 +35071,30 @@ var ts; if (func.asteriskToken) { return; } - if (func.kind === 152) { + if (func.kind === 153) { if (node.expression) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 150) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { - error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + else if (func.kind === 151) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { - checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + checkTypeAssignableTo(awaitedType, promisedType, node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression || node); + checkTypeAssignableTo(exprType, returnType, node); } } } - else if (func.kind !== 150 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + else if (func.kind !== 151 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } } @@ -34846,7 +35120,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 255 && !hasDuplicateDefaultClause) { + if (clause.kind === 256 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -34858,7 +35132,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 254) { + if (produceDiagnostics && clause.kind === 255) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); var caseIsLiteral = isLiteralType(caseType); @@ -34884,7 +35158,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 220 && current.label.text === node.label.text) { + if (current.kind === 221 && 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; @@ -34917,14 +35191,14 @@ var ts; grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var blockLocals = catchClause.block.locals; - if (blockLocals) { - for (var caughtName in catchClause.locals) { - var blockLocal = blockLocals[caughtName]; + var blockLocals_1 = catchClause.block.locals; + if (blockLocals_1) { + ts.forEachKey(catchClause.locals, function (caughtName) { + var blockLocal = blockLocals_1.get(caughtName); if (blockLocal && (blockLocal.flags & 2) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); } - } + }); } } } @@ -34972,12 +35246,13 @@ var ts; if (!indexType) { return; } - if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { + var propDeclaration = prop.valueDeclaration; + if (indexKind === 1 && !(propDeclaration ? isNumericName(propDeclaration.name) : isNumericLiteralName(prop.name))) { return; } var errorNode; - if (prop.valueDeclaration.name.kind === 142 || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + if (propDeclaration && (propDeclaration.name.kind === 143 || prop.parent === containingType.symbol)) { + errorNode = propDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; @@ -35002,6 +35277,7 @@ var ts; case "string": case "symbol": case "void": + case "object": error(name, message, name.text); } } @@ -35027,7 +35303,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 || declaration.kind === 228) { + if (declaration.kind === 228 || declaration.kind === 229) { if (!firstDecl) { firstDecl = declaration; } @@ -35072,6 +35348,9 @@ var ts; var staticType = getTypeOfSymbol(symbol); checkTypeParameterListsIdentical(node, symbol); checkClassForDuplicateDeclarations(node); + if (!ts.isInAmbientContext(node)) { + checkClassForStaticPropertyNameConflicts(node); + } var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { if (languageVersion < 2 && !ts.isInAmbientContext(node)) { @@ -35080,7 +35359,8 @@ var ts; var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; - var staticBaseType = getBaseConstructorTypeOfClass(type); + var baseConstructorType = getBaseConstructorTypeOfClass(type); + var staticBaseType = getApparentType(baseConstructorType); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { @@ -35094,14 +35374,17 @@ var ts; } checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType_1.symbol.valueDeclaration && + if (baseConstructorType.flags & 540672 && !isMixinConstructorType(staticType)) { + error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); + } + if (baseType_1.symbol && baseType_1.symbol.valueDeclaration && !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 227) { + baseType_1.symbol.valueDeclaration.kind === 228) { if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); } } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 540672)) { var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); @@ -35121,8 +35404,7 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { - var declaredType = getObjectFlags(t) & 4 ? t.target : t; - if (getObjectFlags(declaredType) & 3) { + if (isValidBaseType(t)) { checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -35156,7 +35438,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { - var baseProperties = getPropertiesOfObjectType(baseType); + var baseProperties = getPropertiesOfType(baseType); for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); @@ -35170,7 +35452,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128))) { - if (derivedClassDecl.kind === 197) { + if (derivedClassDecl.kind === 198) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -35214,7 +35496,7 @@ var ts; } } function isAccessor(kind) { - return kind === 151 || kind === 152; + return kind === 152 || kind === 153; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -35247,16 +35529,16 @@ var ts; return true; } var seen = ts.createMap(); - ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.name, { prop: p, containingType: type }); }); var ok = true; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); + var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { var prop = properties_7[_a]; - var existing = seen[prop.name]; + var existing = seen.get(prop.name); if (!existing) { - seen[prop.name] = { prop: prop, containingType: base }; + seen.set(prop.name, { prop: prop, containingType: base }); } else { var isInheritedProperty = existing.containingType !== type; @@ -35281,7 +35563,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 228); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 229); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -35377,7 +35659,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 190: + case 191: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -35388,7 +35670,7 @@ var ts; case 51: return ~value_1; } return undefined; - case 192: + case 193: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -35414,11 +35696,11 @@ var ts; case 8: checkGrammarNumericLiteral(e); return +e.text; - case 183: + case 184: return evalConstant(e.expression); case 70: + case 179: case 178: - case 177: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -35429,7 +35711,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 178) { + if (e.kind === 179) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -35446,7 +35728,7 @@ var ts; if (current.kind === 70) { break; } - else if (current.kind === 177) { + else if (current.kind === 178) { current = current.expression; } else { @@ -35507,7 +35789,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 230) { + if (declaration.kind !== 231) { return false; } var enumDeclaration = declaration; @@ -35530,8 +35812,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 227 || - (declaration.kind === 226 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 228 || + (declaration.kind === 227 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -35590,7 +35872,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, 227); + var mergedClass = ts.getDeclarationOfKind(symbol, 228); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -35633,36 +35915,36 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 206: + case 207: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 241: case 242: + case 243: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 235: case 236: + case 237: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 174: - case 224: - var name_27 = node.name; - if (ts.isBindingPattern(name_27)) { - for (var _b = 0, _c = name_27.elements; _b < _c.length; _b++) { + case 175: + case 225: + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } - case 227: - case 230: - case 226: case 228: case 231: + case 227: case 229: + case 232: + case 230: if (isGlobalAugmentation) { return; } @@ -35680,12 +35962,12 @@ var ts; switch (node.kind) { case 70: return node; - case 141: + case 142: do { node = node.left; } while (node.kind !== 70); return node; - case 177: + case 178: do { node = node.expression; } while (node.kind !== 70); @@ -35698,9 +35980,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 262 && !inAmbientExternalModule) { - error(moduleName, node.kind === 242 ? + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 263 && !inAmbientExternalModule) { + error(moduleName, node.kind === 243 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -35721,7 +36003,7 @@ var ts; (symbol.flags & 793064 ? 793064 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 244 ? + var message = node.kind === 245 ? 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)); @@ -35748,7 +36030,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 238) { + if (importClause.namedBindings.kind === 239) { checkImportBinding(importClause.namedBindings); } else { @@ -35799,8 +36081,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 262 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 263 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -35813,7 +36095,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 262 || node.parent.kind === 232 || node.parent.kind === 231; + var isInAppropriateContext = node.parent.kind === 263 || node.parent.kind === 233 || node.parent.kind === 232; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -35836,8 +36118,8 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 262 ? node.parent : node.parent.parent; - if (container.kind === 231 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 263 ? node.parent : node.parent.parent; + if (container.kind === 232 && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -35866,18 +36148,13 @@ var ts; } } function hasExportedMembers(moduleSymbol) { - for (var id in moduleSymbol.exports) { - if (id !== "export=") { - return true; - } - } - return false; + return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; }); } function checkExternalModuleExports(node) { var moduleSymbol = getSymbolOfNode(node); var links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - var exportEqualsSymbol = moduleSymbol.exports["export="]; + var exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (!isTopLevelInExternalModuleAugmentation(declaration)) { @@ -35885,17 +36162,17 @@ var ts; } } var exports_1 = getExportsOfModule(moduleSymbol); - for (var id in exports_1) { + exports_1 && exports_1.forEach(function (_a, id) { + var declarations = _a.declarations, flags = _a.flags; if (id === "__export") { - continue; + return; } - var _a = exports_1[id], declarations = _a.declarations, flags = _a.flags; if (flags & (1920 | 64 | 384)) { - continue; + return; } var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); if (flags & 524288 && exportedDeclarationsCount <= 2) { - continue; + return; } if (exportedDeclarationsCount > 1) { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -35905,11 +36182,11 @@ var ts; } } } - } + }); links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 226 && declaration.kind !== 149) || + return (declaration.kind !== 227 && declaration.kind !== 150) || !!declaration.body; } } @@ -35920,123 +36197,123 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 231: - case 227: + case 232: case 228: - case 226: + case 229: + case 227: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 143: - return checkTypeParameter(node); case 144: + return checkTypeParameter(node); + case 145: return checkParameter(node); + case 148: case 147: - case 146: return checkPropertyDeclaration(node); - case 158: case 159: - case 153: + case 160: case 154: - return checkSignatureDeclaration(node); case 155: return checkSignatureDeclaration(node); + case 156: + return checkSignatureDeclaration(node); + case 150: case 149: - case 148: return checkMethodDeclaration(node); - case 150: - return checkConstructorDeclaration(node); case 151: + return checkConstructorDeclaration(node); case 152: + case 153: return checkAccessorDeclaration(node); - case 157: + case 158: return checkTypeReferenceNode(node); - case 156: + case 157: return checkTypePredicate(node); - case 160: - return checkTypeQuery(node); case 161: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 162: - return checkArrayType(node); + return checkTypeLiteral(node); case 163: - return checkTupleType(node); + return checkArrayType(node); case 164: + return checkTupleType(node); case 165: - return checkUnionOrIntersectionType(node); case 166: - case 168: - return checkSourceElement(node.type); + return checkUnionOrIntersectionType(node); + case 167: case 169: - return checkIndexedAccessType(node); + return checkSourceElement(node.type); case 170: + return checkIndexedAccessType(node); + case 171: return checkMappedType(node); - case 226: + case 227: return checkFunctionDeclaration(node); - case 205: - case 232: - return checkBlock(node); case 206: + case 233: + return checkBlock(node); + case 207: return checkVariableStatement(node); - case 208: - return checkExpressionStatement(node); case 209: - return checkIfStatement(node); + return checkExpressionStatement(node); case 210: - return checkDoStatement(node); + return checkIfStatement(node); case 211: - return checkWhileStatement(node); + return checkDoStatement(node); case 212: - return checkForStatement(node); + return checkWhileStatement(node); case 213: - return checkForInStatement(node); + return checkForStatement(node); case 214: - return checkForOfStatement(node); + return checkForInStatement(node); case 215: + return checkForOfStatement(node); case 216: - return checkBreakOrContinueStatement(node); case 217: - return checkReturnStatement(node); + return checkBreakOrContinueStatement(node); case 218: - return checkWithStatement(node); + return checkReturnStatement(node); case 219: - return checkSwitchStatement(node); + return checkWithStatement(node); case 220: - return checkLabeledStatement(node); + return checkSwitchStatement(node); case 221: - return checkThrowStatement(node); + return checkLabeledStatement(node); case 222: + return checkThrowStatement(node); + case 223: return checkTryStatement(node); - case 224: + case 225: return checkVariableDeclaration(node); - case 174: + case 175: return checkBindingElement(node); - case 227: - return checkClassDeclaration(node); case 228: - return checkInterfaceDeclaration(node); + return checkClassDeclaration(node); case 229: - return checkTypeAliasDeclaration(node); + return checkInterfaceDeclaration(node); case 230: - return checkEnumDeclaration(node); + return checkTypeAliasDeclaration(node); case 231: + return checkEnumDeclaration(node); + case 232: return checkModuleDeclaration(node); - case 236: + case 237: return checkImportDeclaration(node); - case 235: + case 236: return checkImportEqualsDeclaration(node); - case 242: + case 243: return checkExportDeclaration(node); - case 241: + case 242: return checkExportAssignment(node); - case 207: + case 208: checkGrammarStatementInAmbientContext(node); return; - case 223: + case 224: checkGrammarStatementInAmbientContext(node); return; - case 245: + case 246: return checkMissingDeclaration(node); } } @@ -36049,17 +36326,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 184: case 185: + case 186: + case 150: case 149: - case 148: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 151: case 152: + case 153: checkAccessorDeferred(node); break; - case 197: + case 198: checkClassExpressionDeferred(node); break; } @@ -36147,7 +36424,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 218 && node.parent.statement === node) { + if (node.parent.kind === 219 && node.parent.statement === node) { return true; } node = node.parent; @@ -36169,28 +36446,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 262: + case 263: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 231: + case 232: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 230: + case 231: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 197: + case 198: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 227: case 228: + case 229: if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793064); } break; - case 184: + case 185: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -36208,17 +36485,16 @@ var ts; function copySymbol(symbol, meaning) { if (symbol.flags & meaning) { var id = symbol.name; - if (!symbols[id]) { - symbols[id] = symbol; + if (!symbols.has(id)) { + symbols.set(id, symbol); } } } function copySymbols(source, meaning) { if (meaning) { - for (var id in source) { - var symbol = source[id]; + source.forEach(function (symbol) { copySymbol(symbol, meaning); - } + }); } } } @@ -36229,27 +36505,27 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 143: - case 227: + case 144: case 228: case 229: case 230: + case 231: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 141) { + while (node.parent && node.parent.kind === 142) { node = node.parent; } - return node.parent && (node.parent.kind === 157 || node.parent.kind === 273); + return node.parent && (node.parent.kind === 158 || node.parent.kind === 274); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 177) { + while (node.parent && node.parent.kind === 178) { node = node.parent; } - return node.parent && node.parent.kind === 199; + return node.parent && node.parent.kind === 200; } function forEachEnclosingClass(node, callback) { var result; @@ -36266,13 +36542,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 141) { + while (nodeOnRightSide.parent.kind === 142) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 235) { + if (nodeOnRightSide.parent.kind === 236) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 241) { + if (nodeOnRightSide.parent.kind === 242) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -36284,7 +36560,7 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 178) { var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); switch (specialPropertyAssignmentKind) { case 1: @@ -36296,11 +36572,11 @@ var ts; default: } } - if (entityName.parent.kind === 241 && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 242 && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608); } - if (entityName.kind !== 177 && isInRightSideOfImportOrExportAssignment(entityName)) { - var importEqualsDeclaration = ts.getAncestor(entityName, 235); + if (entityName.kind !== 178 && isInRightSideOfImportOrExportAssignment(entityName)) { + var importEqualsDeclaration = ts.getAncestor(entityName, 236); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true); } @@ -36309,7 +36585,7 @@ var ts; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 199) { + if (entityName.parent.kind === 200) { meaning = 793064; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 107455; @@ -36331,14 +36607,14 @@ var ts; } return resolveEntityName(entityName, 107455, false, true); } - else if (entityName.kind === 177) { + else if (entityName.kind === 178) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 141) { + else if (entityName.kind === 142) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -36347,19 +36623,19 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 273) ? 793064 : 1920; + var meaning = (entityName.parent.kind === 158 || entityName.parent.kind === 274) ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 251) { + else if (entityName.parent.kind === 252) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 156) { + if (entityName.parent.kind === 157) { return resolveEntityName(entityName, 1); } return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 262) { + if (node.kind === 263) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -36375,8 +36651,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 174 && - node.parent.parent.kind === 172 && + else if (node.parent.kind === 175 && + node.parent.parent.kind === 173 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -36387,8 +36663,8 @@ var ts; } switch (node.kind) { case 70: - case 177: - case 141: + case 178: + case 142: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 98: var container = ts.getThisContainer(node, false); @@ -36401,18 +36677,18 @@ var ts; case 96: var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 167: + case 168: return getTypeFromTypeNode(node).symbol; case 122: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 150) { + if (constructorDeclaration && constructorDeclaration.kind === 151) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 236 || node.parent.kind === 242) && + ((node.parent.kind === 237 || node.parent.kind === 243) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -36420,7 +36696,7 @@ var ts; return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 178 && node.parent.argumentExpression === node) { + if (node.parent.kind === 179 && node.parent.argumentExpression === node) { var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -36434,7 +36710,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 259) { + if (location && location.kind === 260) { return resolveEntityName(location.name, 107455 | 8388608); } return undefined; @@ -36484,20 +36760,20 @@ var ts; return unknownType; } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 176 || expr.kind === 175); - if (expr.parent.kind === 214) { + ts.Debug.assert(expr.kind === 177 || expr.kind === 176); + if (expr.parent.kind === 215) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 192) { + if (expr.parent.kind === 193) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 258) { + if (expr.parent.kind === 259) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } - ts.Debug.assert(expr.parent.kind === 175); + ts.Debug.assert(expr.parent.kind === 176); var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); @@ -36523,8 +36799,8 @@ var ts; var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { - if (!propsByName[p.name]) { - propsByName[p.name] = p; + if (!propsByName.has(p.name)) { + propsByName.set(p.name, p); } }); } @@ -36533,9 +36809,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols_3 = []; - var name_28 = symbol.name; + var name_2 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_28); + var symbol = getPropertyOfType(t, name_2); if (symbol) { symbols_3.push(symbol); } @@ -36547,6 +36823,9 @@ var ts; var links = symbol; return [links.leftSpread, links.rightSpread]; } + if (symbol.mappedTypeOrigin) { + return getRootSymbols(symbol.mappedTypeOrigin); + } var target = void 0; var next = symbol; while (next = getSymbolLinks(next).target) { @@ -36562,7 +36841,8 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - return getReferencedValueSymbol(node) === argumentsSymbol; + var isPropertyName_1 = node.parent.kind === 178 && node.parent.name === node; + return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } return false; @@ -36578,7 +36858,7 @@ var ts; if (symbolLinks.exportsSomeValue === undefined) { symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 107455) - : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue); + : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; function isValue(s) { @@ -36604,7 +36884,7 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 262) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 263) { var symbolFile = parentSymbol.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -36642,7 +36922,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 205 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 206 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -36682,16 +36962,16 @@ var ts; return true; } switch (node.kind) { - case 235: - case 237: + case 236: case 238: - case 240: - case 244: + case 239: + case 241: + case 245: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 242: + case 243: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 241: + case 242: return node.expression && node.expression.kind === 70 ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -36701,7 +36981,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 262 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 263 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -36752,7 +37032,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 261) { + if (node.kind === 262) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -36768,15 +37048,17 @@ var ts; } function getTypeReferenceSerializationKind(typeName, location) { var valueSymbol = resolveEntityName(typeName, 107455, true, false, location); - var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); - if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { - return ts.TypeReferenceSerializationKind.Promise; - } - var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; - if (constructorType && isConstructorType(constructorType)) { - return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; - } var typeSymbol = resolveEntityName(typeName, 793064, true, false, location); + if (valueSymbol && valueSymbol === typeSymbol) { + var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return ts.TypeReferenceSerializationKind.Promise; + } + var constructorType = getTypeOfSymbol(valueSymbol); + if (constructorType && isConstructorType(constructorType)) { + return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + } if (!typeSymbol) { return ts.TypeReferenceSerializationKind.ObjectType; } @@ -36837,7 +37119,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); } function hasGlobalName(name) { - return !!globals[name]; + return globals.has(name); } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; @@ -36846,9 +37128,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_12 = reference.parent; - if (ts.isDeclaration(parent_12) && reference === parent_12.name) { - location = getDeclarationContainer(parent_12); + var parent = reference.parent; + if (ts.isDeclaration(parent) && reference === parent.name) { + location = getDeclarationContainer(parent); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -36881,14 +37163,13 @@ var ts; var fileToDirective; if (resolvedTypeReferenceDirectives) { fileToDirective = ts.createFileMap(); - for (var key in resolvedTypeReferenceDirectives) { - var resolvedDirective = resolvedTypeReferenceDirectives[key]; + resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (!resolvedDirective) { - continue; + return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key); - } + }); } return { getReferencedExportContainer: getReferencedExportContainer, @@ -36926,7 +37207,7 @@ var ts; if (!fileToDirective) { return undefined; } - var meaning = (node.kind === 177) || (node.kind === 70 && isInTypeQuery(node)) + var meaning = (node.kind === 178) || (node.kind === 70 && isInTypeQuery(node)) ? 107455 | 1048576 : 793064 | 1920; var symbol = resolveEntityName(node, meaning, true); @@ -36961,15 +37242,15 @@ var ts; } var current = symbol; while (true) { - var parent_13 = getParentOfSymbol(current); - if (parent_13) { - current = parent_13; + var parent = getParentOfSymbol(current); + if (parent) { + current = parent; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 262 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 263 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -36988,7 +37269,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 262); + return ts.getDeclarationOfKind(moduleSymbol, 263); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -37009,11 +37290,11 @@ var ts; } if (file.symbol && file.symbol.globalExports) { var source = file.symbol.globalExports; - for (var id in source) { - if (!(id in globals)) { - globals[id] = source[id]; + source.forEach(function (sourceSymbol, id) { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); } - } + }); } } if (augmentations) { @@ -37079,10 +37360,10 @@ var ts; var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; for (var helper = 1; helper <= 128; helper <<= 1) { if (uncheckedHelpers & helper) { - var name_29 = getHelperName(helper); - var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_29), 107455); + var name = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name), 107455); if (!symbol) { - error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_29); + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); } } } @@ -37131,14 +37412,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 149 && !ts.nodeIsPresent(node.body)) { + if (node.kind === 150 && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 151 || node.kind === 152) { + else if (node.kind === 152 || node.kind === 153) { 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); @@ -37156,16 +37437,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 130) { - if (node.kind === 146 || node.kind === 148) { + if (node.kind === 147 || node.kind === 149) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 155) { + if (node.kind === 156) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 75: - if (node.kind !== 230 && node.parent.kind === 227) { + if (node.kind !== 231 && node.parent.kind === 228) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75)); } break; @@ -37191,7 +37472,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 232 || node.parent.kind === 262) { + else if (node.parent.kind === 233 || node.parent.kind === 263) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -37214,10 +37495,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 232 || node.parent.kind === 262) { + else if (node.parent.kind === 233 || node.parent.kind === 263) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128) { @@ -37230,7 +37511,7 @@ var ts; if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 147 && node.kind !== 146 && node.kind !== 155 && node.kind !== 144) { + else if (node.kind !== 148 && node.kind !== 147 && node.kind !== 156 && node.kind !== 145) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64; @@ -37249,10 +37530,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -37264,13 +37545,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 232) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 233) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -37280,14 +37561,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 227) { - if (node.kind !== 149 && - node.kind !== 147 && - node.kind !== 151 && - node.kind !== 152) { + if (node.kind !== 228) { + if (node.kind !== 150 && + node.kind !== 148 && + node.kind !== 152 && + node.kind !== 153) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 227 && ts.getModifierFlags(node.parent) & 128)) { + if (!(node.parent.kind === 228 && ts.getModifierFlags(node.parent) & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -37306,7 +37587,7 @@ var ts; 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 === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256; @@ -37314,7 +37595,7 @@ var ts; break; } } - if (node.kind === 150) { + if (node.kind === 151) { if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -37329,13 +37610,13 @@ var ts; } return; } - else if ((node.kind === 236 || node.kind === 235) && flags & 2) { + else if ((node.kind === 237 || node.kind === 236) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 144 && (flags & 92) && ts.isBindingPattern(node.name)) { + else if (node.kind === 145 && (flags & 92) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 144 && (flags & 92) && node.dotDotDotToken) { + else if (node.kind === 145 && (flags & 92) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256) { @@ -37351,37 +37632,37 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 151: case 152: - case 150: + case 153: + case 151: + case 148: case 147: - case 146: + case 150: case 149: - case 148: - case 155: - case 231: + case 156: + case 232: + case 237: case 236: - case 235: + case 243: case 242: - case 241: - case 184: case 185: - case 144: + case 186: + case 145: return false; default: - if (node.parent.kind === 232 || node.parent.kind === 262) { + if (node.parent.kind === 233 || node.parent.kind === 263) { return false; } switch (node.kind) { - case 226: - return nodeHasAnyModifiersExcept(node, 119); case 227: - return nodeHasAnyModifiersExcept(node, 116); + return nodeHasAnyModifiersExcept(node, 119); case 228: - case 206: + return nodeHasAnyModifiersExcept(node, 116); case 229: - return true; + case 207: case 230: + return true; + case 231: return nodeHasAnyModifiersExcept(node, 75); default: ts.Debug.fail(); @@ -37394,10 +37675,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 149: - case 226: - case 184: + case 150: + case 227: case 185: + case 186: if (!node.asteriskToken) { return false; } @@ -37459,7 +37740,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 185) { + if (node.kind === 186) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -37494,7 +37775,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 !== 134 && parameter.type.kind !== 132) { + if (parameter.type.kind !== 135 && parameter.type.kind !== 132) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -37521,7 +37802,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { var arg = args_4[_i]; - if (arg.kind === 198) { + if (arg.kind === 199) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -37591,19 +37872,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 142) { + if (node.kind !== 143) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 192 && computedPropertyName.expression.operatorToken.kind === 25) { + if (computedPropertyName.expression.kind === 193 && computedPropertyName.expression.operatorToken.kind === 25) { 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 === 226 || - node.kind === 184 || - node.kind === 149); + ts.Debug.assert(node.kind === 227 || + node.kind === 185 || + node.kind === 150); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -37628,66 +37909,66 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 260) { + if (prop.kind === 261) { continue; } - var name_30 = prop.name; - if (name_30.kind === 142) { - checkGrammarComputedPropertyName(name_30); + var name = prop.name; + if (name.kind === 143) { + checkGrammarComputedPropertyName(name); } - if (prop.kind === 259 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 260 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (mod.kind !== 119 || prop.kind !== 149) { + if (mod.kind !== 119 || prop.kind !== 150) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } } var currentKind = void 0; - if (prop.kind === 258 || prop.kind === 259) { + if (prop.kind === 259 || prop.kind === 260) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_30.kind === 8) { - checkGrammarNumericLiteral(name_30); + if (name.kind === 8) { + checkGrammarNumericLiteral(name); } currentKind = Property; } - else if (prop.kind === 149) { + else if (prop.kind === 150) { currentKind = Property; } - else if (prop.kind === 151) { + else if (prop.kind === 152) { currentKind = GetAccessor; } - else if (prop.kind === 152) { + else if (prop.kind === 153) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_30); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name); if (effectiveName === undefined) { continue; } - if (!seen[effectiveName]) { - seen[effectiveName] = currentKind; + var existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); } else { - var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_30, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_30)); + grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[effectiveName] = currentKind | existingKind; + seen.set(effectiveName, currentKind | existingKind); } else { - return grammarErrorOnNode(name_30, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name_30, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -37696,19 +37977,19 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 252) { + if (attr.kind === 253) { continue; } var jsxAttr = attr; - var name_31 = jsxAttr.name; - if (!seen[name_31.text]) { - seen[name_31.text] = true; + var name = jsxAttr.name; + if (!seen.get(name.text)) { + seen.set(name.text, true); } else { - return grammarErrorOnNode(name_31, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 253 && !initializer.expression) { + if (initializer && initializer.kind === 254 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -37717,7 +37998,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 225) { + if (forInOrOfStatement.initializer.kind === 226) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -37725,20 +38006,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 213 + var diagnostic = forInOrOfStatement.kind === 214 ? 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 = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 213 + var diagnostic = forInOrOfStatement.kind === 214 ? 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 === 213 + var diagnostic = forInOrOfStatement.kind === 214 ? 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); @@ -37765,11 +38046,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 151 ? + return grammarErrorOnNode(accessor.name, kind === 152 ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 152) { + else if (kind === 153) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -37788,10 +38069,10 @@ var ts; } } function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 152 ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 151 ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 152 ? 1 : 2)) { return ts.getThisParameter(accessor); } } @@ -37806,7 +38087,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 176) { + if (node.parent.kind === 177) { if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } @@ -37822,10 +38103,10 @@ 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 === 228) { + else if (node.parent.kind === 229) { 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 === 161) { + else if (node.parent.kind === 162) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -37836,9 +38117,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 220: + case 221: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 215 + var isMisplacedContinueLabel = node.kind === 216 && !ts.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); @@ -37846,8 +38127,8 @@ var ts; return false; } break; - case 219: - if (node.kind === 216 && !node.label) { + case 220: + if (node.kind === 217 && !node.label) { return false; } break; @@ -37860,13 +38141,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 216 + var message = node.kind === 217 ? 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 === 216 + var message = node.kind === 217 ? 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); @@ -37878,7 +38159,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 173 || node.name.kind === 172) { + if (node.name.kind === 174 || node.name.kind === 173) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -37888,11 +38169,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 || expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 213 && node.parent.parent.kind !== 214) { + if (node.parent.parent.kind !== 214 && node.parent.parent.kind !== 215) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -37949,15 +38230,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 209: case 210: case 211: - case 218: case 212: + case 219: case 213: case 214: + case 215: return false; - case 220: + case 221: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -38019,7 +38300,7 @@ var ts; return true; } } - else if (node.parent.kind === 228) { + else if (node.parent.kind === 229) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -38027,7 +38308,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 161) { + else if (node.parent.kind === 162) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -38040,13 +38321,13 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 228 || - node.kind === 229 || + if (node.kind === 229 || + node.kind === 230 || + node.kind === 237 || node.kind === 236 || - node.kind === 235 || + node.kind === 243 || node.kind === 242 || - node.kind === 241 || - node.kind === 234 || + node.kind === 235 || ts.getModifierFlags(node) & (2 | 1 | 512)) { return false; } @@ -38055,7 +38336,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 === 206) { + if (ts.isDeclaration(decl) || decl.kind === 207) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -38074,7 +38355,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 === 205 || node.parent.kind === 232 || node.parent.kind === 262) { + if (node.parent.kind === 206 || node.parent.kind === 233 || node.parent.kind === 263) { 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); @@ -38090,10 +38371,10 @@ var ts; if (languageVersion >= 1) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 171)) { + else if (ts.isChildOfNodeWithKind(node, 172)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 261)) { + else if (ts.isChildOfNodeWithKind(node, 262)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -38113,11 +38394,11 @@ var ts; } function getAmbientModules() { var result = []; - for (var sym in globals) { + globals.forEach(function (global, sym) { if (ambientModuleSymbolRegex.test(sym)) { - result.push(globals[sym]); + result.push(global); } - } + }); return result; } } @@ -38126,54 +38407,56 @@ var ts; var ts; (function (ts) { ; - var nodeEdgeTraversalMap = ts.createMap((_a = {}, - _a[141] = [ - { name: "left", test: ts.isEntityName }, - { name: "right", test: ts.isIdentifier } - ], - _a[145] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[182] = [ - { name: "type", test: ts.isTypeNode }, - { name: "expression", test: ts.isUnaryExpression } - ], - _a[200] = [ - { name: "expression", test: ts.isExpression }, - { name: "type", test: ts.isTypeNode } - ], - _a[201] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[230] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "members", test: ts.isEnumMember } - ], - _a[231] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isModuleName }, - { name: "body", test: ts.isModuleBody } - ], - _a[232] = [ - { name: "statements", test: ts.isStatement } - ], - _a[235] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "moduleReference", test: ts.isModuleReference } - ], - _a[246] = [ - { name: "expression", test: ts.isExpression, optional: true } - ], - _a[261] = [ - { name: "name", test: ts.isPropertyName }, - { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } - ], - _a)); + function getNodeEdgeTraversal(kind) { + switch (kind) { + case 142: return [ + { name: "left", test: ts.isEntityName }, + { name: "right", test: ts.isIdentifier } + ]; + case 146: return [ + { name: "expression", test: ts.isLeftHandSideExpression } + ]; + case 183: return [ + { name: "type", test: ts.isTypeNode }, + { name: "expression", test: ts.isUnaryExpression } + ]; + case 201: return [ + { name: "expression", test: ts.isExpression }, + { name: "type", test: ts.isTypeNode } + ]; + case 202: return [ + { name: "expression", test: ts.isLeftHandSideExpression } + ]; + case 231: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "members", test: ts.isEnumMember } + ]; + case 232: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isModuleName }, + { name: "body", test: ts.isModuleBody } + ]; + case 233: return [ + { name: "statements", test: ts.isStatement } + ]; + case 236: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "moduleReference", test: ts.isModuleReference } + ]; + case 247: return [ + { name: "expression", test: ts.isExpression, optional: true } + ]; + case 262: return [ + { name: "name", test: ts.isPropertyName }, + { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } + ]; + } + } function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } @@ -38187,41 +38470,41 @@ var ts; var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; var cbNodes = cbNodeArray || cbNode; var kind = node.kind; - if ((kind > 0 && kind <= 140)) { + if ((kind > 0 && kind <= 141)) { return initial; } - if ((kind >= 156 && kind <= 171)) { + if ((kind >= 157 && kind <= 172)) { return initial; } var result = initial; switch (node.kind) { - case 204: - case 207: - case 198: - case 223: - case 294: + case 205: + case 208: + case 199: + case 224: + case 295: break; - case 142: + case 143: result = reduceNode(node.expression, cbNode, result); break; - case 144: + case 145: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 145: + case 146: result = reduceNode(node.expression, cbNode, result); break; - case 147: + case 148: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 149: + case 150: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38230,12 +38513,12 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 150: + case 151: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 151: + case 152: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38243,51 +38526,51 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 152: + case 153: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 172: case 173: + case 174: result = reduceNodes(node.elements, cbNodes, result); break; - case 174: + case 175: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 175: + case 176: result = reduceNodes(node.elements, cbNodes, result); break; - case 176: + case 177: result = reduceNodes(node.properties, cbNodes, result); break; - case 177: + case 178: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 178: + case 179: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.argumentExpression, cbNode, result); break; - case 179: + case 180: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 180: + case 181: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 181: + case 182: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 184: + case 185: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -38295,117 +38578,117 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 185: + case 186: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 183: - case 186: + case 184: case 187: case 188: case 189: - case 195: + case 190: case 196: - case 201: + case 197: + case 202: result = reduceNode(node.expression, cbNode, result); break; - case 190: case 191: + case 192: result = reduceNode(node.operand, cbNode, result); break; - case 192: + case 193: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 193: + case 194: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 194: + case 195: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 197: + case 198: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 199: + case 200: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 203: + case 204: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; - case 205: + case 206: result = reduceNodes(node.statements, cbNodes, result); break; - case 206: + case 207: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 208: + case 209: result = reduceNode(node.expression, cbNode, result); break; - case 209: + case 210: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 210: + case 211: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 211: - case 218: + case 212: + case 219: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212: + case 213: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 213: case 214: + case 215: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 217: - case 221: + case 218: + case 222: result = reduceNode(node.expression, cbNode, result); break; - case 219: + case 220: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 220: + case 221: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 222: + case 223: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 224: + case 225: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 225: + case 226: result = reduceNodes(node.declarations, cbNodes, result); break; - case 226: + case 227: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38414,7 +38697,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 227: + case 228: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38422,96 +38705,96 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 233: + case 234: result = reduceNodes(node.clauses, cbNodes, result); break; - case 236: + case 237: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 237: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.namedBindings, cbNode, result); - break; case 238: result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); break; case 239: - case 243: - result = reduceNodes(node.elements, cbNodes, result); + result = reduceNode(node.name, cbNode, result); break; case 240: case 244: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 241: + case 245: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 241: + case 242: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 242: + case 243: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 247: + case 248: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 248: case 249: + case 250: result = reduceNode(node.tagName, cbNode, result); result = reduceNodes(node.attributes, cbNodes, result); break; - case 250: + case 251: result = reduceNode(node.tagName, cbNode, result); break; - case 251: + case 252: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 252: - result = reduceNode(node.expression, cbNode, result); - break; case 253: result = reduceNode(node.expression, cbNode, result); break; case 254: result = reduceNode(node.expression, cbNode, result); + break; case 255: + result = reduceNode(node.expression, cbNode, result); + case 256: result = reduceNodes(node.statements, cbNodes, result); break; - case 256: + case 257: result = reduceNodes(node.types, cbNodes, result); break; - case 257: + case 258: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; - case 258: + case 259: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 259: + case 260: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 260: + case 261: result = reduceNode(node.expression, cbNode, result); break; - case 262: + case 263: result = reduceNodes(node.statements, cbNodes, result); break; - case 295: + case 296: result = reduceNode(node.expression, cbNode, result); break; default: - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + var edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) { var edge = edgeTraversalPath_1[_i]; @@ -38641,183 +38924,183 @@ var ts; return undefined; } var kind = node.kind; - if ((kind > 0 && kind <= 140)) { + if ((kind > 0 && kind <= 141)) { return node; } - if ((kind >= 156 && kind <= 171)) { + if ((kind >= 157 && kind <= 172)) { return node; } switch (node.kind) { - case 204: - case 207: - case 198: - case 223: + case 205: + case 208: + case 199: + case 224: return node; - case 142: + case 143: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); - case 144: + case 145: return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 147: + case 148: return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 149: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 150: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); + return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 151: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); case 152: + return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + case 153: return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 172: - return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); case 173: - return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); + return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); case 174: - return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); + return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); case 175: - return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); + return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); case 176: - return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); + return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); case 177: - return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); case 178: - return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); + return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); case 179: - return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); case 180: - return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); case 181: + return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + case 182: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 183: - return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 184: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 185: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 186: - return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 187: - return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 188: - return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); case 189: + return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + case 190: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 192: + case 193: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); - case 190: - return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); case 191: + return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); + case 192: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 193: - return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); case 194: - return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); + return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); case 195: - return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); case 196: - return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); case 197: + return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + case 198: return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 199: + case 200: return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 203: + case 204: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 205: - return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); case 206: + return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); + case 207: return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 208: - return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 209: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 210: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); case 211: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); case 212: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 213: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 214: - return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 215: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 216: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 217: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 218: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); case 219: - return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 220: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); case 221: - return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 222: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + case 223: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true)); - case 224: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 225: - return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 226: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); case 227: + return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + case 228: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 233: + case 234: return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 236: - return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 237: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); + return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 238: - return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); case 239: - return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); case 240: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); case 241: - return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); case 242: - return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); + return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); case 243: - return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); case 244: + return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + case 245: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); - case 247: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 248: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 249: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 250: - return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 251: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); case 252: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 253: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 254: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 255: - return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); case 256: - return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); + return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); case 257: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); case 258: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); case 259: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 260: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 261: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); - case 262: + case 263: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 295: + case 296: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + var edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) { var edge = edgeTraversalPath_2[_i]; @@ -38901,7 +39184,7 @@ var ts; return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { - if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 199)) { + if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 200)) { return 0; } return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); @@ -38949,7 +39232,6 @@ var ts; } } })(Debug = ts.Debug || (ts.Debug = {})); - var _a; })(ts || (ts = {})); var ts; (function (ts) { @@ -39044,10 +39326,10 @@ var ts; } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { - var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_32 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; - var variable = ts.createVariableDeclaration(name_32, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location); variable.original = original; - if (ts.isIdentifier(name_32)) { + if (ts.isIdentifier(name)) { ts.setEmitFlags(variable, 64); } ts.aggregateTransformFlags(variable); @@ -39193,8 +39475,8 @@ var ts; return ts.createElementAccess(value, argumentExpression); } else { - var name_33 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); - return ts.createPropertyAccess(value, name_33); + var name = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name); } } function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { @@ -39271,8 +39553,8 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); context.enableSubstitution(178); + context.enableSubstitution(179); var currentSourceFile; var currentNamespace; var currentNamespaceContainerName; @@ -39305,15 +39587,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 262: + case 263: + case 234: case 233: - case 232: - case 205: + case 206: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; + case 228: case 227: - case 226: if (ts.hasModifier(node, 2)) { break; } @@ -39338,13 +39620,13 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 236: + case 237: return visitImportDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); - case 241: - return visitExportAssignment(node); case 242: + return visitExportAssignment(node); + case 243: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -39354,11 +39636,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 242 || - node.kind === 236 || + if (node.kind === 243 || node.kind === 237 || - (node.kind === 235 && - node.moduleReference.kind === 246)) { + node.kind === 238 || + (node.kind === 236 && + node.moduleReference.kind === 247)) { return undefined; } else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) { @@ -39374,15 +39656,15 @@ var ts; } function classElementVisitorWorker(node) { switch (node.kind) { - case 150: - return undefined; - case 147: - case 155: case 151: + return undefined; + case 148: + case 156: case 152: - case 149: + case 153: + case 150: return visitorWorker(node); - case 204: + case 205: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -39413,23 +39695,22 @@ var ts; case 75: case 123: case 130: - case 162: case 163: - case 161: - case 156: - case 143: + case 164: + case 162: + case 157: + case 144: case 118: case 121: - case 134: + case 135: case 132: case 129: case 104: - case 135: + case 136: + case 160: case 159: + case 161: case 158: - case 160: - case 157: - case 164: case 165: case 166: case 167: @@ -39437,57 +39718,58 @@ var ts; case 169: case 170: case 171: - case 155: - case 145: - case 229: - case 147: + case 172: + case 156: + case 146: + case 230: + case 148: return undefined; - case 150: + case 151: return visitConstructor(node); - case 228: + case 229: return ts.createNotEmittedStatement(node); - case 227: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 256: + case 257: return visitHeritageClause(node); - case 199: + case 200: return visitExpressionWithTypeArguments(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: - return visitGetAccessor(node); case 152: + return visitGetAccessor(node); + case 153: return visitSetAccessor(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: + case 145: return visitParameter(node); - case 183: + case 184: return visitParenthesizedExpression(node); - case 182: - case 200: + case 183: + case 201: return visitAssertionExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 201: + case 202: return visitNonNullExpression(node); - case 230: + case 231: return visitEnumDeclaration(node); - case 206: + case 207: return visitVariableStatement(node); - case 224: + case 225: return visitVariableDeclaration(node); - case 231: + case 232: return visitModuleDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); default: ts.Debug.failBadSyntaxKind(node); @@ -39641,7 +39923,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -39675,7 +39957,7 @@ var ts; return isInitializedProperty(member, false); } function isInitializedProperty(member, isStatic) { - return member.kind === 147 + return member.kind === 148 && isStatic === ts.hasModifier(member, 32) && member.initializer !== undefined; } @@ -39748,12 +40030,12 @@ var ts; } function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { - case 151: case 152: + case 153: return getAllDecoratorsOfAccessors(node, member); - case 149: + case 150: return getAllDecoratorsOfMethod(member); - case 147: + case 148: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -39832,7 +40114,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, true); var descriptor = languageVersion > 0 - ? member.kind === 147 + ? member.kind === 148 ? ts.createVoidZero() : ts.createNull() : undefined; @@ -39916,37 +40198,37 @@ var ts; } function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 149 - || kind === 151 + return kind === 150 || kind === 152 - || kind === 147; + || kind === 153 + || kind === 148; } function shouldAddReturnTypeMetadata(node) { - return node.kind === 149; + return node.kind === 150; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 227: - case 197: + case 228: + case 198: return ts.getFirstConstructorWithBody(node) !== undefined; - case 149: - case 151: + case 150: case 152: + case 153: return true; } return false; } function serializeTypeOfNode(node) { switch (node.kind) { - case 147: - case 144: - case 151: - return serializeTypeNode(node.type); + case 148: + case 145: case 152: + return serializeTypeNode(node.type); + case 153: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 227: - case 197: - case 149: + case 228: + case 198: + case 150: return ts.createIdentifier("Function"); default: return ts.createVoidZero(); @@ -39978,7 +40260,7 @@ var ts; return ts.createArrayLiteral(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 151) { + if (container && node.kind === 152) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -40001,24 +40283,24 @@ var ts; } switch (node.kind) { case 104: - case 137: + case 138: case 94: case 129: return ts.createVoidZero(); - case 166: + case 167: return serializeTypeNode(node.type); - case 158: case 159: + case 160: return ts.createIdentifier("Function"); - case 162: case 163: + case 164: return ts.createIdentifier("Array"); - case 156: + case 157: case 121: return ts.createIdentifier("Boolean"); - case 134: + case 135: return ts.createIdentifier("String"); - case 171: + case 172: switch (node.literal.kind) { case 9: return ts.createIdentifier("String"); @@ -40034,22 +40316,22 @@ var ts; break; case 132: return ts.createIdentifier("Number"); - case 135: + case 136: return languageVersion < 2 ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); - case 157: + case 158: return serializeTypeReferenceNode(node); + case 166: case 165: - case 164: return serializeUnionOrIntersectionType(node); - case 160: - case 168: + case 161: case 169: case 170: - case 161: + case 171: + case 162: case 118: - case 167: + case 168: break; default: ts.Debug.failBadSyntaxKind(node); @@ -40117,15 +40399,15 @@ var ts; function serializeEntityNameAsExpression(node, useFallback) { switch (node.kind) { case 70: - var name_34 = ts.getMutableClone(node); - name_34.flags &= ~8; - name_34.original = undefined; - name_34.parent = currentScope; + var name = ts.getMutableClone(node); + name.flags &= ~8; + name.original = undefined; + name.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_34), ts.createLiteral("undefined")), name_34); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name); } - return name_34; - case 141: + return name; + case 142: return serializeQualifiedNameAsExpression(node, useFallback); } } @@ -40388,16 +40670,16 @@ var ts; if (!currentScopeFirstDeclarationsOfName) { currentScopeFirstDeclarationsOfName = ts.createMap(); } - if (!(name in currentScopeFirstDeclarationsOfName)) { - currentScopeFirstDeclarationsOfName[name] = node; + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_35 = node.symbol && node.symbol.name; - if (name_35) { - return currentScopeFirstDeclarationsOfName[name_35] === node; + var name = node.symbol && node.symbol.name; + if (name) { + return currentScopeFirstDeclarationsOfName.get(name) === node; } } return false; @@ -40409,7 +40691,7 @@ var ts; ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 230) { + if (node.kind === 231) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -40469,7 +40751,7 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 232) { + if (body.kind === 233) { saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; @@ -40492,13 +40774,13 @@ var ts; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); - if (body.kind !== 232) { + if (body.kind !== 233) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 231) { + if (moduleDeclaration.body.kind === 232) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -40518,7 +40800,7 @@ var ts; return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 238) { + if (node.kind === 239) { return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } else { @@ -40646,22 +40928,22 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(70); - classAliases = ts.createMap(); + classAliases = []; } } function enableSubstitutionForNamespaceExports() { if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(70); - context.enableSubstitution(259); - context.enableEmitNotification(231); + context.enableSubstitution(260); + context.enableEmitNotification(232); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 231; + return ts.getOriginalNode(node).kind === 232; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 230; + return ts.getOriginalNode(node).kind === 231; } function onEmitNode(emitContext, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; @@ -40686,14 +40968,14 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2) { - var name_36 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_36); + var name = node.name; + var exportedName = trySubstituteNamespaceExportedName(name); if (exportedName) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_36, initializer, node); + return ts.createPropertyAssignment(name, initializer, node); } - return ts.createPropertyAssignment(name_36, exportedName, node); + return ts.createPropertyAssignment(name, exportedName, node); } } return node; @@ -40702,9 +40984,9 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 177: - return substitutePropertyAccessExpression(node); case 178: + return substitutePropertyAccessExpression(node); + case 179: return substituteElementAccessExpression(node); } return node; @@ -40734,9 +41016,9 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 262) { - var substitute = (applicableSubstitutions & 2 && container.kind === 231) || - (applicableSubstitutions & 8 && container.kind === 230); + if (container && container.kind !== 263) { + var substitute = (applicableSubstitutions & 2 && container.kind === 232) || + (applicableSubstitutions & 8 && container.kind === 231); if (substitute) { return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node); } @@ -40847,37 +41129,37 @@ var ts; return node; } switch (node.kind) { - case 176: + case 177: return visitObjectLiteralExpression(node); - case 192: + case 193: return visitBinaryExpression(node, noDestructuringValue); - case 224: + case 225: return visitVariableDeclaration(node); - case 214: + case 215: return visitForOfStatement(node); - case 212: + case 213: return visitForStatement(node); - case 188: + case 189: return visitVoidExpression(node); - case 150: + case 151: return visitConstructorDeclaration(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: - return visitGetAccessorDeclaration(node); case 152: + return visitGetAccessorDeclaration(node); + case 153: return visitSetAccessorDeclaration(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: + case 145: return visitParameter(node); - case 208: + case 209: return visitExpressionStatement(node); - case 183: + case 184: return visitParenthesizedExpression(node, noDestructuringValue); default: return ts.visitEachChild(node, visitor, context); @@ -40888,7 +41170,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 260) { + if (e.kind === 261) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -40900,7 +41182,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 258) { + if (e.kind === 259) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -40917,7 +41199,7 @@ var ts; function visitObjectLiteralExpression(node) { if (node.transformFlags & 1048576) { var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176) { + if (objects.length && objects[0].kind !== 177) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -41042,6 +41324,9 @@ var ts; text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" }; function createAssignHelper(context, attributesSegments) { + if (context.getCompilerOptions().target >= 2) { + return ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), undefined, attributesSegments); + } context.requestEmitHelper(assignHelper); return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments); } @@ -41073,11 +41358,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 247: - return visitJsxElement(node, false); case 248: + return visitJsxElement(node, false); + case 249: return visitJsxSelfClosingElement(node, false); - case 253: + case 254: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -41087,11 +41372,11 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 253: + case 254: return visitJsxExpression(node); - case 247: - return visitJsxElement(node, true); case 248: + return visitJsxElement(node, true); + case 249: return visitJsxSelfClosingElement(node, true); default: ts.Debug.failBadSyntaxKind(node); @@ -41145,7 +41430,7 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.createLiteral(decoded, node) : node; } - else if (node.kind === 253) { + else if (node.kind === 254) { if (node.expression === undefined) { return ts.createLiteral(true); } @@ -41156,43 +41441,35 @@ var ts; } } function visitJsxText(node) { - var text = ts.getTextOfNode(node, true); - var parts; + var fixed = fixupWhitespaceAndDecodeEntities(ts.getTextOfNode(node, true)); + return fixed === undefined ? undefined : ts.createLiteral(fixed); + } + function fixupWhitespaceAndDecodeEntities(text) { + var acc; var firstNonWhitespace = 0; var lastNonWhitespace = -1; for (var i = 0; i < text.length; i++) { var c = text.charCodeAt(i); if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); } firstNonWhitespace = -1; } - else if (!ts.isWhiteSpace(c)) { + else if (!ts.isWhiteSpaceSingleLine(c)) { lastNonWhitespace = i; if (firstNonWhitespace === -1) { firstNonWhitespace = i; } } } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); - } - if (parts) { - return ts.reduceLeft(parts, aggregateJsxTextParts); - } - return undefined; + return firstNonWhitespace !== -1 + ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) + : acc; } - function aggregateJsxTextParts(left, right) { - return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right); + function addLineOfJsxText(acc, trimmedLine) { + var decoded = decodeEntities(trimmedLine); + return acc === undefined ? decoded : acc + " " + decoded; } function decodeEntities(text) { return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) { @@ -41203,7 +41480,7 @@ var ts; return String.fromCharCode(parseInt(hex, 16)); } else { - var ch = entities[word]; + var ch = entities.get(word); return ch ? String.fromCharCode(ch) : match; } }); @@ -41213,16 +41490,16 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 247) { + if (node.kind === 248) { return getTagName(node.openingElement); } else { - var name_37 = node.tagName; - if (ts.isIdentifier(name_37) && ts.isIntrinsicJsxName(name_37.text)) { - return ts.createLiteral(name_37.text); + var name = node.tagName; + if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.text)) { + return ts.createLiteral(name.text); } else { - return ts.createExpressionFromEntityName(name_37); + return ts.createExpressionFromEntityName(name); } } } @@ -41240,7 +41517,7 @@ var ts; } } ts.transformJsx = transformJsx; - var entities = ts.createMap({ + var entities = ts.createMapFromTemplate({ "quot": 0x0022, "amp": 0x0026, "apos": 0x0027, @@ -41528,15 +41805,15 @@ var ts; switch (node.kind) { case 119: return undefined; - case 189: + case 190: return visitAwaitExpression(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); default: return ts.visitEachChild(node, visitor, context); @@ -41573,7 +41850,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 185; + var isArrowFunction = node.kind === 186; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; if (!isArrowFunction) { var statements = []; @@ -41628,23 +41905,23 @@ var ts; function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; - context.enableSubstitution(179); - context.enableSubstitution(177); + context.enableSubstitution(180); context.enableSubstitution(178); - context.enableEmitNotification(227); - context.enableEmitNotification(149); - context.enableEmitNotification(151); - context.enableEmitNotification(152); + context.enableSubstitution(179); + context.enableEmitNotification(228); context.enableEmitNotification(150); + context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(151); } } function substituteExpression(node) { switch (node.kind) { - case 177: - return substitutePropertyAccessExpression(node); case 178: - return substituteElementAccessExpression(node); + return substitutePropertyAccessExpression(node); case 179: + return substituteElementAccessExpression(node); + case 180: if (enabledSubstitutions & 1) { return substituteCallExpression(node); } @@ -41687,11 +41964,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 227 - || kind === 150 - || kind === 149 + return kind === 228 || kind === 151 - || kind === 152; + || kind === 150 + || kind === 152 + || kind === 153; } function onEmitNode(emitContext, node, emitCallback) { if (enabledSubstitutions & 1 && isSuperContainer(node)) { @@ -41769,7 +42046,7 @@ var ts; return node; } switch (node.kind) { - case 192: + case 193: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -41853,7 +42130,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return hierarchyFacts & 4096 - && node.kind === 217 + && node.kind === 218 && !node.expression; } function shouldVisitNode(node) { @@ -41886,91 +42163,91 @@ var ts; switch (node.kind) { case 114: return undefined; - case 227: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 144: + case 145: return visitParameter(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 185: + case 186: return visitArrowFunction(node); - case 184: + case 185: return visitFunctionExpression(node); - case 224: + case 225: return visitVariableDeclaration(node); case 70: return visitIdentifier(node); - case 225: + case 226: return visitVariableDeclarationList(node); - case 219: + case 220: return visitSwitchStatement(node); - case 233: + case 234: return visitCaseBlock(node); - case 205: + case 206: return visitBlock(node, false); + case 217: case 216: - case 215: return visitBreakOrContinueStatement(node); - case 220: + case 221: return visitLabeledStatement(node); - case 210: case 211: - return visitDoOrWhileStatement(node, undefined); case 212: - return visitForStatement(node, undefined); + return visitDoOrWhileStatement(node, undefined); case 213: - return visitForInStatement(node, undefined); + return visitForStatement(node, undefined); case 214: + return visitForInStatement(node, undefined); + case 215: return visitForOfStatement(node, undefined); - case 208: + case 209: return visitExpressionStatement(node); - case 176: + case 177: return visitObjectLiteralExpression(node); - case 257: + case 258: return visitCatchClause(node); - case 259: + case 260: return visitShorthandPropertyAssignment(node); - case 142: + case 143: return visitComputedPropertyName(node); - case 175: + case 176: return visitArrayLiteralExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 183: + case 184: return visitParenthesizedExpression(node, true); - case 192: + case 193: return visitBinaryExpression(node, true); case 12: case 13: case 14: case 15: return visitTemplateLiteral(node); - case 181: + case 182: return visitTaggedTemplateExpression(node); - case 194: - return visitTemplateExpression(node); case 195: - return visitYieldExpression(node); + return visitTemplateExpression(node); case 196: + return visitYieldExpression(node); + case 197: return visitSpreadElement(node); case 96: return visitSuperKeyword(false); case 98: return visitThisKeyword(node); - case 202: + case 203: return visitMetaProperty(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: case 152: + case 153: return visitAccessorDeclaration(node); - case 206: + case 207: return visitVariableStatement(node); - case 217: + case 218: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context); @@ -42040,20 +42317,20 @@ var ts; if (ts.isGeneratedIdentifier(node)) { return node; } - if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) { + if (node.text !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { return node; } return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 216 ? 2 : 4; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + var jump = node.kind === 217 ? 2 : 4; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 216) { + if (node.kind === 217) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -42063,7 +42340,7 @@ var ts; } } else { - if (node.kind === 216) { + if (node.kind === 217) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -42221,17 +42498,17 @@ var ts; return block; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 217) { + if (statement.kind === 218) { return true; } - else if (statement.kind === 209) { + else if (statement.kind === 210) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 205) { + else if (statement.kind === 206) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -42260,7 +42537,7 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 208 && ts.isSuperCall(firstStatement.expression)) { + if (firstStatement.kind === 209 && ts.isSuperCall(firstStatement.expression)) { superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } @@ -42268,8 +42545,8 @@ var ts; && statementOffset === ctorStatements.length - 1 && !(ctor.transformFlags & (16384 | 32768))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 192 - || superCallExpression.left.kind !== 179) { + if (superCallExpression.kind !== 193 + || superCallExpression.left.kind !== 180) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))); @@ -42311,15 +42588,15 @@ var ts; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - var name_38 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; if (dotDotDotToken) { continue; } - if (ts.isBindingPattern(name_38)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_38, initializer); + if (ts.isBindingPattern(name)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer); } else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_38, initializer); + addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer); } } } @@ -42369,7 +42646,7 @@ var ts; statements.push(forStatement); } function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 && node.kind !== 185) { + if (node.transformFlags & 32768 && node.kind !== 186) { captureThisForNode(statements, node, ts.createThis()); } } @@ -42386,18 +42663,18 @@ var ts; if (hierarchyFacts & 16384) { var newTarget = void 0; switch (node.kind) { - case 185: + case 186: return statements; - case 149: - case 151: + case 150: case 152: + case 153: newTarget = ts.createVoidZero(); break; - case 150: + case 151: newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); break; - case 226: - case 184: + case 227: + case 185: newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 92, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); break; default: @@ -42418,20 +42695,20 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 204: + case 205: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 149: + case 150: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 150: + case 151: break; default: ts.Debug.failBadSyntaxKind(node); @@ -42554,7 +42831,7 @@ var ts; : enterSubtree(16286, 65); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 16384 && !name && (node.kind === 226 || node.kind === 184)) { + if (hierarchyFacts & 16384 && !name && (node.kind === 227 || node.kind === 185)) { name = ts.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 49152, 0); @@ -42587,7 +42864,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 185); + ts.Debug.assert(node.kind === 186); statementsLocation = ts.moveRangeEnd(body, -1); var equalsGreaterThanToken = node.equalsGreaterThanToken; if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { @@ -42637,9 +42914,9 @@ var ts; } function visitExpressionStatement(node) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateStatement(node, visitBinaryExpression(node.expression, false)); } return ts.visitEachChild(node, visitor, context); @@ -42647,9 +42924,9 @@ var ts; function visitParenthesizedExpression(node, needsDestructuringValue) { if (!needsDestructuringValue) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateParen(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateParen(node, visitBinaryExpression(node.expression, false)); } } @@ -42756,10 +43033,10 @@ var ts; return updated; } function recordLabel(node) { - convertedLoopState.labels[node.label.text] = node.label.text; + convertedLoopState.labels.set(node.label.text, node.label.text); } function resetLabel(node) { - convertedLoopState.labels[node.label.text] = undefined; + convertedLoopState.labels.set(node.label.text, undefined); } function visitLabeledStatement(node) { if (convertedLoopState && !convertedLoopState.labels) { @@ -42833,7 +43110,7 @@ var ts; ts.addRange(statements, convertedLoopBodyStatements); } else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); bodyLocation = statement; @@ -42855,14 +43132,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 210: case 211: - return visitDoOrWhileStatement(node, outermostLabeledStatement); case 212: - return visitForStatement(node, outermostLabeledStatement); + return visitDoOrWhileStatement(node, outermostLabeledStatement); case 213: - return visitForInStatement(node, outermostLabeledStatement); + return visitForStatement(node, outermostLabeledStatement); case 214: + return visitForInStatement(node, outermostLabeledStatement); + case 215: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -42877,7 +43154,7 @@ var ts; && i < numInitialPropertiesWithoutYield) { numInitialPropertiesWithoutYield = i; } - if (property.name.kind === 142) { + if (property.name.kind === 143) { numInitialProperties = i; break; } @@ -42939,11 +43216,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 212: case 213: case 214: + case 215: var initializer = node.initializer; - if (initializer && initializer.kind === 225) { + if (initializer && initializer.kind === 226) { loopInitializer = initializer; } break; @@ -43117,23 +43394,22 @@ var ts; if (!state.labeledNonLocalBreaks) { state.labeledNonLocalBreaks = ts.createMap(); } - state.labeledNonLocalBreaks[labelText] = labelMarker; + state.labeledNonLocalBreaks.set(labelText, labelMarker); } else { if (!state.labeledNonLocalContinues) { state.labeledNonLocalContinues = ts.createMap(); } - state.labeledNonLocalContinues[labelText] = labelMarker; + state.labeledNonLocalContinues.set(labelText, labelMarker); } } function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { if (!table) { return; } - for (var labelText in table) { - var labelMarker = table[labelText]; + table.forEach(function (labelMarker, labelText) { var statements = []; - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) { var label = ts.createIdentifier(labelText); statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)); } @@ -43142,7 +43418,7 @@ var ts; statements.push(ts.createReturn(loopResultName)); } caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)); - } + }); } function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { var name = decl.name; @@ -43168,20 +43444,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 149: + case 150: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 258: + case 259: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 259: + case 260: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -43313,7 +43589,7 @@ var ts; })); if (segments.length === 1) { var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 + return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 176 ? ts.createArraySlice(segments[0]) : segments[0]; } @@ -43441,13 +43717,13 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(98); - context.enableEmitNotification(150); - context.enableEmitNotification(149); context.enableEmitNotification(151); + context.enableEmitNotification(150); context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(186); context.enableEmitNotification(185); - context.enableEmitNotification(184); - context.enableEmitNotification(226); + context.enableEmitNotification(227); } } function onSubstituteNode(emitContext, node) { @@ -43472,10 +43748,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 174: - case 227: - case 230: - case 224: + case 175: + case 228: + case 231: + case 225: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -43518,11 +43794,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 208) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 209) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 180) { return false; } var callTarget = statementExpression.expression; @@ -43530,7 +43806,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 197) { return false; } var expression = callArgument.expression; @@ -43554,13 +43830,15 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var instructionNames = ts.createMap((_a = {}, - _a[2] = "return", - _a[3] = "break", - _a[4] = "yield", - _a[5] = "yield*", - _a[7] = "endfinally", - _a)); + function getInstructionName(instruction) { + switch (instruction) { + case 2: return "return"; + case 3: return "break"; + case 4: return "yield"; + case 5: return "yield*"; + case 7: return "endfinally"; + } + } function transformGenerators(context) { var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); @@ -43626,13 +43904,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 210: - return visitDoStatement(node); case 211: + return visitDoStatement(node); + case 212: return visitWhileStatement(node); - case 219: - return visitSwitchStatement(node); case 220: + return visitSwitchStatement(node); + case 221: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -43640,24 +43918,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); - case 151: case 152: + case 153: return visitAccessorDeclaration(node); - case 206: + case 207: return visitVariableStatement(node); - case 212: - return visitForStatement(node); case 213: + return visitForStatement(node); + case 214: return visitForInStatement(node); - case 216: + case 217: return visitBreakStatement(node); - case 215: + case 216: return visitContinueStatement(node); - case 217: + case 218: return visitReturnStatement(node); default: if (node.transformFlags & 16777216) { @@ -43673,21 +43951,21 @@ var ts; } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 192: - return visitBinaryExpression(node); case 193: + return visitBinaryExpression(node); + case 194: return visitConditionalExpression(node); - case 195: + case 196: return visitYieldExpression(node); - case 175: - return visitArrayLiteralExpression(node); case 176: + return visitArrayLiteralExpression(node); + case 177: return visitObjectLiteralExpression(node); - case 178: - return visitElementAccessExpression(node); case 179: - return visitCallExpression(node); + return visitElementAccessExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -43695,9 +43973,9 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); default: ts.Debug.failBadSyntaxKind(node); @@ -43854,10 +44132,10 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 177: + case 178: target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 178: + case 179: target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); break; default: @@ -44053,35 +44331,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 205: + case 206: return transformAndEmitBlock(node); - case 208: - return transformAndEmitExpressionStatement(node); case 209: - return transformAndEmitIfStatement(node); + return transformAndEmitExpressionStatement(node); case 210: - return transformAndEmitDoStatement(node); + return transformAndEmitIfStatement(node); case 211: - return transformAndEmitWhileStatement(node); + return transformAndEmitDoStatement(node); case 212: - return transformAndEmitForStatement(node); + return transformAndEmitWhileStatement(node); case 213: + return transformAndEmitForStatement(node); + case 214: return transformAndEmitForInStatement(node); - case 215: - return transformAndEmitContinueStatement(node); case 216: - return transformAndEmitBreakStatement(node); + return transformAndEmitContinueStatement(node); case 217: - return transformAndEmitReturnStatement(node); + return transformAndEmitBreakStatement(node); case 218: - return transformAndEmitWithStatement(node); + return transformAndEmitReturnStatement(node); case 219: - return transformAndEmitSwitchStatement(node); + return transformAndEmitWithStatement(node); case 220: - return transformAndEmitLabeledStatement(node); + return transformAndEmitSwitchStatement(node); case 221: - return transformAndEmitThrowStatement(node); + return transformAndEmitLabeledStatement(node); case 222: + return transformAndEmitThrowStatement(node); + case 223: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true)); @@ -44101,9 +44379,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - var name_39 = ts.getSynthesizedClone(variable.name); - ts.setCommentRange(name_39, variable.name); - hoistVariableDeclaration(name_39); + var name = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -44367,7 +44645,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 255 && defaultClauseIndex === -1) { + if (clause.kind === 256 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -44377,7 +44655,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 254) { + if (clause.kind === 255) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -44493,14 +44771,14 @@ var ts; return node; } function substituteExpressionIdentifier(node) { - if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) { + if (renamedCatchVariables && renamedCatchVariables.has(node.text)) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_40 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_40) { - var clone_7 = ts.getMutableClone(name_40); + var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)]; + if (name) { + var clone_7 = ts.getMutableClone(name); ts.setSourceMapRange(clone_7, node); ts.setCommentRange(clone_7, node); return clone_7; @@ -44608,10 +44886,10 @@ var ts; var name = declareLocal(text); if (!renamedCatchVariables) { renamedCatchVariables = ts.createMap(); - renamedCatchVariableDeclarations = ts.createMap(); + renamedCatchVariableDeclarations = []; context.enableSubstitution(70); } - renamedCatchVariables[text] = true; + renamedCatchVariables.set(text, true); renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; var exception = peekBlock(); ts.Debug.assert(exception.state < 1); @@ -44812,7 +45090,7 @@ var ts; } function createInstruction(instruction) { var literal = ts.createLiteral(instruction); - literal.trailingComment = instructionNames[instruction]; + literal.trailingComment = getInstructionName(instruction); return literal; } function createInlineBreak(label, location) { @@ -45167,7 +45445,6 @@ var ts; priority: 6, text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; - var _a; })(ts || (ts = {})); var ts; (function (ts) { @@ -45175,27 +45452,27 @@ var ts; var compilerOptions = context.getCompilerOptions(); var previousOnEmitNode; var noSubstitution; - if (compilerOptions.jsx === 1) { + if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(249); context.enableEmitNotification(250); - context.enableEmitNotification(248); + context.enableEmitNotification(251); + context.enableEmitNotification(249); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); - context.enableSubstitution(258); + context.enableSubstitution(178); + context.enableSubstitution(259); return transformSourceFile; function transformSourceFile(node) { return node; } function onEmitNode(emitContext, node, emitCallback) { switch (node.kind) { - case 249: case 250: - case 248: + case 251: + case 249: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -45242,12 +45519,13 @@ var ts; var ts; (function (ts) { function transformModule(context) { - var transformModuleDelegates = ts.createMap((_a = {}, - _a[ts.ModuleKind.None] = transformCommonJSModule, - _a[ts.ModuleKind.CommonJS] = transformCommonJSModule, - _a[ts.ModuleKind.AMD] = transformAMDModule, - _a[ts.ModuleKind.UMD] = transformUMDModule, - _a)); + function getTransformModuleDelegate(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.AMD: return transformAMDModule; + case ts.ModuleKind.UMD: return transformUMDModule; + default: return transformCommonJSModule; + } + } var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); @@ -45259,13 +45537,13 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableSubstitution(259); - context.enableEmitNotification(262); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); + context.enableSubstitution(192); + context.enableSubstitution(260); + context.enableEmitNotification(263); + var moduleInfoMap = []; + var deferredExports = []; var currentSourceFile; var currentModuleInfo; var noSubstitution; @@ -45277,8 +45555,9 @@ var ts; return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; + currentModuleInfo = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; + var transformModule = getTransformModuleDelegate(moduleKind); var updated = transformModule(node); currentSourceFile = undefined; currentModuleInfo = undefined; @@ -45404,23 +45683,23 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 236: + case 237: return visitImportDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); - case 242: + case 243: return visitExportDeclaration(node); - case 241: + case 242: return visitExportAssignment(node); - case 206: + case 207: return visitVariableStatement(node); - case 226: - return visitFunctionDeclaration(node); case 227: + return visitFunctionDeclaration(node); + case 228: return visitClassDeclaration(node); - case 296: - return visitMergeDeclarationMarker(node); case 297: + return visitMergeDeclarationMarker(node); + case 298: return visitEndOfDeclarationMarker(node); default: return node; @@ -45618,7 +45897,7 @@ var ts; } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -45650,10 +45929,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 238: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 239: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -45711,7 +45990,7 @@ var ts; } function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl); - var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; @@ -45723,7 +46002,7 @@ var ts; function appendExportStatement(statements, exportName, expression, location, allowComments) { if (exportName.text === "default") { var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile); - if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { + if (sourceFile && !sourceFile.symbol.exports.get("___esModule")) { if (languageVersion === 0) { statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true)))); } @@ -45761,10 +46040,10 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 262) { + if (node.kind === 263) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; - noSubstitution = ts.createMap(); + noSubstitution = []; previousOnEmitNode(emitContext, node, emitCallback); currentSourceFile = undefined; currentModuleInfo = undefined; @@ -45803,10 +46082,10 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); + case 192: case 191: - case 190: return substituteUnaryExpression(node); } return node; @@ -45821,7 +46100,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 262) { + if (exportContainer && exportContainer.kind === 263) { return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -45830,8 +46109,8 @@ var ts; return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_41 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_41), node); + var name = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name), node); } } } @@ -45864,7 +46143,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 + var expression = node.kind === 192 ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 ? 58 : 59), ts.createLiteral(1), node) : node; for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { @@ -45887,7 +46166,6 @@ var ts; } } } - var _a; } ts.transformModule = transformModule; var exportStarHelper = { @@ -45908,14 +46186,14 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableEmitNotification(262); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); - var exportFunctionsMap = ts.createMap(); - var noSubstitutionMap = ts.createMap(); + context.enableSubstitution(192); + context.enableEmitNotification(263); + var moduleInfoMap = []; + var deferredExports = []; + var exportFunctionsMap = []; + var noSubstitutionMap = []; var currentSourceFile; var moduleInfo; var exportFunction; @@ -45934,7 +46212,8 @@ var ts; currentSourceFile = node; enclosingBlockScopedContainer = node; moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); + exportFunction = ts.createUniqueName("exports"); + exportFunctionsMap[id] = exportFunction; contextObject = ts.createUniqueName("context"); var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); @@ -45971,12 +46250,12 @@ var ts; var externalImport = externalImports[i]; var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); var text = externalModuleName.text; - if (ts.hasProperty(groupIndices, text)) { - var groupIndex = groupIndices[text]; + var groupIndex = groupIndices.get(text); + if (groupIndex !== undefined) { dependencyGroups[groupIndex].externalImports.push(externalImport); } else { - groupIndices[text] = dependencyGroups.length; + groupIndices.set(text, dependencyGroups.length); dependencyGroups.push({ name: externalModuleName, externalImports: [externalImport] @@ -46007,11 +46286,11 @@ var ts; if (!moduleInfo.hasExportStarsToExportValues) { return; } - if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) { + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 242 && externalImport.exportClause) { + if (externalImport.kind === 243 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -46034,7 +46313,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 242) { + if (externalImport.kind !== 243) { continue; } var exportDecl = externalImport; @@ -46086,15 +46365,15 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 236: + case 237: if (!entry.importClause) { break; } - case 235: + case 236: ts.Debug.assert(importVariableName !== undefined); statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 242: + case 243: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { var properties = []; @@ -46116,13 +46395,13 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 236: + case 237: return visitImportDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); - case 242: + case 243: return undefined; - case 241: + case 242: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -46243,7 +46522,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 1048576) === 0 - && (enclosingBlockScopedContainer.kind === 262 + && (enclosingBlockScopedContainer.kind === 263 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -46265,7 +46544,7 @@ var ts; : preventSubstitution(ts.createAssignment(name, value, location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -46298,10 +46577,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 238: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 239: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -46371,7 +46650,7 @@ var ts; return statements; } var name = ts.getDeclarationName(decl); - var exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; @@ -46400,43 +46679,43 @@ var ts; } function nestedElementVisitor(node) { switch (node.kind) { - case 206: + case 207: return visitVariableStatement(node); - case 226: - return visitFunctionDeclaration(node); case 227: + return visitFunctionDeclaration(node); + case 228: return visitClassDeclaration(node); - case 212: - return visitForStatement(node); case 213: - return visitForInStatement(node); + return visitForStatement(node); case 214: + return visitForInStatement(node); + case 215: return visitForOfStatement(node); - case 210: - return visitDoStatement(node); case 211: + return visitDoStatement(node); + case 212: return visitWhileStatement(node); - case 220: + case 221: return visitLabeledStatement(node); - case 218: - return visitWithStatement(node); case 219: + return visitWithStatement(node); + case 220: return visitSwitchStatement(node); - case 233: + case 234: return visitCaseBlock(node); - case 254: - return visitCaseClause(node); case 255: + return visitCaseClause(node); + case 256: return visitDefaultClause(node); - case 222: + case 223: return visitTryStatement(node); - case 257: + case 258: return visitCatchClause(node); - case 205: + case 206: return visitBlock(node); - case 296: - return visitMergeDeclarationMarker(node); case 297: + return visitMergeDeclarationMarker(node); + case 298: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -46527,7 +46806,7 @@ var ts; } function destructuringVisitor(node) { if (node.transformFlags & 1024 - && node.kind === 192) { + && node.kind === 193) { return visitDestructuringAssignment(node); } else if (node.transformFlags & 2048) { @@ -46564,7 +46843,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 262; + return container !== undefined && container.kind === 263; } else { return false; @@ -46579,7 +46858,7 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 262) { + if (node.kind === 263) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -46612,10 +46891,10 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); - case 190: case 191: + case 192: return substituteUnaryExpression(node); } return node; @@ -46667,14 +46946,14 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 + var expression = node.kind === 192 ? ts.createPrefix(node.operator, node.operand, node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 191) { + if (node.kind === 192) { expression = node.operator === 42 ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -46691,7 +46970,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 262) { + if (exportContainer && exportContainer.kind === 263) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -46701,7 +46980,7 @@ var ts; } function preventSubstitution(node) { if (noSubstitution === undefined) - noSubstitution = ts.createMap(); + noSubstitution = []; noSubstitution[ts.getNodeId(node)] = true; return node; } @@ -46719,7 +46998,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(262); + context.enableEmitNotification(263); context.enableSubstitution(70); var currentSourceFile; return transformSourceFile; @@ -46744,9 +47023,9 @@ var ts; } function visitor(node) { switch (node.kind) { - case 235: + case 236: return undefined; - case 241: + case 242: return visitExportAssignment(node); } return node; @@ -46785,14 +47064,16 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var moduleTransformerMap = ts.createMap((_a = {}, - _a[ts.ModuleKind.ES2015] = ts.transformES2015Module, - _a[ts.ModuleKind.System] = ts.transformSystemModule, - _a[ts.ModuleKind.AMD] = ts.transformModule, - _a[ts.ModuleKind.CommonJS] = ts.transformModule, - _a[ts.ModuleKind.UMD] = ts.transformModule, - _a[ts.ModuleKind.None] = ts.transformModule, - _a)); + function getModuleTransformer(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.ES2015: + return ts.transformES2015Module; + case ts.ModuleKind.System: + return ts.transformSystemModule; + default: + return ts.transformModule; + } + } function getTransformers(compilerOptions) { var jsx = compilerOptions.jsx; var languageVersion = ts.getEmitScriptTarget(compilerOptions); @@ -46815,7 +47096,7 @@ var ts; transformers.push(ts.transformES2015); transformers.push(ts.transformGenerators); } - transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]); + transformers.push(getModuleTransformer(moduleKind)); if (languageVersion < 1) { transformers.push(ts.transformES5); } @@ -46823,7 +47104,7 @@ var ts; } ts.getTransformers = getTransformers; function transformFiles(resolver, host, sourceFiles, transformers) { - var enabledSyntaxKindFeatures = new Array(298); + var enabledSyntaxKindFeatures = new Array(299); var lexicalEnvironmentDisabled = false; var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; @@ -46979,13 +47260,12 @@ var ts; } } ts.transformFiles = transformFiles; - var _a; })(ts || (ts = {})); var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); - ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + ts.forEachEmittedFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { var declarationFilePath = _a.declarationFilePath; @@ -47055,7 +47335,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 236); + ts.Debug.assert(aliasEmitInfo.node.kind === 237); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -47078,9 +47358,9 @@ var ts; } }); if (usedTypeDirectiveReferences) { - for (var directive in usedTypeDirectiveReferences) { + ts.forEachKey(usedTypeDirectiveReferences, function (directive) { referencesOutput += "/// " + newLine; - } + }); } return { reportedDeclarationError: reportedDeclarationError, @@ -47127,10 +47407,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 224) { + if (declaration.kind === 225) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 239 || declaration.kind === 240 || declaration.kind === 237) { + else if (declaration.kind === 240 || declaration.kind === 241 || declaration.kind === 238) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -47141,7 +47421,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 236) { + if (moduleElementEmitInfo.node.kind === 237) { moduleElementEmitInfo.isVisible = true; } else { @@ -47149,12 +47429,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 231) { + if (nodeToCheck.kind === 232) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 231) { + if (nodeToCheck.kind === 232) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -47173,8 +47453,8 @@ var ts; } for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { var directive = typeReferenceDirectives_1[_i]; - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + if (!usedTypeDirectiveReferences.has(directive)) { + usedTypeDirectiveReferences.set(directive, directive); } } } @@ -47267,49 +47547,50 @@ var ts; function emitType(type) { switch (type.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 133: + case 136: case 104: - case 137: + case 138: case 94: case 129: - case 167: - case 171: + case 168: + case 172: return writeTextOfNode(currentText, type); - case 199: + case 200: return emitExpressionWithTypeArguments(type); - case 157: + case 158: return emitTypeReference(type); - case 160: + case 161: return emitTypeQuery(type); - case 162: - return emitArrayType(type); case 163: - return emitTupleType(type); + return emitArrayType(type); case 164: - return emitUnionType(type); + return emitTupleType(type); case 165: - return emitIntersectionType(type); + return emitUnionType(type); case 166: + return emitIntersectionType(type); + case 167: return emitParenType(type); - case 168: - return emitTypeOperator(type); case 169: - return emitIndexedAccessType(type); + return emitTypeOperator(type); case 170: + return emitIndexedAccessType(type); + case 171: return emitMappedType(type); - case 158: case 159: + case 160: return emitSignatureDeclarationWithJsDocComments(type); - case 161: + case 162: return emitTypeLiteral(type); case 70: return emitEntityName(type); - case 141: + case 142: return emitEntityName(type); - case 156: + case 157: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -47317,22 +47598,22 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 141 ? entityName.left : entityName.expression; - var right = entityName.kind === 141 ? entityName.right : entityName.name; + var left = entityName.kind === 142 ? entityName.left : entityName.expression; + var right = entityName.kind === 142 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 235 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 236 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isEntityNameExpression(node.expression)) { - ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 177); + ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 178); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -47436,15 +47717,15 @@ var ts; } function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!(baseName in currentIdentifiers)) { + if (!currentIdentifiers.has(baseName)) { return baseName; } var count = 0; while (true) { count++; - var name_42 = baseName + "_" + count; - if (!(name_42 in currentIdentifiers)) { - return name_42; + var name = baseName + "_" + count; + if (!currentIdentifiers.has(name)) { + return name; } } } @@ -47488,10 +47769,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 235 || - (node.parent.kind === 262 && isCurrentFileExternalModule)) { + else if (node.kind === 236 || + (node.parent.kind === 263 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 262) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 263) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -47500,7 +47781,7 @@ var ts; }); } else { - if (node.kind === 236) { + if (node.kind === 237) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -47518,30 +47799,30 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 226: + case 227: return writeFunctionDeclaration(node); - case 206: + case 207: return writeVariableStatement(node); - case 228: + case 229: return writeInterfaceDeclaration(node); - case 227: + case 228: return writeClassDeclaration(node); - case 229: - return writeTypeAliasDeclaration(node); case 230: - return writeEnumDeclaration(node); + return writeTypeAliasDeclaration(node); case 231: + return writeEnumDeclaration(node); + case 232: return writeModuleDeclaration(node); - case 235: - return writeImportEqualsDeclaration(node); case 236: + return writeImportEqualsDeclaration(node); + case 237: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 262) { + if (node.parent.kind === 263) { var modifiers = ts.getModifierFlags(node); if (modifiers & 1) { write("export "); @@ -47549,7 +47830,7 @@ var ts; if (modifiers & 512) { write("default "); } - else if (node.kind !== 228 && !noDeclare) { + else if (node.kind !== 229 && !noDeclare) { write("declare "); } } @@ -47599,7 +47880,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 238) { + if (namedBindings.kind === 239) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -47622,7 +47903,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 238) { + if (node.importClause.namedBindings.kind === 239) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -47639,13 +47920,13 @@ var ts; writer.writeLine(); } function emitExternalModuleSpecifier(parent) { - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 231; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 232; var moduleSpecifier; - if (parent.kind === 235) { + if (parent.kind === 236) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 231) { + else if (parent.kind === 232) { moduleSpecifier = parent.name; } else { @@ -47713,7 +47994,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 232) { + while (node.body && node.body.kind !== 233) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -47783,7 +48064,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 149 && ts.hasModifier(node.parent, 8); + return node.parent.kind === 150 && ts.hasModifier(node.parent, 8); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -47793,15 +48074,15 @@ var ts; writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - (node.parent.parent && node.parent.parent.kind === 161)) { - ts.Debug.assert(node.parent.kind === 149 || - node.parent.kind === 148 || - node.parent.kind === 158 || + if (node.parent.kind === 159 || + node.parent.kind === 160 || + (node.parent.parent && node.parent.parent.kind === 162)) { + ts.Debug.assert(node.parent.kind === 150 || + node.parent.kind === 149 || node.parent.kind === 159 || - node.parent.kind === 153 || - node.parent.kind === 154); + node.parent.kind === 160 || + node.parent.kind === 154 || + node.parent.kind === 155); emitType(node.constraint); } else { @@ -47811,34 +48092,34 @@ var ts; function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 227: + case 228: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 228: + case 229: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 154: + case 155: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 153: + case 154: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { 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 === 227) { + else if (node.parent.parent.kind === 228) { 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 226: + case 227: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 229: + case 230: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -47875,7 +48156,7 @@ var ts; } function getHeritageClauseVisibilityError() { var diagnosticMessage; - if (node.parent.parent.kind === 227) { + if (node.parent.parent.kind === 228) { 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; @@ -47958,17 +48239,17 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 224 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 225 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentText, node.name); - if ((node.kind === 147 || node.kind === 146 || - (node.kind === 144 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { + if ((node.kind === 148 || node.kind === 147 || + (node.kind === 145 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 147 || node.kind === 146) && node.parent.kind === 161) { + if ((node.kind === 148 || node.kind === 147) && node.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (resolver.isLiteralConstDeclaration(node)) { @@ -47981,14 +48262,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 224) { + if (node.kind === 225) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 === 147 || node.kind === 146) { + else if (node.kind === 148 || node.kind === 147) { if (ts.hasModifier(node, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -47996,7 +48277,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 === 227) { + else if (node.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -48022,7 +48303,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198) { + if (element.kind !== 199) { elements.push(element); } } @@ -48088,7 +48369,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 151 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 152 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -48101,7 +48382,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 151 + return accessor.kind === 152 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -48110,7 +48391,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 152) { + if (accessorWithTypeAnnotation.kind === 153) { if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : @@ -48156,17 +48437,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 226) { + if (node.kind === 227) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 149 || node.kind === 150) { + else if (node.kind === 150 || node.kind === 151) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 226) { + if (node.kind === 227) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 150) { + else if (node.kind === 151) { write("constructor"); } else { @@ -48186,15 +48467,15 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; var closeParenthesizedFunctionType = false; - if (node.kind === 155) { + if (node.kind === 156) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); write("["); } else { - if (node.kind === 154 || node.kind === 159) { + if (node.kind === 155 || node.kind === 160) { write("new "); } - else if (node.kind === 158) { + else if (node.kind === 159) { var currentOutput = writer.getText(); if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { closeParenthesizedFunctionType = true; @@ -48205,20 +48486,20 @@ var ts; write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 155) { + if (node.kind === 156) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 158 || node.kind === 159; - if (isFunctionTypeOrConstructorType || node.parent.kind === 161) { + var isFunctionTypeOrConstructorType = node.kind === 159 || node.kind === 160; + if (isFunctionTypeOrConstructorType || node.parent.kind === 162) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 150 && !ts.hasModifier(node, 8)) { + else if (node.kind !== 151 && !ts.hasModifier(node, 8)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -48232,23 +48513,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 154: + case 155: diagnosticMessage = symbolAccessibilityResult.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 153: + case 154: diagnosticMessage = symbolAccessibilityResult.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 155: + case 156: diagnosticMessage = symbolAccessibilityResult.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 150: case 149: - case 148: if (ts.hasModifier(node, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -48256,7 +48537,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 === 227) { + else if (node.parent.kind === 228) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -48269,7 +48550,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 226: + case 227: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -48301,9 +48582,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - node.parent.parent.kind === 161) { + if (node.parent.kind === 159 || + node.parent.kind === 160 || + node.parent.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!ts.hasModifier(node.parent, 8)) { @@ -48319,26 +48600,26 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 150: + case 151: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 154: + case 155: return symbolAccessibilityResult.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 153: + case 154: return symbolAccessibilityResult.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 155: + case 156: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -48346,7 +48627,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 === 227) { + else if (node.parent.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -48358,7 +48639,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 226: + case 227: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -48369,12 +48650,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -48385,10 +48666,10 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 198) { + if (bindingElement.kind === 199) { write(" "); } - else if (bindingElement.kind === 174) { + else if (bindingElement.kind === 175) { if (bindingElement.propertyName) { writeTextOfNode(currentText, bindingElement.propertyName); write(": "); @@ -48410,39 +48691,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 226: - case 231: - case 235: - case 228: case 227: + case 232: + case 236: case 229: + case 228: case 230: + case 231: return emitModuleElement(node, isModuleElementVisible(node)); - case 206: + case 207: return emitModuleElement(node, isVariableStatementVisible(node)); - case 236: + case 237: return emitModuleElement(node, !node.importClause); - case 242: + case 243: return emitExportDeclaration(node); + case 151: case 150: case 149: - case 148: return writeFunctionDeclaration(node); - case 154: - case 153: case 155: + case 154: + case 156: return emitSignatureDeclarationWithJsDocComments(node); - case 151: case 152: + case 153: return emitAccessorDeclaration(node); + case 148: case 147: - case 146: return emitPropertyDeclaration(node); - case 261: + case 262: return emitEnumMemberDeclaration(node); - case 241: + case 242: return emitExportAssignment(node); - case 262: + case 263: return emitSourceFile(node); } } @@ -48453,7 +48734,7 @@ var ts; declFileName = referencedFile.fileName; } else { - ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); @@ -48659,7 +48940,7 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 294 + if (node.kind !== 295 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); @@ -48672,7 +48953,7 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 294 + if (node.kind !== 295 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -48816,7 +49097,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 294; + var isEmittedNode = node.kind !== 295; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { @@ -48830,7 +49111,7 @@ var ts; } if (!skipTrailingComments) { containerEnd = end; - if (node.kind === 225) { + if (node.kind === 226) { declarationListContainerEnd = end; } } @@ -49067,10 +49348,10 @@ var ts; var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification; ts.performance.measure("transformTime", "beforeTransform"); ts.performance.mark("beforePrint"); - ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, emitFile, transformed, emitOnlyDtsFiles); ts.performance.measure("printTime", "beforePrint"); - for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) { - var sourceFile = sourceFiles_4[_b]; + for (var _b = 0, sourceFiles_3 = sourceFiles; _b < sourceFiles_3.length; _b++) { + var sourceFile = sourceFiles_3[_b]; ts.disposeEmitNodes(sourceFile); } return { @@ -49079,7 +49360,8 @@ var ts; emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; - function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) { + function emitFile(_a, sourceFiles, isBundledEmit) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { if (!emitOnlyDtsFiles) { printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); @@ -49111,8 +49393,8 @@ var ts; bundledHelpers = isBundledEmit ? ts.createMap() : undefined; isOwnFileEmit = !isBundledEmit; if (isBundledEmit && moduleKind) { - for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { - var sourceFile = sourceFiles_5[_a]; + for (var _a = 0, sourceFiles_4 = sourceFiles; _a < sourceFiles_4.length; _a++) { + var sourceFile = sourceFiles_4[_a]; emitHelpers(sourceFile, true); } } @@ -49186,7 +49468,7 @@ var ts; function pipelineEmitInSourceFileContext(node) { var kind = node.kind; switch (kind) { - case 262: + case 263: return emitSourceFile(node); } } @@ -49230,7 +49512,6 @@ var ts; case 130: case 131: case 132: - case 133: case 134: case 135: case 136: @@ -49238,190 +49519,191 @@ var ts; case 138: case 139: case 140: + case 141: writeTokenText(kind); return; - case 141: - return emitQualifiedName(node); case 142: - return emitComputedPropertyName(node); + return emitQualifiedName(node); case 143: - return emitTypeParameter(node); + return emitComputedPropertyName(node); case 144: - return emitParameter(node); + return emitTypeParameter(node); case 145: - return emitDecorator(node); + return emitParameter(node); case 146: - return emitPropertySignature(node); + return emitDecorator(node); case 147: - return emitPropertyDeclaration(node); + return emitPropertySignature(node); case 148: - return emitMethodSignature(node); + return emitPropertyDeclaration(node); case 149: - return emitMethodDeclaration(node); + return emitMethodSignature(node); case 150: - return emitConstructor(node); + return emitMethodDeclaration(node); case 151: + return emitConstructor(node); case 152: - return emitAccessorDeclaration(node); case 153: - return emitCallSignature(node); + return emitAccessorDeclaration(node); case 154: - return emitConstructSignature(node); + return emitCallSignature(node); case 155: - return emitIndexSignature(node); + return emitConstructSignature(node); case 156: - return emitTypePredicate(node); + return emitIndexSignature(node); case 157: - return emitTypeReference(node); + return emitTypePredicate(node); case 158: - return emitFunctionType(node); + return emitTypeReference(node); case 159: - return emitConstructorType(node); + return emitFunctionType(node); case 160: - return emitTypeQuery(node); + return emitConstructorType(node); case 161: - return emitTypeLiteral(node); + return emitTypeQuery(node); case 162: - return emitArrayType(node); + return emitTypeLiteral(node); case 163: - return emitTupleType(node); + return emitArrayType(node); case 164: - return emitUnionType(node); + return emitTupleType(node); case 165: - return emitIntersectionType(node); + return emitUnionType(node); case 166: + return emitIntersectionType(node); + case 167: return emitParenthesizedType(node); - case 199: + case 200: return emitExpressionWithTypeArguments(node); - case 167: - return emitThisType(); case 168: - return emitTypeOperator(node); + return emitThisType(); case 169: - return emitIndexedAccessType(node); + return emitTypeOperator(node); case 170: - return emitMappedType(node); + return emitIndexedAccessType(node); case 171: - return emitLiteralType(node); + return emitMappedType(node); case 172: - return emitObjectBindingPattern(node); + return emitLiteralType(node); case 173: - return emitArrayBindingPattern(node); + return emitObjectBindingPattern(node); case 174: + return emitArrayBindingPattern(node); + case 175: return emitBindingElement(node); - case 203: - return emitTemplateSpan(node); case 204: - return emitSemicolonClassElement(); + return emitTemplateSpan(node); case 205: - return emitBlock(node); + return emitSemicolonClassElement(); case 206: - return emitVariableStatement(node); + return emitBlock(node); case 207: - return emitEmptyStatement(); + return emitVariableStatement(node); case 208: - return emitExpressionStatement(node); + return emitEmptyStatement(); case 209: - return emitIfStatement(node); + return emitExpressionStatement(node); case 210: - return emitDoStatement(node); + return emitIfStatement(node); case 211: - return emitWhileStatement(node); + return emitDoStatement(node); case 212: - return emitForStatement(node); + return emitWhileStatement(node); case 213: - return emitForInStatement(node); + return emitForStatement(node); case 214: - return emitForOfStatement(node); + return emitForInStatement(node); case 215: - return emitContinueStatement(node); + return emitForOfStatement(node); case 216: - return emitBreakStatement(node); + return emitContinueStatement(node); case 217: - return emitReturnStatement(node); + return emitBreakStatement(node); case 218: - return emitWithStatement(node); + return emitReturnStatement(node); case 219: - return emitSwitchStatement(node); + return emitWithStatement(node); case 220: - return emitLabeledStatement(node); + return emitSwitchStatement(node); case 221: - return emitThrowStatement(node); + return emitLabeledStatement(node); case 222: - return emitTryStatement(node); + return emitThrowStatement(node); case 223: - return emitDebuggerStatement(node); + return emitTryStatement(node); case 224: - return emitVariableDeclaration(node); + return emitDebuggerStatement(node); case 225: - return emitVariableDeclarationList(node); + return emitVariableDeclaration(node); case 226: - return emitFunctionDeclaration(node); + return emitVariableDeclarationList(node); case 227: - return emitClassDeclaration(node); + return emitFunctionDeclaration(node); case 228: - return emitInterfaceDeclaration(node); + return emitClassDeclaration(node); case 229: - return emitTypeAliasDeclaration(node); + return emitInterfaceDeclaration(node); case 230: - return emitEnumDeclaration(node); + return emitTypeAliasDeclaration(node); case 231: - return emitModuleDeclaration(node); + return emitEnumDeclaration(node); case 232: - return emitModuleBlock(node); + return emitModuleDeclaration(node); case 233: + return emitModuleBlock(node); + case 234: return emitCaseBlock(node); - case 235: - return emitImportEqualsDeclaration(node); case 236: - return emitImportDeclaration(node); + return emitImportEqualsDeclaration(node); case 237: - return emitImportClause(node); + return emitImportDeclaration(node); case 238: - return emitNamespaceImport(node); + return emitImportClause(node); case 239: - return emitNamedImports(node); + return emitNamespaceImport(node); case 240: - return emitImportSpecifier(node); + return emitNamedImports(node); case 241: - return emitExportAssignment(node); + return emitImportSpecifier(node); case 242: - return emitExportDeclaration(node); + return emitExportAssignment(node); case 243: - return emitNamedExports(node); + return emitExportDeclaration(node); case 244: - return emitExportSpecifier(node); + return emitNamedExports(node); case 245: - return; + return emitExportSpecifier(node); case 246: + return; + case 247: return emitExternalModuleReference(node); case 10: return emitJsxText(node); - case 249: - return emitJsxOpeningElement(node); case 250: - return emitJsxClosingElement(node); + return emitJsxOpeningElement(node); case 251: - return emitJsxAttribute(node); + return emitJsxClosingElement(node); case 252: - return emitJsxSpreadAttribute(node); + return emitJsxAttribute(node); case 253: - return emitJsxExpression(node); + return emitJsxSpreadAttribute(node); case 254: - return emitCaseClause(node); + return emitJsxExpression(node); case 255: - return emitDefaultClause(node); + return emitCaseClause(node); case 256: - return emitHeritageClause(node); + return emitDefaultClause(node); case 257: - return emitCatchClause(node); + return emitHeritageClause(node); case 258: - return emitPropertyAssignment(node); + return emitCatchClause(node); case 259: - return emitShorthandPropertyAssignment(node); + return emitPropertyAssignment(node); case 260: - return emitSpreadAssignment(node); + return emitShorthandPropertyAssignment(node); case 261: + return emitSpreadAssignment(node); + case 262: return emitEnumMember(node); } if (ts.isExpression(node)) { @@ -49446,65 +49728,65 @@ var ts; case 98: writeTokenText(kind); return; - case 175: - return emitArrayLiteralExpression(node); case 176: - return emitObjectLiteralExpression(node); + return emitArrayLiteralExpression(node); case 177: - return emitPropertyAccessExpression(node); + return emitObjectLiteralExpression(node); case 178: - return emitElementAccessExpression(node); + return emitPropertyAccessExpression(node); case 179: - return emitCallExpression(node); + return emitElementAccessExpression(node); case 180: - return emitNewExpression(node); + return emitCallExpression(node); case 181: - return emitTaggedTemplateExpression(node); + return emitNewExpression(node); case 182: - return emitTypeAssertionExpression(node); + return emitTaggedTemplateExpression(node); case 183: - return emitParenthesizedExpression(node); + return emitTypeAssertionExpression(node); case 184: - return emitFunctionExpression(node); + return emitParenthesizedExpression(node); case 185: - return emitArrowFunction(node); + return emitFunctionExpression(node); case 186: - return emitDeleteExpression(node); + return emitArrowFunction(node); case 187: - return emitTypeOfExpression(node); + return emitDeleteExpression(node); case 188: - return emitVoidExpression(node); + return emitTypeOfExpression(node); case 189: - return emitAwaitExpression(node); + return emitVoidExpression(node); case 190: - return emitPrefixUnaryExpression(node); + return emitAwaitExpression(node); case 191: - return emitPostfixUnaryExpression(node); + return emitPrefixUnaryExpression(node); case 192: - return emitBinaryExpression(node); + return emitPostfixUnaryExpression(node); case 193: - return emitConditionalExpression(node); + return emitBinaryExpression(node); case 194: - return emitTemplateExpression(node); + return emitConditionalExpression(node); case 195: - return emitYieldExpression(node); + return emitTemplateExpression(node); case 196: - return emitSpreadExpression(node); + return emitYieldExpression(node); case 197: - return emitClassExpression(node); + return emitSpreadExpression(node); case 198: + return emitClassExpression(node); + case 199: return; - case 200: - return emitAsExpression(node); case 201: - return emitNonNullExpression(node); + return emitAsExpression(node); case 202: + return emitNonNullExpression(node); + case 203: return emitMetaProperty(node); - case 247: - return emitJsxElement(node); case 248: + return emitJsxElement(node); + case 249: return emitJsxSelfClosingElement(node); - case 295: + case 296: return emitPartiallyEmittedExpression(node); } } @@ -49603,7 +49885,7 @@ var ts; function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - write(node.kind === 151 ? "get " : "set "); + write(node.kind === 152 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -49801,7 +50083,9 @@ var ts; function needsDotDotForPropertyAccess(expression) { if (expression.kind === 8) { var text = getLiteralTextOfNode(expression); - return text.indexOf(ts.tokenToString(22)) < 0; + return ts.getNumericLiteralFlags(text, 15) === 0 + && !expression.isOctalLiteral + && text.indexOf(ts.tokenToString(22)) < 0; } else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { var constantValue = ts.getConstantValue(expression); @@ -49884,7 +50168,7 @@ var ts; } function shouldEmitWhitespaceBeforeOperand(node) { var operand = node.operand; - return operand.kind === 190 + return operand.kind === 191 && ((node.operator === 36 && (operand.operator === 36 || operand.operator === 42)) || (node.operator === 37 && (operand.operator === 37 || operand.operator === 43))); } @@ -50001,7 +50285,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node); writeToken(81, node.thenStatement.end, node); - if (node.elseStatement.kind === 209) { + if (node.elseStatement.kind === 210) { write(" "); emit(node.elseStatement); } @@ -50063,7 +50347,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 225) { + if (node.kind === 226) { emit(node); } else { @@ -50295,7 +50579,7 @@ var ts; write(node.flags & 16 ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 231) { + while (body.kind === 232) { write("."); emit(body.name); body = body.body; @@ -50491,7 +50775,6 @@ var ts; emitList(node, node.types, 272); } function emitCatchClause(node) { - writeLine(); var openParenPos = writeToken(73, node.pos); write(" "); writeToken(18, openParenPos); @@ -50571,10 +50854,10 @@ var ts; if (shouldSkip) continue; if (shouldBundle) { - if (bundledHelpers[helper.name]) { + if (bundledHelpers.get(helper.name)) { continue; } - bundledHelpers[helper.name] = true; + bundledHelpers.set(helper.name, true); } } else if (isBundle) { @@ -50909,7 +51192,7 @@ var ts; && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); } function skipSynthesizedParentheses(node) { - while (node.kind === 183 && ts.nodeIsSynthesized(node)) { + while (node.kind === 184 && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -50951,13 +51234,14 @@ var ts; } function isUniqueName(name) { return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentFileIdentifiers, name) && - !ts.hasProperty(generatedNameSet, name); + !currentFileIdentifiers.has(name) && + !generatedNameSet.has(name); } function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { - if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { + if (node.locals) { + var local = node.locals.get(name); + if (local && local.flags & (107455 | 1048576 | 8388608)) { return false; } } @@ -50966,21 +51250,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_43 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_43)) { + var name = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name)) { tempFlags |= flags; - return name_43; + return name; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_44 = count < 26 + var name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_44)) { - return name_44; + if (isUniqueName(name)) { + return name; } } } @@ -50993,7 +51277,8 @@ var ts; while (true) { var generatedName = baseName + i; if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; + generatedNameSet.set(generatedName, generatedName); + return generatedName; } i++; } @@ -51024,21 +51309,21 @@ var ts; switch (node.kind) { case 70: return makeUniqueName(getTextOfNode(node)); + case 232: case 231: - case 230: return generateNameForModuleOrEnum(node); - case 236: - case 242: + case 237: + case 243: return generateNameForImportOrExportDeclaration(node); - case 226: case 227: - case 241: + case 228: + case 242: return generateNameForExportDefault(); - case 197: + case 198: return generateNameForClassExpression(); - case 149: - case 151: + case 150: case 152: + case 153: return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0); @@ -51194,11 +51479,11 @@ var ts; return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; } function directoryExists(directoryPath) { - if (directoryPath in existingDirectories) { + if (existingDirectories.has(directoryPath)) { return true; } if (ts.sys.directoryExists(directoryPath)) { - existingDirectories[directoryPath] = true; + existingDirectories.set(directoryPath, true); return true; } return false; @@ -51217,9 +51502,10 @@ var ts; } var hash = ts.sys.createHash(data); var mtimeBefore = ts.sys.getModifiedTime(fileName); - if (mtimeBefore && fileName in outputFingerprints) { - var fingerprint = outputFingerprints[fileName]; - if (fingerprint.byteOrderMark === writeByteOrderMark && + if (mtimeBefore) { + var fingerprint = outputFingerprints.get(fileName); + if (fingerprint && + fingerprint.byteOrderMark === writeByteOrderMark && fingerprint.hash === hash && fingerprint.mtime.getTime() === mtimeBefore.getTime()) { return; @@ -51227,11 +51513,11 @@ var ts; } ts.sys.writeFile(fileName, data, writeByteOrderMark); var mtimeAfter = ts.sys.getModifiedTime(fileName); - outputFingerprints[fileName] = { + outputFingerprints.set(fileName, { hash: hash, byteOrderMark: writeByteOrderMark, mtime: mtimeAfter - }; + }); } function writeFile(fileName, data, writeByteOrderMark, onError) { try { @@ -51330,10 +51616,14 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_45 = names_1[_i]; - var result = name_45 in cache - ? cache[name_45] - : cache[name_45] = loader(name_45, containingFile); + var name = names_1[_i]; + var result = void 0; + if (cache.has(name)) { + result = cache.get(name); + } + else { + cache.set(name, result = loader(name, containingFile)); + } resolutions.push(result); } return resolutions; @@ -51442,7 +51732,7 @@ var ts; return program; function getCommonSourceDirectory() { if (commonSourceDirectory === undefined) { - var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary); + var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary); }); if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); } @@ -51461,7 +51751,7 @@ var ts; classifiableNames = ts.createMap(); for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var sourceFile = files_2[_i]; - ts.copyProperties(sourceFile.classifiableNames, classifiableNames); + ts.copyEntries(sourceFile.classifiableNames, classifiableNames); } } return classifiableNames; @@ -51644,7 +51934,7 @@ var ts; }; } function isSourceFileFromExternalLibrary(file) { - return sourceFilesFoundSearchingNodeModules[file.path]; + return sourceFilesFoundSearchingNodeModules.get(file.path); } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); @@ -51761,57 +52051,57 @@ var ts; return diagnostics; function walk(node) { switch (parent.kind) { - case 144: - case 147: + case 145: + case 148: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); return; } - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 184: - case 226: + case 153: case 185: - case 226: - case 224: + case 227: + case 186: + case 227: + case 225: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); return; } } switch (node.kind) { - case 235: + case 236: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 241: + case 242: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 256: + case 257: var heritageClause = node; if (heritageClause.token === 107) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 228: + case 229: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 231: + case 232: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 229: + case 230: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 230: + case 231: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 182: + case 183: var typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; @@ -51826,26 +52116,26 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 227: - case 149: - case 148: + case 228: case 150: + case 149: case 151: case 152: - case 184: - case 226: + case 153: case 185: - case 226: + case 227: + case 186: + case 227: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - case 206: + case 207: if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 206); + return checkModifiers(nodes, parent.kind === 207); } break; - case 147: + case 148: if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; @@ -51856,15 +52146,15 @@ var ts; return; } break; - case 144: + case 145: if (nodes === parent.modifiers) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); return; } break; - case 179: case 180: - case 199: + case 181: + case 200: if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); return; @@ -51954,7 +52244,7 @@ var ts; && !file.isDeclarationFile) { var externalHelpersModuleReference = ts.createSynthesizedNode(9); externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(236); + var importDecl = ts.createSynthesizedNode(237); importDecl.parent = file; externalHelpersModuleReference.parent = importDecl; imports = [externalHelpersModuleReference]; @@ -51972,9 +52262,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { + case 237: case 236: - case 235: - case 242: + case 243: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -51986,7 +52276,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 231: + case 232: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) { var moduleName = node.name; if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { @@ -52070,18 +52360,18 @@ var ts; if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } - if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) { - sourceFilesFoundSearchingNodeModules[file_1.path] = false; + if (file_1 && sourceFilesFoundSearchingNodeModules.get(file_1.path) && currentNodeModulesDepth == 0) { + sourceFilesFoundSearchingNodeModules.set(file_1.path, false); if (!options.noResolve) { processReferencedFiles(file_1, isDefaultLib); processTypeReferenceDirectives(file_1); } - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } - else if (file_1 && modulesWithElidedImports[file_1.path]) { + else if (file_1 && modulesWithElidedImports.get(file_1.path)) { if (currentNodeModulesDepth < maxNodeModuleJsDepth) { - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } } @@ -52097,7 +52387,7 @@ var ts; }); filesByName.set(path, file); if (file) { - sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0); + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); file.path = path; if (host.useCaseSensitiveFileNames()) { var existingFile = filesByNameIgnoreCase.get(path); @@ -52141,7 +52431,7 @@ var ts; } } function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { - var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); if (previousResolution && previousResolution.primary) { return; } @@ -52169,7 +52459,7 @@ var ts; fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); } if (saveResolution) { - resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective); } } function createDiagnostic(refFile, refPos, refEnd, message) { @@ -52210,7 +52500,7 @@ var ts; var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; if (elideImport) { - modulesWithElidedImports[file.path] = true; + modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); @@ -52228,8 +52518,8 @@ var ts; } function computeCommonSourceDirectory(sourceFiles) { var fileNames = []; - for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { - var file = sourceFiles_6[_i]; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var file = sourceFiles_5[_i]; if (!file.isDeclarationFile) { fileNames.push(file.fileName); } @@ -52240,8 +52530,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { - var sourceFile = sourceFiles_7[_i]; + for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { + var sourceFile = sourceFiles_6[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -52392,7 +52682,7 @@ var ts; if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); - ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) { + ts.forEachEmittedFile(emitHost, function (emitFileNames) { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); }); @@ -52609,33 +52899,33 @@ var ts; ts.emptyArray = []; function getMeaningFromDeclaration(node) { switch (node.kind) { - case 144: - case 224: - case 174: + case 145: + case 225: + case 175: + case 148: case 147: - case 146: - case 258: case 259: - case 261: - case 149: - case 148: + case 260: + case 262: case 150: + case 149: case 151: case 152: - case 226: - case 184: + case 153: + case 227: case 185: - case 257: + case 186: + case 258: return 1; - case 143: - case 228: + case 144: case 229: - case 161: - return 2; - case 227: case 230: - return 1 | 2; + case 162: + return 2; + case 228: case 231: + return 1 | 2; + case 232: if (ts.isAmbientModule(node)) { return 4 | 1; } @@ -52645,21 +52935,24 @@ var ts; else { return 4; } - case 239: case 240: - case 235: - case 236: case 241: + case 236: + case 237: case 242: + case 243: return 1 | 2 | 4; - case 262: + case 263: return 4 | 1; } return 1 | 2 | 4; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 241) { + if (node.kind === 263) { + return 1; + } + else if (node.parent.kind === 242) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -52681,15 +52974,15 @@ var ts; ts.getMeaningFromLocation = getMeaningFromLocation; function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 70); - if (node.parent.kind === 141 && + if (node.parent.kind === 142 && node.parent.right === node && - node.parent.parent.kind === 235) { + node.parent.parent.kind === 236) { return 1 | 2 | 4; } return 4; } function isInRightSideOfImport(node) { - while (node.parent.kind === 141) { + while (node.parent.kind === 142) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -52700,27 +52993,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 141) { - while (root.parent && root.parent.kind === 141) { + if (root.parent.kind === 142) { + while (root.parent && root.parent.kind === 142) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 157 && !isLastClause; + return root.parent.kind === 158 && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 177) { - while (root.parent && root.parent.kind === 177) { + if (root.parent.kind === 178) { + while (root.parent && root.parent.kind === 178) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 && root.parent.parent.kind === 256) { + if (!isLastClause && root.parent.kind === 200 && root.parent.parent.kind === 257) { var decl = root.parent.parent.parent; - return (decl.kind === 227 && root.parent.parent.token === 107) || - (decl.kind === 228 && root.parent.parent.token === 84); + return (decl.kind === 228 && root.parent.parent.token === 107) || + (decl.kind === 229 && root.parent.parent.token === 84); } return false; } @@ -52728,17 +53021,17 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 157 || - (node.parent.kind === 199 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + return node.parent.kind === 158 || + (node.parent.kind === 200 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || (node.kind === 98 && !ts.isPartOfExpression(node)) || - node.kind === 167; + node.kind === 168; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 179); + return isCallOrNewExpressionTarget(node, 180); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 180); + return isCallOrNewExpressionTarget(node, 181); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -52751,7 +53044,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 220 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 221 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -52761,13 +53054,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 && - (node.parent.kind === 216 || node.parent.kind === 215) && + (node.parent.kind === 217 || node.parent.kind === 216) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 && - node.parent.kind === 220 && + node.parent.kind === 221 && node.parent.label === node; } function isLabelName(node) { @@ -52775,15 +53068,15 @@ var ts; } ts.isLabelName = isLabelName; function isRightSideOfQualifiedName(node) { - return node.parent.kind === 141 && node.parent.right === node; + return node.parent.kind === 142 && node.parent.right === node; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 177 && node.parent.name === node; + return node && node.parent && node.parent.kind === 178 && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 231 && node.parent.name === node; + return node.parent.kind === 232 && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -52794,19 +53087,19 @@ var ts; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 || node.kind === 8) { switch (node.parent.kind) { + case 148: case 147: - case 146: - case 258: - case 261: + case 259: + case 262: + case 150: case 149: - case 148: - case 151: case 152: - case 231: + case 153: + case 232: return node.parent.name === node; - case 178: + case 179: return node.parent.argumentExpression === node; - case 142: + case 143: return true; } } @@ -52850,17 +53143,17 @@ var ts; return undefined; } switch (node.kind) { - case 262: + case 263: + case 150: case 149: - case 148: - case 226: - case 184: - case 151: - case 152: case 227: + case 185: + case 152: + case 153: case 228: - case 230: + case 229: case 231: + case 232: return node; } } @@ -52868,46 +53161,46 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 262: + case 263: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 231: + case 232: return ts.ScriptElementKind.moduleElement; - case 227: - case 197: + case 228: + case 198: return ts.ScriptElementKind.classElement; - case 228: return ts.ScriptElementKind.interfaceElement; - case 229: return ts.ScriptElementKind.typeElement; - case 230: return ts.ScriptElementKind.enumElement; - case 224: + case 229: return ts.ScriptElementKind.interfaceElement; + case 230: return ts.ScriptElementKind.typeElement; + case 231: return ts.ScriptElementKind.enumElement; + case 225: return getKindOfVariableDeclaration(node); - case 174: + case 175: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); + case 186: + case 227: case 185: - case 226: - case 184: return ts.ScriptElementKind.functionElement; - case 151: return ts.ScriptElementKind.memberGetAccessorElement; - case 152: return ts.ScriptElementKind.memberSetAccessorElement; + case 152: return ts.ScriptElementKind.memberGetAccessorElement; + case 153: return ts.ScriptElementKind.memberSetAccessorElement; + case 150: case 149: - case 148: return ts.ScriptElementKind.memberFunctionElement; + case 148: case 147: - case 146: return ts.ScriptElementKind.memberVariableElement; - case 155: return ts.ScriptElementKind.indexSignatureElement; - case 154: return ts.ScriptElementKind.constructSignatureElement; - case 153: return ts.ScriptElementKind.callSignatureElement; - case 150: return ts.ScriptElementKind.constructorImplementationElement; - case 143: return ts.ScriptElementKind.typeParameterElement; - case 261: return ts.ScriptElementKind.enumMemberElement; - case 144: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 235: - case 240: - case 237: - case 244: + case 156: return ts.ScriptElementKind.indexSignatureElement; + case 155: return ts.ScriptElementKind.constructSignatureElement; + case 154: return ts.ScriptElementKind.callSignatureElement; + case 151: return ts.ScriptElementKind.constructorImplementationElement; + case 144: return ts.ScriptElementKind.typeParameterElement; + case 262: return ts.ScriptElementKind.enumMemberElement; + case 145: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; + case 236: + case 241: case 238: + case 245: + case 239: return ts.ScriptElementKind.alias; - case 286: + case 287: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -52922,7 +53215,7 @@ var ts; } ts.getNodeKind = getNodeKind; function getStringLiteralTypeForNode(node, typeChecker) { - var searchNode = node.parent.kind === 171 ? node.parent : node; + var searchNode = node.parent.kind === 172 ? node.parent : node; var type = typeChecker.getTypeAtLocation(searchNode); if (type && type.flags & 32) { return type; @@ -52935,7 +53228,7 @@ var ts; case 98: return true; case 70: - return ts.identifierIsThisKeyword(node) && node.parent.kind === 144; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 145; default: return false; } @@ -52979,41 +53272,41 @@ var ts; return false; } switch (n.kind) { - case 227: case 228: - case 230: - case 176: - case 172: - case 161: - case 205: - case 232: + case 229: + case 231: + case 177: + case 173: + case 162: + case 206: case 233: - case 239: - case 243: + case 234: + case 240: + case 244: return nodeEndsWith(n, 17, sourceFile); - case 257: + case 258: return isCompletedNode(n.block, sourceFile); - case 180: + case 181: if (!n.arguments) { return true; } - case 179: - case 183: - case 166: + case 180: + case 184: + case 167: return nodeEndsWith(n, 19, sourceFile); - case 158: case 159: + case 160: return isCompletedNode(n.type, sourceFile); - case 150: case 151: case 152: - case 226: - case 184: - case 149: - case 148: - case 154: case 153: + case 227: case 185: + case 150: + case 149: + case 155: + case 154: + case 186: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -53021,65 +53314,65 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19, sourceFile); - case 231: + case 232: return n.body && isCompletedNode(n.body, sourceFile); - case 209: + case 210: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 208: + case 209: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 24); - case 175: - case 173: - case 178: - case 142: - case 163: + case 176: + case 174: + case 179: + case 143: + case 164: return nodeEndsWith(n, 21, sourceFile); - case 155: + case 156: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 21, sourceFile); - case 254: case 255: + case 256: return false; - case 212: case 213: case 214: - case 211: + case 215: + case 212: return isCompletedNode(n.statement, sourceFile); - case 210: + case 211: var hasWhileKeyword = findChildOfKind(n, 105, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 19, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 160: + case 161: return isCompletedNode(n.exprName, sourceFile); - case 187: - case 186: case 188: - case 195: + case 187: + case 189: case 196: + case 197: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 181: + case 182: return isCompletedNode(n.template, sourceFile); - case 194: + case 195: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 203: + case 204: return ts.nodeIsPresent(n.literal); - case 242: - case 236: + case 243: + case 237: return ts.nodeIsPresent(n.moduleSpecifier); - case 190: + case 191: return isCompletedNode(n.operand, sourceFile); - case 192: - return isCompletedNode(n.right, sourceFile); case 193: + return isCompletedNode(n.right, sourceFile); + case 194: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -53122,7 +53415,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 293 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 294 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -53257,7 +53550,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 262); + ts.Debug.assert(startNode !== undefined || n.kind === 263); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -53302,13 +53595,13 @@ var ts; if (token.kind === 26 && token.parent.kind === 10) { return true; } - if (token.kind === 26 && token.parent.kind === 253) { + if (token.kind === 26 && token.parent.kind === 254) { return true; } - if (token && token.kind === 17 && token.parent.kind === 253) { + if (token && token.kind === 17 && token.parent.kind === 254) { return true; } - if (token.kind === 26 && token.parent.kind === 250) { + if (token.kind === 26 && token.parent.kind === 251) { return true; } return false; @@ -53399,17 +53692,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 157 || node.kind === 179) { + if (node.kind === 158 || node.kind === 180) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 227 || node.kind === 228) { + if (ts.isFunctionLike(node) || node.kind === 228 || node.kind === 229) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 && n.kind <= 140; + return n.kind >= 0 && n.kind <= 141; } ts.isToken = isToken; function isWord(kind) { @@ -53468,18 +53761,18 @@ var ts; } ts.compareDataObjects = compareDataObjects; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 175 || - node.kind === 176) { - if (node.parent.kind === 192 && + if (node.kind === 176 || + node.kind === 177) { + if (node.parent.kind === 193 && node.parent.left === node && node.parent.operatorToken.kind === 57) { return true; } - if (node.parent.kind === 214 && + if (node.parent.kind === 215 && node.parent.initializer === node) { return true; } - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 258 ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 259 ? node.parent.parent : node.parent)) { return true; } } @@ -53507,10 +53800,30 @@ var ts; } } ts.isInNonReferenceComment = isInNonReferenceComment; + function createTextSpanFromNode(node, sourceFile) { + return ts.createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); + } + ts.createTextSpanFromNode = createTextSpanFromNode; + function isTypeKeyword(kind) { + switch (kind) { + case 118: + case 121: + case 129: + case 132: + case 133: + case 135: + case 136: + case 104: + return true; + default: + return false; + } + } + ts.isTypeKeyword = isTypeKeyword; })(ts || (ts = {})); (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 145; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -53686,7 +53999,7 @@ var ts; return location.getText(); } else if (ts.isStringOrNumericLiteral(location) && - location.parent.kind === 142) { + location.parent.kind === 143) { return location.text; } var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); @@ -53696,7 +54009,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 240 || location.parent.kind === 244) && + (location.parent.kind === 241 || location.parent.kind === 245) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -53805,89 +54118,89 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 206: + case 207: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 224: + case 225: + case 148: case 147: - case 146: return spanInVariableDeclaration(node); - case 144: + case 145: return spanInParameterDeclaration(node); - case 226: + case 227: + case 150: case 149: - case 148: - case 151: case 152: - case 150: - case 184: + case 153: + case 151: case 185: + case 186: return spanInFunctionDeclaration(node); - case 205: + case 206: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 232: + case 233: return spanInBlock(node); - case 257: + case 258: return spanInBlock(node.block); - case 208: + case 209: return textSpan(node.expression); - case 217: + case 218: return textSpan(node.getChildAt(0), node.expression); - case 211: + case 212: return textSpanEndingAtNextToken(node, node.expression); - case 210: + case 211: return spanInNode(node.statement); - case 223: + case 224: return textSpan(node.getChildAt(0)); - case 209: + case 210: return textSpanEndingAtNextToken(node, node.expression); - case 220: + case 221: return spanInNode(node.statement); + case 217: case 216: - case 215: return textSpan(node.getChildAt(0), node.label); - case 212: - return spanInForStatement(node); case 213: - return textSpanEndingAtNextToken(node, node.expression); + return spanInForStatement(node); case 214: + return textSpanEndingAtNextToken(node, node.expression); + case 215: return spanInInitializerOfForLike(node); - case 219: + case 220: return textSpanEndingAtNextToken(node, node.expression); - case 254: case 255: + case 256: return spanInNode(node.statements[0]); - case 222: + case 223: return spanInBlock(node.tryBlock); - case 221: + case 222: return textSpan(node, node.expression); - case 241: + case 242: return textSpan(node, node.expression); - case 235: - return textSpan(node, node.moduleReference); case 236: + return textSpan(node, node.moduleReference); + case 237: return textSpan(node, node.moduleSpecifier); - case 242: + case 243: return textSpan(node, node.moduleSpecifier); - case 231: + case 232: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 227: - case 230: - case 261: - case 174: + case 228: + case 231: + case 262: + case 175: return textSpan(node); - case 218: + case 219: return spanInNode(node.statement); - case 145: + case 146: return spanInNodeArray(node.parent.decorators); - case 172: case 173: + case 174: return spanInBindingPattern(node); - case 228: case 229: + case 230: return undefined; case 24: case 1: @@ -53915,20 +54228,20 @@ var ts; case 73: case 86: return spanInNextNode(node); - case 140: + case 141: return spanInOfKeyword(node); default: if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); } if ((node.kind === 70 || - node.kind == 196 || - node.kind === 258 || - node.kind === 259) && + node.kind == 197 || + node.kind === 259 || + node.kind === 260) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 192) { + if (node.kind === 193) { var binaryExpression = node; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left); @@ -53943,38 +54256,38 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 210: + case 211: return spanInPreviousNode(node); - case 145: + case 146: return spanInNode(node.parent); - case 212: - case 214: + case 213: + case 215: return textSpan(node); - case 192: + case 193: if (node.parent.operatorToken.kind === 25) { return textSpan(node); } break; - case 185: + case 186: if (node.parent.body === node) { return textSpan(node); } break; } } - if (node.parent.kind === 258 && + if (node.parent.kind === 259 && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 182 && node.parent.type === node) { + if (node.parent.kind === 183 && node.parent.type === node) { return spanInNextNode(node.parent.type); } if (ts.isFunctionLike(node.parent) && node.parent.type === node) { return spanInPreviousNode(node); } - if ((node.parent.kind === 224 || - node.parent.kind === 144)) { + if ((node.parent.kind === 225 || + node.parent.kind === 145)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -53982,7 +54295,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 192) { + if (node.parent.kind === 193) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -54003,7 +54316,7 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 213) { + if (variableDeclaration.parent.parent.kind === 214) { return spanInNode(variableDeclaration.parent.parent); } if (ts.isBindingPattern(variableDeclaration.name)) { @@ -54011,7 +54324,7 @@ var ts; } if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1) || - variableDeclaration.parent.parent.kind === 214) { + variableDeclaration.parent.parent.kind === 215) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -54043,7 +54356,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1) || - (functionDeclaration.parent.kind === 227 && functionDeclaration.kind !== 150); + (functionDeclaration.parent.kind === 228 && functionDeclaration.kind !== 151); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -54063,22 +54376,22 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 231: + case 232: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 211: - case 209: - case 213: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 212: + case 210: case 214: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 213: + case 215: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 225) { + if (forLikeStatement.initializer.kind === 226) { var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -54100,62 +54413,62 @@ var ts; } } function spanInBindingPattern(bindingPattern) { - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 198 ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 199 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - if (bindingPattern.parent.kind === 174) { + if (bindingPattern.parent.kind === 175) { return textSpan(bindingPattern.parent); } return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 173 && node.kind !== 172); - var elements = node.kind === 175 ? + ts.Debug.assert(node.kind !== 174 && node.kind !== 173); + var elements = node.kind === 176 ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 198 ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 199 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - return textSpan(node.parent.kind === 192 ? node.parent : node); + return textSpan(node.parent.kind === 193 ? node.parent : node); } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 230: + case 231: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 227: + case 228: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 233: + case 234: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 232: + case 233: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 230: - case 227: + case 231: + case 228: return textSpan(node); - case 205: + case 206: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 257: + case 258: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 233: + case 234: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 172: + case 173: var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -54168,7 +54481,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 173: + case 174: var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -54180,33 +54493,33 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 210 || - node.parent.kind === 179 || - node.parent.kind === 180) { + if (node.parent.kind === 211 || + node.parent.kind === 180 || + node.parent.kind === 181) { return spanInPreviousNode(node); } - if (node.parent.kind === 183) { + if (node.parent.kind === 184) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 184: - case 226: case 185: + case 227: + case 186: + case 150: case 149: - case 148: - case 151: case 152: - case 150: - case 211: - case 210: + case 153: + case 151: case 212: - case 214: - case 179: + case 211: + case 213: + case 215: case 180: - case 183: + case 181: + case 184: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -54214,26 +54527,26 @@ var ts; } function spanInColonToken(node) { if (ts.isFunctionLike(node.parent) || - node.parent.kind === 258 || - node.parent.kind === 144) { + node.parent.kind === 259 || + node.parent.kind === 145) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 182) { + if (node.parent.kind === 183) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 210) { + if (node.parent.kind === 211) { return textSpanEndingAtNextToken(node, node.parent.expression); } return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 214) { + if (node.parent.kind === 215) { return spanInNextNode(node); } return spanInNode(node.parent); @@ -54264,7 +54577,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 124 || - keyword2 === 133 || + keyword2 === 134 || keyword2 === 122 || keyword2 === 114) { return true; @@ -54380,10 +54693,10 @@ var ts; angleBracketStack--; } else if (token === 118 || - token === 134 || + token === 135 || token === 132 || token === 121 || - token === 135) { + token === 136) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 70; } @@ -54538,7 +54851,7 @@ var ts; } } function isKeyword(token) { - return token >= 71 && token <= 140; + return token >= 71 && token <= 141; } function classFromKind(token) { if (isKeyword(token)) { @@ -54584,10 +54897,10 @@ var ts; ts.getSemanticClassifications = getSemanticClassifications; function checkForClassificationCancellation(cancellationToken, kind) { switch (kind) { - case 231: - case 227: + case 232: case 228: - case 226: + case 229: + case 227: cancellationToken.throwIfCancellationRequested(); } } @@ -54631,7 +54944,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 231 && + return declaration.kind === 232 && ts.getModuleInstanceState(declaration) === 1; }); } @@ -54642,7 +54955,7 @@ var ts; checkForClassificationCancellation(cancellationToken, kind); if (kind === 70 && !ts.nodeIsMissing(node)) { var identifier = node; - if (classifiableNames[identifier.text]) { + if (classifiableNames.get(identifier.text)) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var type = classifySymbol(symbol, ts.getMeaningFromLocation(node)); @@ -54772,16 +55085,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 282: + case 283: processJSDocParameterTag(tag); break; - case 285: + case 286: processJSDocTemplateTag(tag); break; - case 284: + case 285: processElement(tag.typeExpression); break; - case 283: + case 284: processElement(tag.typeExpression); break; } @@ -54862,22 +55175,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 249: + case 250: if (token.parent.tagName === token) { return 19; } break; - case 250: + case 251: if (token.parent.tagName === token) { return 20; } break; - case 248: + case 249: if (token.parent.tagName === token) { return 21; } break; - case 251: + case 252: if (token.parent.name === token) { return 22; } @@ -54897,17 +55210,17 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 57) { - if (token.parent.kind === 224 || - token.parent.kind === 147 || - token.parent.kind === 144 || - token.parent.kind === 251) { + if (token.parent.kind === 225 || + token.parent.kind === 148 || + token.parent.kind === 145 || + token.parent.kind === 252) { return 5; } } - if (token.parent.kind === 192 || - token.parent.kind === 190 || + if (token.parent.kind === 193 || token.parent.kind === 191 || - token.parent.kind === 193) { + token.parent.kind === 192 || + token.parent.kind === 194) { return 5; } } @@ -54917,7 +55230,7 @@ var ts; return 4; } else if (tokenKind === 9) { - return token.parent.kind === 251 ? 24 : 6; + return token.parent.kind === 252 ? 24 : 6; } else if (tokenKind === 11) { return 6; @@ -54931,32 +55244,32 @@ var ts; else if (tokenKind === 70) { if (token) { switch (token.parent.kind) { - case 227: + case 228: if (token.parent.name === token) { return 11; } return; - case 143: + case 144: if (token.parent.name === token) { return 15; } return; - case 228: + case 229: if (token.parent.name === token) { return 13; } return; - case 230: + case 231: if (token.parent.name === token) { return 12; } return; - case 231: + case 232: if (token.parent.name === token) { return 14; } return; - case 144: + case 145: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 : 17; } @@ -54989,10 +55302,10 @@ var ts; (function (Completions) { function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { if (ts.isInReferenceComment(sourceFile, position)) { - return getTripleSlashReferenceCompletion(sourceFile, position); + return getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); } if (ts.isInString(sourceFile, position)) { - return getStringLiteralCompletionEntries(sourceFile, position); + return getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log); } var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (!completionData) { @@ -55004,13 +55317,13 @@ var ts; } var entries = []; if (ts.isSourceFileJavaScript(sourceFile)) { - var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true, typeChecker, compilerOptions.target, log); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target)); } else { if (!symbols || symbols.length === 0) { if (sourceFile.languageVariant === 1 && - location.parent && location.parent.kind === 250) { + location.parent && location.parent.kind === 251) { var tagName = location.parent.parent.openingElement.tagName; entries.push({ name: tagName.text, @@ -55023,531 +55336,535 @@ var ts; return undefined; } } - getCompletionEntriesFromSymbols(symbols, entries, location, true); + getCompletionEntriesFromSymbols(symbols, entries, location, true, typeChecker, compilerOptions.target, log); } if (!isMemberCompletion && !isJsDocTagName) { ts.addRange(entries, keywordCompletions); } return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { - var entries = []; - var nameTable = ts.getNameTable(sourceFile); - for (var name_46 in nameTable) { - if (nameTable[name_46] === position) { - continue; + } + Completions.getCompletionsAtPosition = getCompletionsAtPosition; + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames, target) { + var entries = []; + var nameTable = ts.getNameTable(sourceFile); + nameTable.forEach(function (pos, name) { + if (pos === position) { + return; + } + if (!uniqueNames.get(name)) { + uniqueNames.set(name, name); + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name), target, true); + if (displayName) { + var entry = { + name: displayName, + kind: ts.ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } - if (!uniqueNames[name_46]) { - uniqueNames[name_46] = name_46; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_46), compilerOptions.target, true); - if (displayName) { - var entry = { - name: displayName, - kind: ts.ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; + } + }); + return entries; + } + function createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target) { + var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location); + if (!displayName) { + return undefined; + } + return { + name: displayName, + kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), + kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), + sortText: "0", + }; + } + function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks, typeChecker, target, log) { + var start = ts.timestamp(); + var uniqueNames = ts.createMap(); + if (symbols) { + for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { + var symbol = symbols_4[_i]; + var entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!uniqueNames.get(id)) { entries.push(entry); + uniqueNames.set(id, id); } } } - return entries; } - function createCompletionEntry(symbol, location, performCharacterChecks) { - var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location); - if (!displayName) { - return undefined; - } - return { - name: displayName, - kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - sortText: "0", - }; + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); + return uniqueNames; + } + function getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log) { + var node = ts.findPrecedingToken(position, sourceFile); + if (!node || node.kind !== 9) { + return undefined; } - function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) { - var start = ts.timestamp(); - var uniqueNames = ts.createMap(); - if (symbols) { - for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { - var symbol = symbols_4[_i]; - var entry = createCompletionEntry(symbol, location, performCharacterChecks); - if (entry) { - var id = ts.escapeIdentifier(entry.name); - if (!uniqueNames[id]) { - entries.push(entry); - uniqueNames[id] = id; - } - } - } - } - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); - return uniqueNames; + if (node.parent.kind === 259 && + node.parent.parent.kind === 177 && + node.parent.name === node) { + return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent, typeChecker, compilerOptions.target, log); } - function getStringLiteralCompletionEntries(sourceFile, position) { - var node = ts.findPrecedingToken(position, sourceFile); - if (!node || node.kind !== 9) { - return undefined; - } - if (node.parent.kind === 258 && - node.parent.parent.kind === 176 && - node.parent.name === node) { - return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); - } - else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { - return getStringLiteralCompletionEntriesFromElementAccess(node.parent); - } - else if (node.parent.kind === 236 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { - return getStringLiteralCompletionEntriesFromModuleNames(node); - } - else { - var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo) { - return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo); - } - return getStringLiteralCompletionEntriesFromContextualType(node); - } + else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { + return getStringLiteralCompletionEntriesFromElementAccess(node.parent, typeChecker, compilerOptions.target, log); } - function getStringLiteralCompletionEntriesFromPropertyAssignment(element) { - var type = typeChecker.getContextualType(element.parent); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } + else if (node.parent.kind === 237 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { + return getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker); + } + else if (isEqualityExpression(node.parent)) { + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.left === node ? node.parent.right : node.parent.left), typeChecker); + } + else if (ts.isCaseOrDefaultClause(node.parent)) { + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.parent.parent.expression), typeChecker); + } + else { + var argumentInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); + if (argumentInfo) { + return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker); } + return getStringLiteralCompletionEntriesFromType(typeChecker.getContextualType(node), typeChecker); } - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) { - var candidates = []; - var entries = []; - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); - for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { - var candidate = candidates_3[_i]; - if (candidate.parameters.length > argumentInfo.argumentIndex) { - var parameter = candidate.parameters[argumentInfo.argumentIndex]; - addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries); - } + } + function getStringLiteralCompletionEntriesFromPropertyAssignment(element, typeChecker, target, log) { + var type = typeChecker.getContextualType(element.parent); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, false, typeChecker, target, log); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; } + } + } + function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker) { + var candidates = []; + var entries = []; + typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); + for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { + var candidate = candidates_3[_i]; + addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries, typeChecker); + } + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; + } + return undefined; + } + function getStringLiteralCompletionEntriesFromElementAccess(node, typeChecker, target, log) { + var type = typeChecker.getTypeAtLocation(node.expression); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, false, typeChecker, target, log); if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; } - return undefined; } - function getStringLiteralCompletionEntriesFromElementAccess(node) { - var type = typeChecker.getTypeAtLocation(node.expression); + return undefined; + } + function getStringLiteralCompletionEntriesFromType(type, typeChecker) { + if (type) { var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } + addStringLiteralCompletionsFromType(type, entries, typeChecker); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; } - return undefined; } - function getStringLiteralCompletionEntriesFromContextualType(node) { - var type = typeChecker.getContextualType(node); - if (type) { - var entries_2 = []; - addStringLiteralCompletionsFromType(type, entries_2); - if (entries_2.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 }; - } - } - return undefined; + return undefined; + } + function addStringLiteralCompletionsFromType(type, result, typeChecker) { + if (type && type.flags & 16384) { + type = typeChecker.getApparentType(type); } - function addStringLiteralCompletionsFromType(type, result) { - if (type && type.flags & 16384) { - type = typeChecker.getApparentType(type); - } - if (!type) { - return; - } - if (type.flags & 65536) { - ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); }); - } - else { - if (type.flags & 32) { - result.push({ - name: type.text, - kindModifiers: ts.ScriptElementKindModifier.none, - kind: ts.ScriptElementKind.variableElement, - sortText: "0" - }); - } + if (!type) { + return; + } + if (type.flags & 65536) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + addStringLiteralCompletionsFromType(t, result, typeChecker); } } - function getStringLiteralCompletionEntriesFromModuleNames(node) { - var literalValue = ts.normalizeSlashes(node.text); - var scriptPath = node.getSourceFile().path; - var scriptDirectory = ts.getDirectoryPath(scriptPath); - var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); - var entries; - if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { - if (compilerOptions.rootDirs) { - entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath); - } - else { - entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath); - } + else if (type.flags & 32) { + result.push({ + name: type.text, + kindModifiers: ts.ScriptElementKindModifier.none, + kind: ts.ScriptElementKind.variableElement, + sortText: "0" + }); + } + } + function getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker) { + var literalValue = ts.normalizeSlashes(node.text); + var scriptPath = node.getSourceFile().path; + var scriptDirectory = ts.getDirectoryPath(scriptPath); + var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); + var entries; + if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { + var extensions = ts.getSupportedExtensions(compilerOptions); + if (compilerOptions.rootDirs) { + entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, extensions, false, span, compilerOptions, host, scriptPath); } else { - entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span); + entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensions, false, span, host, scriptPath); } - return { - isGlobalCompletion: false, - isMemberCompletion: false, - isNewIdentifierLocation: true, - entries: entries - }; } - function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { - rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); - var relativeDirectory; - for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) { - var rootDirectory = rootDirs_1[_i]; - if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { - relativeDirectory = scriptPath.substr(rootDirectory.length); - break; - } - } - return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); + else { + entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span, compilerOptions, host, typeChecker); } - function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) { - var basePath = compilerOptions.project || host.getCurrentDirectory(); - var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); - var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); - var result = []; - for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { - var baseDirectory = baseDirectories_1[_i]; - getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result); + return { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: true, + entries: entries + }; + } + function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { + rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); + var relativeDirectory; + for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) { + var rootDirectory = rootDirs_1[_i]; + if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { + relativeDirectory = scriptPath.substr(rootDirectory.length); + break; } - return result; } - function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) { - if (result === void 0) { result = []; } - if (fragment === undefined) { - fragment = ""; - } - fragment = ts.normalizeSlashes(fragment); - fragment = ts.getDirectoryPath(fragment); - if (fragment === "") { - fragment = "." + ts.directorySeparator; - } - fragment = ts.ensureTrailingDirectorySeparator(fragment); - var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment)); - var baseDirectory = ts.getDirectoryPath(absolutePath); - var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); - if (tryDirectoryExists(host, baseDirectory)) { - var files = tryReadDirectory(host, baseDirectory, extensions, undefined, ["./*"]); - if (files) { - var foundFiles = ts.createMap(); - for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { - var filePath = files_3[_i]; - filePath = ts.normalizePath(filePath); - if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0) { - continue; - } - var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); - if (!foundFiles[foundFileName]) { - foundFiles[foundFileName] = true; - } + return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); + } + function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, compilerOptions, host, exclude) { + var basePath = compilerOptions.project || host.getCurrentDirectory(); + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); + var result = []; + for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { + var baseDirectory = baseDirectories_1[_i]; + getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, host, exclude, result); + } + return result; + } + function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, host, exclude, result) { + if (result === void 0) { result = []; } + if (fragment === undefined) { + fragment = ""; + } + fragment = ts.normalizeSlashes(fragment); + fragment = ts.getDirectoryPath(fragment); + if (fragment === "") { + fragment = "." + ts.directorySeparator; + } + fragment = ts.ensureTrailingDirectorySeparator(fragment); + var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment)); + var baseDirectory = ts.getDirectoryPath(absolutePath); + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + if (tryDirectoryExists(host, baseDirectory)) { + var files = tryReadDirectory(host, baseDirectory, extensions, undefined, ["./*"]); + if (files) { + var foundFiles = ts.createMap(); + for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { + var filePath = files_3[_i]; + filePath = ts.normalizePath(filePath); + if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0) { + continue; } - for (var foundFile in foundFiles) { - result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); + var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); + if (!foundFiles.get(foundFileName)) { + foundFiles.set(foundFileName, true); } } - var directories = tryGetDirectories(host, baseDirectory); - if (directories) { - for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) { - var directory = directories_2[_a]; - var directoryName = ts.getBaseFileName(ts.normalizePath(directory)); - result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span)); - } + ts.forEachKey(foundFiles, function (foundFile) { + result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); + }); + } + var directories = tryGetDirectories(host, baseDirectory); + if (directories) { + for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) { + var directory = directories_2[_a]; + var directoryName = ts.getBaseFileName(ts.normalizePath(directory)); + result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span)); } } - return result; } - function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) { - var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; - var result; - if (baseUrl) { - var fileExtensions = ts.getSupportedExtensions(compilerOptions); - var projectDir = compilerOptions.project || host.getCurrentDirectory(); - var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); - result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, false, span); - if (paths) { - for (var path in paths) { - if (paths.hasOwnProperty(path)) { - if (path === "*") { - if (paths[path]) { - for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { - var pattern = _a[_i]; - for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) { - var match = _c[_b]; - result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); - } + return result; + } + function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span, compilerOptions, host, typeChecker) { + var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; + var result; + if (baseUrl) { + var fileExtensions = ts.getSupportedExtensions(compilerOptions); + var projectDir = compilerOptions.project || host.getCurrentDirectory(); + var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); + result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, false, span, host); + if (paths) { + for (var path in paths) { + if (paths.hasOwnProperty(path)) { + if (path === "*") { + if (paths[path]) { + for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { + var pattern = _a[_i]; + for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host); _b < _c.length; _b++) { + var match = _c[_b]; + result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); } } } - else if (ts.startsWith(path, fragment)) { - var entry = paths[path] && paths[path].length === 1 && paths[path][0]; - if (entry) { - result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span)); - } + } + else if (ts.startsWith(path, fragment)) { + var entry = paths[path] && paths[path].length === 1 && paths[path][0]; + if (entry) { + result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span)); } } } } } - else { - result = []; - } - getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); - for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) { - var moduleName = _e[_d]; - result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); - } - return result; } - function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) { - if (host.readDirectory) { - var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; - if (parsed) { - var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix); - var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix); - var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix); - var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1; - var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory; - var normalizedSuffix = ts.normalizePath(parsed.suffix); - var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory); - var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; - var includeGlob = normalizedSuffix ? "**/*" : "./*"; - var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); - if (matches) { - var result = []; - for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { - var match = matches_1[_i]; - var normalizedMatch = ts.normalizePath(match); - if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) { - continue; - } - var start = completePrefix.length; - var length_5 = normalizedMatch.length - start - normalizedSuffix.length; - result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); + else { + result = []; + } + getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); + for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host); _d < _e.length; _d++) { + var moduleName = _e[_d]; + result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); + } + return result; + } + function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) { + if (host.readDirectory) { + var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; + if (parsed) { + var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix); + var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix); + var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix); + var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1; + var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory; + var normalizedSuffix = ts.normalizePath(parsed.suffix); + var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory); + var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; + var includeGlob = normalizedSuffix ? "**/*" : "./*"; + var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); + if (matches) { + var result = []; + for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { + var match = matches_1[_i]; + var normalizedMatch = ts.normalizePath(match); + if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) { + continue; } - return result; + var start = completePrefix.length; + var length_5 = normalizedMatch.length - start - normalizedSuffix.length; + result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); } + return result; } } - return undefined; } - function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) { - var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; - var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; - var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); }); - var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); }); - if (isNestedModule) { - var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment); - nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) { - if (ts.startsWith(fragment, moduleNameWithSeperator_1)) { - return moduleName.substr(moduleNameWithSeperator_1.length); - } - return moduleName; - }); - } - if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) { - for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) { - var visibleModule = _a[_i]; - if (!isNestedModule) { - nonRelativeModules.push(visibleModule.moduleName); - } - else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) { - var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, undefined, ["./*"]); - if (nestedFiles) { - for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) { - var f = nestedFiles_1[_b]; - f = ts.normalizePath(f); - var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f)); - nonRelativeModules.push(nestedModule); - } + return undefined; + } + function enumeratePotentialNonRelativeModules(fragment, scriptPath, options, typeChecker, host) { + var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; + var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; + var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); }); + var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); }); + if (isNestedModule) { + var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment); + nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) { + if (ts.startsWith(fragment, moduleNameWithSeperator_1)) { + return moduleName.substr(moduleNameWithSeperator_1.length); + } + return moduleName; + }); + } + if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) { + for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) { + var visibleModule = _a[_i]; + if (!isNestedModule) { + nonRelativeModules.push(visibleModule.moduleName); + } + else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) { + var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, undefined, ["./*"]); + if (nestedFiles) { + for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) { + var f = nestedFiles_1[_b]; + f = ts.normalizePath(f); + var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f)); + nonRelativeModules.push(nestedModule); } } } } - return ts.deduplicate(nonRelativeModules); } - function getTripleSlashReferenceCompletion(sourceFile, position) { - var token = ts.getTokenAtPosition(sourceFile, position); - if (!token) { - return undefined; - } - var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); - if (!commentRanges || !commentRanges.length) { - return undefined; + return ts.deduplicate(nonRelativeModules); + } + function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) { + var token = ts.getTokenAtPosition(sourceFile, position); + if (!token) { + return undefined; + } + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + if (!commentRanges || !commentRanges.length) { + return undefined; + } + var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; }); + if (!range) { + return undefined; + } + var completionInfo = { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: true, + entries: [] + }; + var text = sourceFile.text.substr(range.pos, position - range.pos); + var match = tripleSlashDirectiveFragmentRegex.exec(text); + if (match) { + var prefix = match[1]; + var kind = match[2]; + var toComplete = match[3]; + var scriptPath = ts.getDirectoryPath(sourceFile.path); + if (kind === "path") { + var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); + completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), true, span_10, host, sourceFile.path); } - var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; }); - if (!range) { - return undefined; + else { + var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; + completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11); } - var completionInfo = { - isGlobalCompletion: false, - isMemberCompletion: false, - isNewIdentifierLocation: true, - entries: [] - }; - var text = sourceFile.text.substr(range.pos, position - range.pos); - var match = tripleSlashDirectiveFragmentRegex.exec(text); - if (match) { - var prefix = match[1]; - var kind = match[2]; - var toComplete = match[3]; - var scriptPath = ts.getDirectoryPath(sourceFile.path); - if (kind === "path") { - var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); - completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), true, span_10, sourceFile.path); - } - else { - var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; - completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11); - } + } + return completionInfo; + } + function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { + if (result === void 0) { result = []; } + if (options.types) { + for (var _i = 0, _a = options.types; _i < _a.length; _i++) { + var moduleName = _a[_i]; + result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); } - return completionInfo; } - function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { - if (result === void 0) { result = []; } - if (options.types) { - for (var _i = 0, _a = options.types; _i < _a.length; _i++) { - var moduleName = _a[_i]; - result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); - } + else if (host.getDirectories) { + var typeRoots = void 0; + try { + typeRoots = ts.getEffectiveTypeRoots(options, host); } - else if (host.getDirectories) { - var typeRoots = void 0; - try { - typeRoots = ts.getEffectiveTypeRoots(options, host); - } - catch (e) { } - if (typeRoots) { - for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) { - var root = typeRoots_2[_b]; - getCompletionEntriesFromDirectories(host, root, span, result); - } + catch (e) { } + if (typeRoots) { + for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) { + var root = typeRoots_2[_b]; + getCompletionEntriesFromDirectories(host, root, span, result); } } - if (host.getDirectories) { - for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) { - var packageJson = _d[_c]; - var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); - getCompletionEntriesFromDirectories(host, typesDir, span, result); - } + } + if (host.getDirectories) { + for (var _c = 0, _d = findPackageJsons(scriptPath, host); _c < _d.length; _c++) { + var packageJson = _d[_c]; + var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); + getCompletionEntriesFromDirectories(host, typesDir, span, result); } - return result; } - function getCompletionEntriesFromDirectories(host, directory, span, result) { - if (host.getDirectories && tryDirectoryExists(host, directory)) { - var directories = tryGetDirectories(host, directory); - if (directories) { - for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) { - var typeDirectory = directories_3[_i]; - typeDirectory = ts.normalizePath(typeDirectory); - result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span)); - } + return result; + } + function getCompletionEntriesFromDirectories(host, directory, span, result) { + if (host.getDirectories && tryDirectoryExists(host, directory)) { + var directories = tryGetDirectories(host, directory); + if (directories) { + for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) { + var typeDirectory = directories_3[_i]; + typeDirectory = ts.normalizePath(typeDirectory); + result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span)); } } } - function findPackageJsons(currentDir) { - var paths = []; - var currentConfigPath; - while (true) { - currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, "package.json"); - if (currentConfigPath) { - paths.push(currentConfigPath); - currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_14 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_14) { - break; - } - currentDir = parent_14; - } - else { + } + function findPackageJsons(currentDir, host) { + var paths = []; + var currentConfigPath; + while (true) { + currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, "package.json"); + if (currentConfigPath) { + paths.push(currentConfigPath); + currentDir = ts.getDirectoryPath(currentConfigPath); + var parent = ts.getDirectoryPath(currentDir); + if (currentDir === parent) { break; } + currentDir = parent; } - return paths; - } - function enumerateNodeModulesVisibleToScript(host, scriptPath) { - var result = []; - if (host.readFile && host.fileExists) { - for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) { - var packageJson = _a[_i]; - var contents = tryReadingPackageJson(packageJson); - if (!contents) { - return; - } - var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules"); - var foundModuleNames = []; - for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) { - var key = nodeModulesDependencyKeys_1[_b]; - addPotentialPackageNames(contents[key], foundModuleNames); - } - for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) { - var moduleName = foundModuleNames_1[_c]; - var moduleDir = ts.combinePaths(nodeModulesDir, moduleName); - result.push({ - moduleName: moduleName, - moduleDir: moduleDir - }); - } - } + else { + break; } - return result; - function tryReadingPackageJson(filePath) { - try { - var fileText = tryReadFile(host, filePath); - return fileText ? JSON.parse(fileText) : undefined; + } + return paths; + } + function enumerateNodeModulesVisibleToScript(host, scriptPath) { + var result = []; + if (host.readFile && host.fileExists) { + for (var _i = 0, _a = findPackageJsons(scriptPath, host); _i < _a.length; _i++) { + var packageJson = _a[_i]; + var contents = tryReadingPackageJson(packageJson); + if (!contents) { + return; } - catch (e) { - return undefined; + var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules"); + var foundModuleNames = []; + for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) { + var key = nodeModulesDependencyKeys_1[_b]; + addPotentialPackageNames(contents[key], foundModuleNames); } - } - function addPotentialPackageNames(dependencies, result) { - if (dependencies) { - for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { - result.push(dep); - } - } + for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) { + var moduleName = foundModuleNames_1[_c]; + var moduleDir = ts.combinePaths(nodeModulesDir, moduleName); + result.push({ + moduleName: moduleName, + moduleDir: moduleDir + }); } } } - function createCompletionEntryForModule(name, kind, replacementSpan) { - return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan }; - } - function getDirectoryFragmentTextSpan(text, textStart) { - var index = text.lastIndexOf(ts.directorySeparator); - var offset = index !== -1 ? index + 1 : 0; - return { start: textStart + offset, length: text.length - offset }; + return result; + function tryReadingPackageJson(filePath) { + try { + var fileText = tryReadFile(host, filePath); + return fileText ? JSON.parse(fileText) : undefined; + } + catch (e) { + return undefined; + } } - function isPathRelativeToScript(path) { - if (path && path.length >= 2 && path.charCodeAt(0) === 46) { - var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 ? 2 : 1; - var slashCharCode = path.charCodeAt(slashIndex); - return slashCharCode === 47 || slashCharCode === 92; + function addPotentialPackageNames(dependencies, result) { + if (dependencies) { + for (var dep in dependencies) { + if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + result.push(dep); + } + } } - return false; } - function normalizeAndPreserveTrailingSlash(path) { - return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); + } + function createCompletionEntryForModule(name, kind, replacementSpan) { + return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan }; + } + function getDirectoryFragmentTextSpan(text, textStart) { + var index = text.lastIndexOf(ts.directorySeparator); + var offset = index !== -1 ? index + 1 : 0; + return { start: textStart + offset, length: text.length - offset }; + } + function isPathRelativeToScript(path) { + if (path && path.length >= 2 && path.charCodeAt(0) === 46) { + var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 ? 2 : 1; + var slashCharCode = path.charCodeAt(slashIndex); + return slashCharCode === 47 || slashCharCode === 92; } + return false; + } + function normalizeAndPreserveTrailingSlash(path) { + return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); } - Completions.getCompletionsAtPosition = getCompletionsAtPosition; function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) { var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_3 = completionData.location; - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; }); + var symbols = completionData.symbols, location_1 = completionData.location; + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_1) === entryName ? s : undefined; }); if (symbol) { - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_1, location_1, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { name: entryName, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), @@ -55573,8 +55890,8 @@ var ts; function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) { var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_4 = completionData.location; - return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_4) === entryName ? s : undefined; }); + var symbols = completionData.symbols, location_2 = completionData.location; + return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_2) === entryName ? s : undefined; }); } return undefined; } @@ -55599,9 +55916,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 284: - case 282: + case 285: case 283: + case 284: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -55636,13 +55953,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_15 = contextToken.parent, kind = contextToken.kind; + var parent = contextToken.parent, kind = contextToken.kind; if (kind === 22) { - if (parent_15.kind === 177) { + if (parent.kind === 178) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_15.kind === 141) { + else if (parent.kind === 142) { node = contextToken.parent.left; isRightOfDot = true; } @@ -55655,7 +55972,7 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 40 && contextToken.parent.kind === 250) { + else if (kind === 40 && contextToken.parent.kind === 251) { isStartingCloseTag = true; location = contextToken; } @@ -55700,7 +56017,7 @@ var ts; isGlobalCompletion = false; isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 70 || node.kind === 141 || node.kind === 177) { + if (node.kind === 70 || node.kind === 142 || node.kind === 178) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { symbol = typeChecker.getAliasedSymbol(symbol); @@ -55746,7 +56063,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 248) || (jsxContainer.kind === 249)) { + if ((jsxContainer.kind === 249) || (jsxContainer.kind === 250)) { attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); @@ -55767,9 +56084,9 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 262 || - scopeNode.kind === 194 || - scopeNode.kind === 253 || + scopeNode.kind === 263 || + scopeNode.kind === 195 || + scopeNode.kind === 254 || ts.isStatement(scopeNode); } var symbolMeanings = 793064 | 107455 | 1920 | 8388608; @@ -55797,11 +56114,11 @@ var ts; return true; } if (contextToken.kind === 28 && contextToken.parent) { - if (contextToken.parent.kind === 249) { + if (contextToken.parent.kind === 250) { return true; } - if (contextToken.parent.kind === 250 || contextToken.parent.kind === 248) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 247; + if (contextToken.parent.kind === 251 || contextToken.parent.kind === 249) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 248; } } return false; @@ -55811,40 +56128,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 25: - return containingNodeKind === 179 - || containingNodeKind === 150 - || containingNodeKind === 180 - || containingNodeKind === 175 - || containingNodeKind === 192 - || containingNodeKind === 158; + return containingNodeKind === 180 + || containingNodeKind === 151 + || containingNodeKind === 181 + || containingNodeKind === 176 + || containingNodeKind === 193 + || containingNodeKind === 159; case 18: - return containingNodeKind === 179 - || containingNodeKind === 150 - || containingNodeKind === 180 - || containingNodeKind === 183 - || containingNodeKind === 166; + return containingNodeKind === 180 + || containingNodeKind === 151 + || containingNodeKind === 181 + || containingNodeKind === 184 + || containingNodeKind === 167; case 20: - return containingNodeKind === 175 - || containingNodeKind === 155 - || containingNodeKind === 142; + return containingNodeKind === 176 + || containingNodeKind === 156 + || containingNodeKind === 143; case 127: case 128: return true; case 22: - return containingNodeKind === 231; + return containingNodeKind === 232; case 16: - return containingNodeKind === 227; + return containingNodeKind === 228; case 57: - return containingNodeKind === 224 - || containingNodeKind === 192; + return containingNodeKind === 225 + || containingNodeKind === 193; case 13: - return containingNodeKind === 194; + return containingNodeKind === 195; case 14: - return containingNodeKind === 203; + return containingNodeKind === 204; case 113: case 111: case 112: - return containingNodeKind === 147; + return containingNodeKind === 148; } switch (previousToken.getText()) { case "public": @@ -55875,22 +56192,22 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 176) { + if (objectLikeContainer.kind === 177) { isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); typeForObject = typeForObject && typeForObject.getNonNullableType(); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 172) { + else if (objectLikeContainer.kind === 173) { isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); if (ts.isVariableLike(rootDeclaration)) { var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); - if (!canGetType && rootDeclaration.kind === 144) { + if (!canGetType && rootDeclaration.kind === 145) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 149 || rootDeclaration.parent.kind === 152) { + else if (rootDeclaration.parent.kind === 150 || rootDeclaration.parent.kind === 153) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -55916,9 +56233,9 @@ var ts; return true; } function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 239 ? - 236 : - 242; + var declarationKind = namedImportsOrExports.kind === 240 ? + 237 : + 243; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -55926,12 +56243,13 @@ var ts; } isMemberCompletion = true; isNewIdentifierLocation = false; - var exports; - var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier); - if (moduleSpecifierSymbol) { - exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol); + var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); + if (!moduleSpecifierSymbol) { + symbols = ts.emptyArray; + return true; } - symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : ts.emptyArray; + var exports = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol); + symbols = filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements); return true; } function tryGetObjectLikeCompletionContainer(contextToken) { @@ -55939,9 +56257,9 @@ var ts; switch (contextToken.kind) { case 16: case 25: - var parent_16 = contextToken.parent; - if (parent_16 && (parent_16.kind === 176 || parent_16.kind === 172)) { - return parent_16; + var parent = contextToken.parent; + if (parent && (parent.kind === 177 || parent.kind === 173)) { + return parent; } break; } @@ -55954,8 +56272,8 @@ var ts; case 16: case 25: switch (contextToken.parent.kind) { - case 239: - case 243: + case 240: + case 244: return contextToken.parent; } } @@ -55964,34 +56282,34 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_17 = contextToken.parent; + var parent = contextToken.parent; switch (contextToken.kind) { case 27: case 40: case 70: - case 251: case 252: - if (parent_17 && (parent_17.kind === 248 || parent_17.kind === 249)) { - return parent_17; + case 253: + if (parent && (parent.kind === 249 || parent.kind === 250)) { + return parent; } - else if (parent_17.kind === 251) { - return parent_17.parent; + else if (parent.kind === 252) { + return parent.parent; } break; case 9: - if (parent_17 && ((parent_17.kind === 251) || (parent_17.kind === 252))) { - return parent_17.parent; + if (parent && ((parent.kind === 252) || (parent.kind === 253))) { + return parent.parent; } break; case 17: - if (parent_17 && - parent_17.kind === 253 && - parent_17.parent && - (parent_17.parent.kind === 251)) { - return parent_17.parent.parent; + if (parent && + parent.kind === 254 && + parent.parent && + (parent.parent.kind === 252)) { + return parent.parent.parent; } - if (parent_17 && parent_17.kind === 252) { - return parent_17.parent; + if (parent && parent.kind === 253) { + return parent.parent; } break; } @@ -56000,16 +56318,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 184: case 185: - case 226: + case 186: + case 227: + case 150: case 149: - case 148: - case 151: case 152: case 153: case 154: case 155: + case 156: return true; } return false; @@ -56018,66 +56336,66 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 25: - return containingNodeKind === 224 || - containingNodeKind === 225 || - containingNodeKind === 206 || - containingNodeKind === 230 || + return containingNodeKind === 225 || + containingNodeKind === 226 || + containingNodeKind === 207 || + containingNodeKind === 231 || isFunction(containingNodeKind) || - containingNodeKind === 227 || - containingNodeKind === 197 || containingNodeKind === 228 || - containingNodeKind === 173 || - containingNodeKind === 229; + containingNodeKind === 198 || + containingNodeKind === 229 || + containingNodeKind === 174 || + containingNodeKind === 230; case 22: - return containingNodeKind === 173; - case 55: return containingNodeKind === 174; + case 55: + return containingNodeKind === 175; case 20: - return containingNodeKind === 173; + return containingNodeKind === 174; case 18: - return containingNodeKind === 257 || + return containingNodeKind === 258 || isFunction(containingNodeKind); case 16: - return containingNodeKind === 230 || - containingNodeKind === 228 || - containingNodeKind === 161; + return containingNodeKind === 231 || + containingNodeKind === 229 || + containingNodeKind === 162; case 24: - return containingNodeKind === 146 && + return containingNodeKind === 147 && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 228 || - contextToken.parent.parent.kind === 161); + (contextToken.parent.parent.kind === 229 || + contextToken.parent.parent.kind === 162); case 26: - return containingNodeKind === 227 || - containingNodeKind === 197 || - containingNodeKind === 228 || + return containingNodeKind === 228 || + containingNodeKind === 198 || containingNodeKind === 229 || + containingNodeKind === 230 || isFunction(containingNodeKind); case 114: - return containingNodeKind === 147; + return containingNodeKind === 148; case 23: - return containingNodeKind === 144 || + return containingNodeKind === 145 || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 173); + contextToken.parent.parent.kind === 174); case 113: case 111: case 112: - return containingNodeKind === 144; + return containingNodeKind === 145; case 117: - return containingNodeKind === 240 || - containingNodeKind === 244 || - containingNodeKind === 238; + return containingNodeKind === 241 || + containingNodeKind === 245 || + containingNodeKind === 239; case 74: case 82: case 108: case 88: case 103: case 124: - case 133: + case 134: case 90: case 109: case 75: case 115: - case 136: + case 137: return true; } switch (contextToken.getText()) { @@ -56114,13 +56432,13 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_47 = element.propertyName || element.name; - existingImportsOrExports[name_47.text] = true; + var name = element.propertyName || element.name; + existingImportsOrExports.set(name.text, true); } - if (!ts.someProperties(existingImportsOrExports)) { + if (existingImportsOrExports.size === 0) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); } - return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports[e.name]; }); + return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports.get(e.name); }); } function filterObjectMembersList(contextualMemberSymbols, existingMembers) { if (!existingMembers || existingMembers.length === 0) { @@ -56129,19 +56447,19 @@ var ts; var existingMemberNames = ts.createMap(); for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; - if (m.kind !== 258 && - m.kind !== 259 && - m.kind !== 174 && - m.kind !== 149 && - m.kind !== 151 && - m.kind !== 152) { + if (m.kind !== 259 && + m.kind !== 260 && + m.kind !== 175 && + m.kind !== 150 && + m.kind !== 152 && + m.kind !== 153) { continue; } if (m.getStart() <= position && position <= m.getEnd()) { continue; } var existingName = void 0; - if (m.kind === 174 && m.propertyName) { + if (m.kind === 175 && m.propertyName) { if (m.propertyName.kind === 70) { existingName = m.propertyName.text; } @@ -56149,9 +56467,9 @@ var ts; else { existingName = m.name.text; } - existingMemberNames[existingName] = true; + existingMemberNames.set(existingName, true); } - return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; }); + return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames.get(m.name); }); } function filterJsxAttributes(symbols, attributes) { var seenNames = ts.createMap(); @@ -56160,11 +56478,11 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 251) { - seenNames[attr.name.text] = true; + if (attr.kind === 252) { + seenNames.set(attr.name.text, true); } } - return ts.filter(symbols, function (a) { return !seenNames[a.name]; }); + return ts.filter(symbols, function (a) { return !seenNames.get(a.name); }); } } function getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location) { @@ -56193,7 +56511,7 @@ var ts; return name; } var keywordCompletions = []; - for (var i = 71; i <= 140; i++) { + for (var i = 71; i <= 141; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ts.ScriptElementKind.keyword, @@ -56233,6 +56551,15 @@ var ts; catch (e) { } return undefined; } + function isEqualityExpression(node) { + return ts.isBinaryExpression(node) && isEqualityOperatorKind(node.operatorToken.kind); + } + function isEqualityOperatorKind(kind) { + return kind == 31 || + kind === 32 || + kind === 33 || + kind === 34; + } })(Completions = ts.Completions || (ts.Completions = {})); })(ts || (ts = {})); var ts; @@ -56241,495 +56568,480 @@ var ts; (function (DocumentHighlights) { function getDocumentHighlights(typeChecker, cancellationToken, sourceFile, position, sourceFilesToSearch) { var node = ts.getTouchingWord(sourceFile, position); + return node && (getSemanticDocumentHighlights(node, typeChecker, cancellationToken, sourceFilesToSearch) || getSyntacticDocumentHighlights(node, sourceFile)); + } + DocumentHighlights.getDocumentHighlights = getDocumentHighlights; + function getHighlightSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var end = node.getEnd(); + return { + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + kind: ts.HighlightSpanKind.none + }; + } + function getSemanticDocumentHighlights(node, typeChecker, cancellationToken, sourceFilesToSearch) { + var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFilesToSearch); + return referencedSymbols && convertReferencedSymbols(referencedSymbols); + } + function convertReferencedSymbols(referencedSymbols) { + var fileNameToDocumentHighlights = ts.createMap(); + var result = []; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var referencedSymbol = referencedSymbols_1[_i]; + for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { + var referenceEntry = _b[_a]; + var fileName = referenceEntry.fileName; + var documentHighlights = fileNameToDocumentHighlights.get(fileName); + if (!documentHighlights) { + documentHighlights = { fileName: fileName, highlightSpans: [] }; + fileNameToDocumentHighlights.set(fileName, documentHighlights); + result.push(documentHighlights); + } + documentHighlights.highlightSpans.push({ + textSpan: referenceEntry.textSpan, + kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference + }); + } + } + return result; + } + function getSyntacticDocumentHighlights(node, sourceFile) { + var highlightSpans = getHighlightSpans(node, sourceFile); + if (!highlightSpans || highlightSpans.length === 0) { + return undefined; + } + return [{ fileName: sourceFile.fileName, highlightSpans: highlightSpans }]; + } + function hasKind(node, kind) { + return node !== undefined && node.kind === kind; + } + function parent(node) { + return node && node.parent; + } + function getHighlightSpans(node, sourceFile) { if (!node) { return undefined; } - return getSemanticDocumentHighlights(node) || getSyntacticDocumentHighlights(node); - function getHighlightSpanForNode(node) { - var start = node.getStart(); - var end = node.getEnd(); - return { - fileName: sourceFile.fileName, - textSpan: ts.createTextSpanFromBounds(start, end), - kind: ts.HighlightSpanKind.none - }; + switch (node.kind) { + case 89: + case 81: + if (hasKind(node.parent, 210)) { + return getIfElseOccurrences(node.parent, sourceFile); + } + break; + case 95: + if (hasKind(node.parent, 218)) { + return highlightSpans(getReturnOccurrences(node.parent)); + } + break; + case 99: + if (hasKind(node.parent, 222)) { + return highlightSpans(getThrowOccurrences(node.parent)); + } + break; + case 101: + case 73: + case 86: + var tryStatement = node.kind === 73 ? parent(parent(node)) : parent(node); + if (hasKind(tryStatement, 223)) { + return highlightSpans(getTryCatchFinallyOccurrences(tryStatement, sourceFile)); + } + break; + case 97: + if (hasKind(node.parent, 220)) { + return highlightSpans(getSwitchCaseDefaultOccurrences(node.parent)); + } + break; + case 72: + case 78: + if (hasKind(parent(parent(parent(node))), 220)) { + return highlightSpans(getSwitchCaseDefaultOccurrences(node.parent.parent.parent)); + } + break; + case 71: + case 76: + if (hasKind(node.parent, 217) || hasKind(node.parent, 216)) { + return highlightSpans(getBreakOrContinueStatementOccurrences(node.parent)); + } + break; + case 87: + if (hasKind(node.parent, 213) || + hasKind(node.parent, 214) || + hasKind(node.parent, 215)) { + return highlightSpans(getLoopBreakContinueOccurrences(node.parent)); + } + break; + case 105: + case 80: + if (hasKind(node.parent, 212) || hasKind(node.parent, 211)) { + return highlightSpans(getLoopBreakContinueOccurrences(node.parent)); + } + break; + case 122: + if (hasKind(node.parent, 151)) { + return highlightSpans(getConstructorOccurrences(node.parent)); + } + break; + case 124: + case 134: + if (hasKind(node.parent, 152) || hasKind(node.parent, 153)) { + return highlightSpans(getGetAndSetOccurrences(node.parent)); + } + break; + default: + if (ts.isModifierKind(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 207)) { + return highlightSpans(getModifierOccurrences(node.kind, node.parent)); + } } - function getSemanticDocumentHighlights(node) { - if (node.kind === 70 || - node.kind === 98 || - node.kind === 167 || - node.kind === 96 || - node.kind === 9 || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFilesToSearch, false, false, false); - return convertReferencedSymbols(referencedSymbols); + function highlightSpans(nodes) { + return nodes && nodes.map(function (node) { return getHighlightSpanForNode(node, sourceFile); }); + } + } + function aggregateOwnedThrowStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 222) { + statementAccumulator.push(node); } - return undefined; - function convertReferencedSymbols(referencedSymbols) { - if (!referencedSymbols) { - return undefined; + else if (node.kind === 223) { + var tryStatement = node; + if (tryStatement.catchClause) { + aggregate(tryStatement.catchClause); } - var fileNameToDocumentHighlights = ts.createMap(); - var result = []; - for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { - var referencedSymbol = referencedSymbols_1[_i]; - for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { - var referenceEntry = _b[_a]; - var fileName = referenceEntry.fileName; - var documentHighlights = fileNameToDocumentHighlights[fileName]; - if (!documentHighlights) { - documentHighlights = { fileName: fileName, highlightSpans: [] }; - fileNameToDocumentHighlights[fileName] = documentHighlights; - result.push(documentHighlights); - } - documentHighlights.highlightSpans.push({ - textSpan: referenceEntry.textSpan, - kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference - }); - } + else { + aggregate(tryStatement.tryBlock); } - return result; + if (tryStatement.finallyBlock) { + aggregate(tryStatement.finallyBlock); + } + } + else if (!ts.isFunctionLike(node)) { + ts.forEachChild(node, aggregate); } } - function getSyntacticDocumentHighlights(node) { - var fileName = sourceFile.fileName; - var highlightSpans = getHighlightSpans(node); - if (!highlightSpans || highlightSpans.length === 0) { - return undefined; + } + function getThrowStatementOwner(throwStatement) { + var child = throwStatement; + while (child.parent) { + var parent_2 = child.parent; + if (ts.isFunctionBlock(parent_2) || parent_2.kind === 263) { + return parent_2; } - return [{ fileName: fileName, highlightSpans: highlightSpans }]; - function hasKind(node, kind) { - return node !== undefined && node.kind === kind; + if (parent_2.kind === 223) { + var tryStatement = parent_2; + if (tryStatement.tryBlock === child && tryStatement.catchClause) { + return child; + } } - function parent(node) { - return node && node.parent; + child = parent_2; + } + return undefined; + } + function aggregateAllBreakAndContinueStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 217 || node.kind === 216) { + statementAccumulator.push(node); } - function getHighlightSpans(node) { - if (node) { - switch (node.kind) { - case 89: - case 81: - if (hasKind(node.parent, 209)) { - return getIfElseOccurrences(node.parent); - } - break; - case 95: - if (hasKind(node.parent, 217)) { - return getReturnOccurrences(node.parent); - } - break; - case 99: - if (hasKind(node.parent, 221)) { - return getThrowOccurrences(node.parent); - } - break; - case 73: - if (hasKind(parent(parent(node)), 222)) { - return getTryCatchFinallyOccurrences(node.parent.parent); - } - break; - case 101: - case 86: - if (hasKind(parent(node), 222)) { - return getTryCatchFinallyOccurrences(node.parent); - } - break; - case 97: - if (hasKind(node.parent, 219)) { - return getSwitchCaseDefaultOccurrences(node.parent); - } - break; - case 72: - case 78: - if (hasKind(parent(parent(parent(node))), 219)) { - return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); - } - break; - case 71: - case 76: - if (hasKind(node.parent, 216) || hasKind(node.parent, 215)) { - return getBreakOrContinueStatementOccurrences(node.parent); - } - break; - case 87: - if (hasKind(node.parent, 212) || - hasKind(node.parent, 213) || - hasKind(node.parent, 214)) { - return getLoopBreakContinueOccurrences(node.parent); - } - break; - case 105: - case 80: - if (hasKind(node.parent, 211) || hasKind(node.parent, 210)) { - return getLoopBreakContinueOccurrences(node.parent); - } - break; - case 122: - if (hasKind(node.parent, 150)) { - return getConstructorOccurrences(node.parent); - } - break; - case 124: - case 133: - if (hasKind(node.parent, 151) || hasKind(node.parent, 152)) { - return getGetAndSetOccurrences(node.parent); - } - break; - default: - if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 206)) { - return getModifierOccurrences(node.kind, node.parent); - } - } - } - return undefined; + else if (!ts.isFunctionLike(node)) { + ts.forEachChild(node, aggregate); } - function aggregateOwnedThrowStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 221) { - statementAccumulator.push(node); - } - else if (node.kind === 222) { - var tryStatement = node; - if (tryStatement.catchClause) { - aggregate(tryStatement.catchClause); - } - else { - aggregate(tryStatement.tryBlock); - } - if (tryStatement.finallyBlock) { - aggregate(tryStatement.finallyBlock); - } - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); + } + } + function ownsBreakOrContinueStatement(owner, statement) { + var actualOwner = getBreakOrContinueOwner(statement); + return actualOwner && actualOwner === owner; + } + function getBreakOrContinueOwner(statement) { + for (var node = statement.parent; node; node = node.parent) { + switch (node.kind) { + case 220: + if (statement.kind === 216) { + continue; } - } - } - function getThrowStatementOwner(throwStatement) { - var child = throwStatement; - while (child.parent) { - var parent_18 = child.parent; - if (ts.isFunctionBlock(parent_18) || parent_18.kind === 262) { - return parent_18; + case 213: + case 214: + case 215: + case 212: + case 211: + if (!statement.label || isLabeledBy(node, statement.label.text)) { + return node; } - if (parent_18.kind === 222) { - var tryStatement = parent_18; - if (tryStatement.tryBlock === child && tryStatement.catchClause) { - return child; - } + break; + default: + if (ts.isFunctionLike(node)) { + return undefined; } - child = parent_18; - } + break; + } + } + return undefined; + } + function getModifierOccurrences(modifier, declaration) { + var container = declaration.parent; + if (ts.isAccessibilityModifier(modifier)) { + if (!(container.kind === 228 || + container.kind === 198 || + (declaration.kind === 145 && hasKind(container, 151)))) { return undefined; } - function aggregateAllBreakAndContinueStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 216 || node.kind === 215) { - statementAccumulator.push(node); - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); - } - } + } + else if (modifier === 114) { + if (!(container.kind === 228 || container.kind === 198)) { + return undefined; } - function ownsBreakOrContinueStatement(owner, statement) { - var actualOwner = getBreakOrContinueOwner(statement); - return actualOwner && actualOwner === owner; + } + else if (modifier === 83 || modifier === 123) { + if (!(container.kind === 233 || container.kind === 263)) { + return undefined; } - function getBreakOrContinueOwner(statement) { - for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { - switch (node_2.kind) { - case 219: - if (statement.kind === 215) { - continue; - } - case 212: - case 213: - case 214: - case 211: - case 210: - if (!statement.label || isLabeledBy(node_2, statement.label.text)) { - return node_2; - } - break; - default: - if (ts.isFunctionLike(node_2)) { - return undefined; - } - break; - } - } + } + else if (modifier === 116) { + if (!(container.kind === 228 || declaration.kind === 228)) { return undefined; } - function getModifierOccurrences(modifier, declaration) { - var container = declaration.parent; - if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 227 || - container.kind === 197 || - (declaration.kind === 144 && hasKind(container, 150)))) { - return undefined; - } - } - else if (modifier === 114) { - if (!(container.kind === 227 || container.kind === 197)) { - return undefined; - } - } - else if (modifier === 83 || modifier === 123) { - if (!(container.kind === 232 || container.kind === 262)) { - return undefined; - } - } - else if (modifier === 116) { - if (!(container.kind === 227 || declaration.kind === 227)) { - return undefined; - } + } + else { + return undefined; + } + var keywords = []; + var modifierFlag = getFlagFromModifier(modifier); + var nodes; + switch (container.kind) { + case 233: + case 263: + if (modifierFlag & 128) { + nodes = declaration.members.concat(declaration); } else { - return undefined; - } - var keywords = []; - var modifierFlag = getFlagFromModifier(modifier); - var nodes; - switch (container.kind) { - case 232: - case 262: - if (modifierFlag & 128) { - nodes = declaration.members.concat(declaration); - } - else { - nodes = container.statements; - } - break; - case 150: - nodes = container.parameters.concat(container.parent.members); - break; - case 227: - case 197: - nodes = container.members; - if (modifierFlag & 28) { - var constructor = ts.forEach(container.members, function (member) { - return member.kind === 150 && member; - }); - if (constructor) { - nodes = nodes.concat(constructor.parameters); - } - } - else if (modifierFlag & 128) { - nodes = nodes.concat(container); - } - break; - default: - ts.Debug.fail("Invalid container kind."); + nodes = container.statements; } - ts.forEach(nodes, function (node) { - if (ts.getModifierFlags(node) & modifierFlag) { - ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); - } - }); - return ts.map(keywords, getHighlightSpanForNode); - function getFlagFromModifier(modifier) { - switch (modifier) { - case 113: - return 4; - case 111: - return 8; - case 112: - return 16; - case 114: - return 32; - case 83: - return 1; - case 123: - return 2; - case 116: - return 128; - default: - ts.Debug.fail(); + break; + case 151: + nodes = container.parameters.concat(container.parent.members); + break; + case 228: + case 198: + nodes = container.members; + if (modifierFlag & 28) { + var constructor = ts.forEach(container.members, function (member) { + return member.kind === 151 && member; + }); + if (constructor) { + nodes = nodes.concat(constructor.parameters); } } - } - function pushKeywordIf(keywordList, token) { - var expected = []; - for (var _i = 2; _i < arguments.length; _i++) { - expected[_i - 2] = arguments[_i]; - } - if (token && ts.contains(expected, token.kind)) { - keywordList.push(token); - return true; + else if (modifierFlag & 128) { + nodes = nodes.concat(container); } - return false; + break; + default: + ts.Debug.fail("Invalid container kind."); + } + ts.forEach(nodes, function (node) { + if (ts.getModifierFlags(node) & modifierFlag) { + ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); } - function getGetAndSetOccurrences(accessorDeclaration) { - var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 151); - tryPushAccessorKeyword(accessorDeclaration.symbol, 152); - 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, 124, 133); }); - } - } + }); + return keywords; + function getFlagFromModifier(modifier) { + switch (modifier) { + case 113: + return 4; + case 111: + return 8; + case 112: + return 16; + case 114: + return 32; + case 83: + return 1; + case 123: + return 2; + case 116: + return 128; + default: + ts.Debug.fail(); } - function getConstructorOccurrences(constructorDeclaration) { - var declarations = constructorDeclaration.symbol.getDeclarations(); - var keywords = []; - ts.forEach(declarations, function (declaration) { - ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 122); - }); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getLoopBreakContinueOccurrences(loopNode) { - var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87, 105, 80)) { - if (loopNode.kind === 210) { - var loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 105)) { - break; - } - } - } - } - var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71, 76); - } - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { - var owner = getBreakOrContinueOwner(breakOrContinueStatement); - if (owner) { - switch (owner.kind) { - case 212: - case 213: - case 214: - case 210: - case 211: - return getLoopBreakContinueOccurrences(owner); - case 219: - return getSwitchCaseDefaultOccurrences(owner); + } + } + function pushKeywordIf(keywordList, token) { + var expected = []; + for (var _i = 2; _i < arguments.length; _i++) { + expected[_i - 2] = arguments[_i]; + } + if (token && ts.contains(expected, token.kind)) { + keywordList.push(token); + return true; + } + return false; + } + function getGetAndSetOccurrences(accessorDeclaration) { + var keywords = []; + tryPushAccessorKeyword(accessorDeclaration.symbol, 152); + tryPushAccessorKeyword(accessorDeclaration.symbol, 153); + return keywords; + function tryPushAccessorKeyword(accessorSymbol, accessorKind) { + var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); + if (accessor) { + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124, 134); }); + } + } + } + function getConstructorOccurrences(constructorDeclaration) { + var declarations = constructorDeclaration.symbol.getDeclarations(); + var keywords = []; + ts.forEach(declarations, function (declaration) { + ts.forEach(declaration.getChildren(), function (token) { + return pushKeywordIf(keywords, token, 122); + }); + }); + return keywords; + } + function getLoopBreakContinueOccurrences(loopNode) { + var keywords = []; + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87, 105, 80)) { + if (loopNode.kind === 211) { + var loopTokens = loopNode.getChildren(); + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 105)) { + break; } } - return undefined; } - function getSwitchCaseDefaultOccurrences(switchStatement) { - var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 97); - ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 72, 78); - var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71); - } - }); - }); - return ts.map(keywords, getHighlightSpanForNode); + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71, 76); } - function getTryCatchFinallyOccurrences(tryStatement) { - var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 101); - if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73); - } - if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 86); - } - return ts.map(keywords, getHighlightSpanForNode); + }); + return keywords; + } + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 213: + case 214: + case 215: + case 211: + case 212: + return getLoopBreakContinueOccurrences(owner); + case 220: + return getSwitchCaseDefaultOccurrences(owner); } - function getThrowOccurrences(throwStatement) { - var owner = getThrowStatementOwner(throwStatement); - if (!owner) { - return undefined; + } + return undefined; + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 97); + ts.forEach(switchStatement.caseBlock.clauses, function (clause) { + pushKeywordIf(keywords, clause.getFirstToken(), 72, 78); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71); } - var keywords = []; - ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); - }); - if (ts.isFunctionBlock(owner)) { - ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); - }); + }); + }); + return keywords; + } + function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 101); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 86); + } + return keywords; + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); + }); + if (ts.isFunctionBlock(owner)) { + ts.forEachReturnStatement(owner, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); + }); + } + return keywords; + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + if (!(func && hasKind(func.body, 206))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); + }); + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); + }); + return keywords; + } + function getIfElseOccurrences(ifStatement, sourceFile) { + var keywords = []; + while (hasKind(ifStatement.parent, 210) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 89); + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 81)) { + break; } - return ts.map(keywords, getHighlightSpanForNode); } - function getReturnOccurrences(returnStatement) { - var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 205))) { - return undefined; - } - var keywords = []; - ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); - }); - ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getIfElseOccurrences(ifStatement) { - var keywords = []; - while (hasKind(ifStatement.parent, 209) && ifStatement.parent.elseStatement === ifStatement) { - ifStatement = ifStatement.parent; - } - while (ifStatement) { - var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 89); - for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 81)) { - break; - } - } - if (!hasKind(ifStatement.elseStatement, 209)) { + if (!hasKind(ifStatement.elseStatement, 210)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 81 && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; + var shouldCombindElseAndIf = true; + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { + shouldCombindElseAndIf = false; break; } - ifStatement = ifStatement.elseStatement; } - var result = []; - for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 81 && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; - var shouldCombindElseAndIf = true; - for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { - if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { - shouldCombindElseAndIf = false; - break; - } - } - if (shouldCombindElseAndIf) { - result.push({ - fileName: fileName, - textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), - kind: ts.HighlightSpanKind.reference - }); - i++; - continue; - } - } - result.push(getHighlightSpanForNode(keywords[i])); + if (shouldCombindElseAndIf) { + result.push({ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + kind: ts.HighlightSpanKind.reference + }); + i++; + continue; } - return result; } + result.push(getHighlightSpanForNode(keywords[i], sourceFile)); } + return result; } - DocumentHighlights.getDocumentHighlights = getDocumentHighlights; function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 220; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 221; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -56748,15 +57060,15 @@ var ts; return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); } function getBucketForCompilationSettings(key, createIfMissing) { - var bucket = buckets[key]; + var bucket = buckets.get(key); if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(); + buckets.set(key, bucket = ts.createFileMap()); } return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { - var entries = buckets[name]; + var bucketInfoArray = ts.arrayFrom(buckets.keys()).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { + var entries = buckets.get(name); var sourceFiles = []; entries.forEachValue(function (key, entry) { sourceFiles.push({ @@ -56844,869 +57156,931 @@ var ts; (function (ts) { var FindAllReferences; (function (FindAllReferences) { - function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) { + function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments, isForRename) { var node = ts.getTouchingPropertyName(sourceFile, position, true); - if (node === sourceFile) { - return undefined; - } - switch (node.kind) { - case 8: - if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - break; - } - case 70: - case 98: - case 122: - case 9: - return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, false); - } - return undefined; + return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, isForRename); } FindAllReferences.findReferencedSymbols = findReferencedSymbols; - function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) { + function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, isForRename, implementations) { if (!implementations) { - if (ts.isLabelName(node)) { - if (ts.isJumpStatementTarget(node)) { - var labelDefinition = ts.getTargetLabel(node.parent, node.text); - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; - } - else { - return getLabelReferencesInNode(node.parent, node); - } - } - if (ts.isThis(node)) { - return getReferencesForThisKeyword(node, sourceFiles); - } - if (node.kind === 96) { - return getReferencesForSuperKeyword(node); + var special = getReferencedSymbolsSpecial(node, sourceFiles, typeChecker, cancellationToken); + if (special) { + return special; } } var symbol = typeChecker.getSymbolAtLocation(node); - if (!implementations && !symbol && node.kind === 9) { - return getReferencesForStringLiteral(node, sourceFiles); - } if (!symbol) { + if (!implementations && node.kind === 9) { + return getReferencesForStringLiteral(node, sourceFiles, typeChecker, cancellationToken); + } return undefined; } var declarations = symbol.declarations; if (!declarations || !declarations.length) { return undefined; } - var result; + var _a = followAliases(symbol, node, typeChecker, isForRename), aliasedSymbol = _a.symbol, shorthandModuleSymbol = _a.shorthandModuleSymbol; + symbol = aliasedSymbol; + var searchSymbols = populateSearchSymbolSet(symbol, node, typeChecker, implementations); + if (shorthandModuleSymbol) { + searchSymbols.push(shorthandModuleSymbol); + } var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations); + var result = []; + var symbolToIndex = []; + var inheritsFromCache = ts.createMap(); var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); var scope = getSymbolScope(symbol); - var symbolToIndex = []; if (scope) { - result = []; - getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + getRefs(scope, declaredName); } else { - var internedName = getInternedName(symbol, node); - for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { - var sourceFile = sourceFiles_8[_i]; + var isDefault = ts.isExportDefaultSymbol(symbol); + var internedName = isDefault ? symbol.valueDeclaration.localSymbol.name : getInternedName(symbol, node); + for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { + var sourceFile = sourceFiles_7[_i]; cancellationToken.throwIfCancellationRequested(); - var nameTable = ts.getNameTable(sourceFile); - if (nameTable[internedName] !== undefined) { - result = result || []; - getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + var searchName = (isDefault ? getDefaultImportName(symbol, sourceFile, typeChecker) : undefined) || + (sourceFileHasName(sourceFile, internedName) ? declaredName : undefined); + if (searchName !== undefined) { + getRefs(sourceFile, searchName); } } } return result; - function getDefinition(symbol) { - var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node); - var name = ts.map(info.displayParts, function (p) { return p.text; }).join(""); - var declarations = symbol.declarations; - if (!declarations || declarations.length === 0) { - return undefined; + function getRefs(scope, searchName) { + getReferencesInNode(scope, symbol, searchName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex, implementations, typeChecker, cancellationToken, searchSymbols, inheritsFromCache); + } + } + FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; + function getReferencedSymbolsSpecial(node, sourceFiles, typeChecker, cancellationToken) { + if (ts.isTypeKeyword(node.kind)) { + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken); + } + if (ts.isLabelName(node)) { + if (ts.isJumpStatementTarget(node)) { + var labelDefinition = ts.getTargetLabel(node.parent, node.text); + return labelDefinition && getLabelReferencesInNode(labelDefinition.parent, labelDefinition, cancellationToken); + } + else { + return getLabelReferencesInNode(node.parent, node, cancellationToken); } - return { - containerKind: "", - containerName: "", - name: name, - kind: info.symbolKind, - fileName: declarations[0].getSourceFile().fileName, - textSpan: ts.createTextSpan(declarations[0].getStart(), 0), - displayParts: info.displayParts - }; } - function getAliasSymbolForPropertyNameSymbol(symbol, location) { - if (symbol.flags & 8388608) { - var defaultImport = ts.getDeclarationOfKind(symbol, 237); - if (defaultImport) { - return typeChecker.getAliasedSymbol(symbol); - } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 240 || - declaration.kind === 244) ? declaration : undefined; }); - if (importOrExportSpecifier && - (!importOrExportSpecifier.propertyName || - importOrExportSpecifier.propertyName === location)) { - return importOrExportSpecifier.kind === 240 ? - typeChecker.getAliasedSymbol(symbol) : - typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); - } + if (ts.isThis(node)) { + return getReferencesForThisKeyword(node, sourceFiles, typeChecker, cancellationToken); + } + if (node.kind === 96) { + return getReferencesForSuperKeyword(node, typeChecker, cancellationToken); + } + return undefined; + } + function followAliases(symbol, node, typeChecker, isForRename) { + while (true) { + if (isForRename && isImportDefaultSymbol(symbol)) { + return { symbol: symbol }; + } + var aliasedSymbol = getAliasSymbolForPropertyNameSymbol(symbol, node, typeChecker); + if (!aliasedSymbol || !aliasedSymbol.declarations) { + return { symbol: symbol }; + } + if (ts.isShorthandAmbientModuleSymbol(aliasedSymbol)) { + return { symbol: symbol, shorthandModuleSymbol: aliasedSymbol }; } + symbol = aliasedSymbol; + } + } + function sourceFileHasName(sourceFile, name) { + return ts.getNameTable(sourceFile).get(name) !== undefined; + } + function getDefaultImportName(symbol, sourceFile, checker) { + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var importSpecifier = _a[_i]; + var importDecl = importSpecifier.parent; + ts.Debug.assert(importDecl.moduleSpecifier === importSpecifier); + var defaultName = importDecl.importClause.name; + var defaultReferencedSymbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName)); + if (symbol === defaultReferencedSymbol) { + return defaultName.text; + } + } + return undefined; + } + function getDefinition(symbol, node, typeChecker) { + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node), displayParts = _a.displayParts, symbolKind = _a.symbolKind; + var name = displayParts.map(function (p) { return p.text; }).join(""); + var declarations = symbol.declarations; + if (!declarations || declarations.length === 0) { return undefined; } - function followAliasIfNecessary(symbol, location) { - return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol; + return { + containerKind: "", + containerName: "", + name: name, + kind: symbolKind, + fileName: declarations[0].getSourceFile().fileName, + textSpan: ts.createTextSpan(declarations[0].getStart(), 0), + displayParts: displayParts + }; + } + function getAliasSymbolForPropertyNameSymbol(symbol, location, typeChecker) { + if (!(symbol.flags & 8388608)) { + return undefined; + } + var defaultImport = ts.getDeclarationOfKind(symbol, 238); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); + } + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 241 || + declaration.kind === 245) ? declaration : undefined; }); + if (importOrExportSpecifier && + (!importOrExportSpecifier.propertyName || + importOrExportSpecifier.propertyName === location)) { + return importOrExportSpecifier.kind === 241 ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); } - function getPropertySymbolOfDestructuringAssignment(location) { - return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && - typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + function followAliasIfNecessary(symbol, location, typeChecker) { + return getAliasSymbolForPropertyNameSymbol(symbol, location, typeChecker) || symbol; + } + function getPropertySymbolOfDestructuringAssignment(location, typeChecker) { + return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + function isObjectBindingPatternElementWithoutPropertyName(symbol) { + var bindingElement = ts.getDeclarationOfKind(symbol, 175); + return bindingElement && + bindingElement.parent.kind === 173 && + !bindingElement.propertyName; + } + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, typeChecker) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + var bindingElement = ts.getDeclarationOfKind(symbol, 175); + var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); } - function isObjectBindingPatternElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174); - return bindingElement && - bindingElement.parent.kind === 172 && - !bindingElement.propertyName; + return undefined; + } + function getInternedName(symbol, location) { + if (ts.isImportOrExportSpecifierName(location)) { + return location.text; + } + return ts.stripQuotes(symbol.name); + } + function getSymbolScope(symbol) { + var valueDeclaration = symbol.valueDeclaration; + if (valueDeclaration && (valueDeclaration.kind === 185 || valueDeclaration.kind === 198)) { + return valueDeclaration; } - function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174); - var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); - return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + if (symbol.flags & (4 | 8192)) { + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8) ? d : undefined; }); + if (privateDeclaration) { + return ts.getAncestor(privateDeclaration, 228); } + } + if (symbol.flags & 8388608) { return undefined; } - function getInternedName(symbol, location) { - if (ts.isImportOrExportSpecifierName(location)) { - return location.getText(); - } - var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - symbol = localExportDefaultSymbol || symbol; - return ts.stripQuotes(symbol.name); + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + return undefined; } - function getSymbolScope(symbol) { - var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 184 || valueDeclaration.kind === 197)) { - return valueDeclaration; - } - if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8) ? d : undefined; }); - if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 227); + if (symbol.parent || (symbol.flags & 268435456)) { + return undefined; + } + var scope; + var declarations = symbol.getDeclarations(); + if (declarations) { + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + var container = ts.getContainerNode(declaration); + if (!container) { + return undefined; } + if (scope && scope !== container) { + return undefined; + } + if (container.kind === 263 && !ts.isExternalModule(container)) { + return undefined; + } + scope = container; } - if (symbol.flags & 8388608) { - return undefined; - } - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - return undefined; + } + return scope; + } + function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end, cancellationToken) { + var positions = []; + if (!symbolName || !symbolName.length) { + return positions; + } + var text = sourceFile.text; + var sourceLength = text.length; + var symbolNameLength = symbolName.length; + var position = text.indexOf(symbolName, start); + while (position >= 0) { + cancellationToken.throwIfCancellationRequested(); + if (position > end) + break; + var endPosition = position + symbolNameLength; + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5))) { + positions.push(position); } - if (symbol.parent || (symbol.flags & 268435456)) { - return undefined; + position = text.indexOf(symbolName, position + symbolNameLength + 1); + } + return positions; + } + function getLabelReferencesInNode(container, targetLabel, cancellationToken) { + var references = []; + var sourceFile = container.getSourceFile(); + var labelName = targetLabel.text; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd(), cancellationToken); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.getWidth() !== labelName.length) { + return; } - var scope; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; - var container = ts.getContainerNode(declaration); - if (!container) { - return undefined; - } - if (scope && scope !== container) { - return undefined; - } - if (container.kind === 262 && !ts.isExternalModule(container)) { - return undefined; - } - scope = container; - } + if (node === targetLabel || + (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { + references.push(getReferenceEntryFromNode(node)); } - return scope; + }); + var definition = { + containerKind: "", + containerName: "", + fileName: targetLabel.getSourceFile().fileName, + kind: ts.ScriptElementKind.label, + name: labelName, + textSpan: ts.createTextSpanFromNode(targetLabel, sourceFile), + displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] + }; + return [{ definition: definition, references: references }]; + } + function isValidReferencePosition(node, searchSymbolName) { + switch (node && node.kind) { + case 70: + return node.getWidth() === searchSymbolName.length; + case 9: + return (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) && + node.getWidth() === searchSymbolName.length + 2; + case 8: + return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.getWidth() === searchSymbolName.length; + default: + return false; + } + } + function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) { + var name = ts.tokenToString(keywordKind); + var definition = { + containerKind: "", + containerName: "", + fileName: "", + kind: ts.ScriptElementKind.keyword, + name: name, + textSpan: ts.createTextSpan(0, 1), + displayParts: [{ text: name, kind: ts.ScriptElementKind.keyword }] + }; + var references = []; + for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { + var sourceFile = sourceFiles_8[_i]; + cancellationToken.throwIfCancellationRequested(); + addReferencesForKeywordInFile(sourceFile, keywordKind, name, cancellationToken, references); } - function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { - var positions = []; - if (!symbolName || !symbolName.length) { - return positions; + return [{ definition: definition, references: references }]; + } + function addReferencesForKeywordInFile(sourceFile, kind, searchText, cancellationToken, references) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; + cancellationToken.throwIfCancellationRequested(); + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (referenceLocation.kind === kind) { + references.push({ + textSpan: ts.createTextSpanFromNode(referenceLocation), + fileName: sourceFile.fileName, + isWriteAccess: false, + isDefinition: false, + }); } - var text = sourceFile.text; - var sourceLength = text.length; - var symbolNameLength = symbolName.length; - var position = text.indexOf(symbolName, start); - while (position >= 0) { - cancellationToken.throwIfCancellationRequested(); - if (position > end) - break; - var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5)) && - (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5))) { - positions.push(position); + } + } + function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex, implementations, typeChecker, cancellationToken, searchSymbols, inheritsFromCache) { + var sourceFile = container.getSourceFile(); + var start = findInComments ? container.getFullStart() : container.getStart(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd(), cancellationToken); + var parents = getParentSymbolsOfPropertyAccess(); + for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) { + var position = possiblePositions_2[_i]; + cancellationToken.throwIfCancellationRequested(); + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (!isValidReferencePosition(referenceLocation, searchText)) { + if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || + (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) { + result.push({ + definition: undefined, + references: [{ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpan(position, searchText.length), + isWriteAccess: false, + isDefinition: false + }] + }); } - position = text.indexOf(symbolName, position + symbolNameLength + 1); + continue; } - return positions; - } - function getLabelReferencesInNode(container, targetLabel) { - var references = []; - var sourceFile = container.getSourceFile(); - var labelName = targetLabel.text; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.getWidth() !== labelName.length) { - return; + if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { + continue; + } + var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); + if (referenceSymbol) { + var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; + var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); + var relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocation.kind === 122, parents, inheritsFromCache, typeChecker); + if (relatedSymbol) { + addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); } - if (node === targetLabel || - (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { - references.push(getReferenceEntryFromNode(node)); + else if (!(referenceSymbol.flags & 67108864) && ts.contains(searchSymbols, shorthandValueSymbol)) { + addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); } - }); - var definition = { - containerKind: "", - containerName: "", - fileName: targetLabel.getSourceFile().fileName, - kind: ts.ScriptElementKind.label, - name: labelName, - textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()), - displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] - }; - return [{ definition: definition, references: references }]; - } - function isValidReferencePosition(node, searchSymbolName) { - if (node) { - switch (node.kind) { - case 70: - return node.getWidth() === searchSymbolName.length; - case 9: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - return node.getWidth() === searchSymbolName.length + 2; - } - break; - case 8: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - return node.getWidth() === searchSymbolName.length; - } - break; + else if (searchLocation.kind === 122) { + findAdditionalConstructorReferences(referenceSymbol, referenceLocation); } } - return false; } - function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) { - var sourceFile = container.getSourceFile(); - var start = findInComments ? container.getFullStart() : container.getStart(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd()); - var parents = getParentSymbolsOfPropertyAccess(); - var inheritsFromCache = ts.createMap(); - if (possiblePositions.length) { - var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); - if (!isValidReferencePosition(referenceLocation, searchText)) { - if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || - (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) { - result.push({ - definition: undefined, - references: [{ - fileName: sourceFile.fileName, - textSpan: ts.createTextSpan(position, searchText.length), - isWriteAccess: false, - isDefinition: false - }] - }); - } - return; - } - if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { - return; - } - var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); - if (referenceSymbol) { - var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); - var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, searchLocation.kind === 122, parents, inheritsFromCache); - if (relatedSymbol) { - addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); - } - else if (!(referenceSymbol.flags & 67108864) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { - addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); - } - else if (searchLocation.kind === 122) { - findAdditionalConstructorReferences(referenceSymbol, referenceLocation); + return; + function getParentSymbolsOfPropertyAccess() { + if (implementations) { + var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); + if (propertyAccessExpression) { + var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); + if (localParentType) { + if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== searchSymbol.parent) { + return [localParentType.symbol]; } - } - }); - } - return; - function getParentSymbolsOfPropertyAccess() { - if (implementations) { - var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); - if (propertyAccessExpression) { - var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); - if (localParentType) { - if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== searchSymbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 196608) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } + else if (localParentType.flags & 196608) { + return getSymbolsForClassAndInterfaceComponents(localParentType); } } } } - function getPropertyAccessExpressionFromRightHandSide(node) { - return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { + ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); + var referenceClass = referenceLocation.parent; + if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { + ts.Debug.assert(referenceClass.name === referenceLocation); + addReferences(findOwnConstructorCalls(searchSymbol, sourceFile)); } - function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { - ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); - var referenceClass = referenceLocation.parent; - if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { - ts.Debug.assert(referenceClass.name === referenceLocation); - addReferences(findOwnConstructorCalls(searchSymbol)); - } - else { - var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); - if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) { - addReferences(superConstructorAccesses(classExtending)); - } + else { + var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); + if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation, typeChecker) === searchSymbol) { + addReferences(superConstructorAccesses(classExtending)); } } - function addReferences(references) { - if (references.length) { - var referencedSymbol = getReferencedSymbol(searchSymbol); - ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); - } + } + function addReferences(references) { + if (references.length) { + var referencedSymbol = getReferencedSymbol(searchSymbol); + ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); } - function findOwnConstructorCalls(classSymbol) { - var result = []; - for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150); - var ctrKeyword = decl.getChildAt(0); - ts.Debug.assert(ctrKeyword.kind === 122); - result.push(ctrKeyword); - } - ts.forEachProperty(classSymbol.exports, function (member) { - var decl = member.valueDeclaration; - if (decl && decl.kind === 149) { - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 98, function (thisKeyword) { - if (ts.isNewExpressionTarget(thisKeyword)) { - result.push(thisKeyword); - } - }); - } - } + } + function getReferencedSymbol(symbol) { + var symbolId = ts.getSymbolId(symbol); + var index = symbolToIndex[symbolId]; + if (index === undefined) { + index = result.length; + symbolToIndex[symbolId] = index; + result.push({ + definition: getDefinition(symbol, searchLocation, typeChecker), + references: [] }); - return result; } - function superConstructorAccesses(cls) { - var symbol = cls.symbol; - var ctr = symbol.members["__constructor"]; - if (!ctr) { - return []; - } - var result = []; - for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150); - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 96, function (node) { - if (ts.isCallExpressionTarget(node)) { - result.push(node); - } - }); - } - } - ; - return result; + return result[index]; + } + function addReferenceToRelatedSymbol(node, relatedSymbol) { + var references = getReferencedSymbol(relatedSymbol).references; + if (implementations) { + getImplementationReferenceEntryForNode(node, references, typeChecker); } - function getReferencedSymbol(symbol) { - var symbolId = ts.getSymbolId(symbol); - var index = symbolToIndex[symbolId]; - if (index === undefined) { - index = result.length; - symbolToIndex[symbolId] = index; - result.push({ - definition: getDefinition(symbol), - references: [] + else { + references.push(getReferenceEntryFromNode(node)); + } + } + } + function getPropertyAccessExpressionFromRightHandSide(node) { + return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + function findOwnConstructorCalls(classSymbol, sourceFile) { + var result = []; + for (var _i = 0, _a = classSymbol.members.get("__constructor").declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var ctrKeyword = ts.findChildOfKind(decl, 122, sourceFile); + ts.Debug.assert(decl.kind === 151 && !!ctrKeyword); + result.push(ctrKeyword); + } + classSymbol.exports.forEach(function (member) { + var decl = member.valueDeclaration; + if (decl && decl.kind === 150) { + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 98, function (thisKeyword) { + if (ts.isNewExpressionTarget(thisKeyword)) { + result.push(thisKeyword); + } }); } - return result[index]; } - function addReferenceToRelatedSymbol(node, relatedSymbol) { - var references = getReferencedSymbol(relatedSymbol).references; - if (implementations) { - getImplementationReferenceEntryForNode(node, references); - } - else { - references.push(getReferenceEntryFromNode(node)); - } + }); + return result; + } + function superConstructorAccesses(cls) { + var symbol = cls.symbol; + var ctr = symbol.members.get("__constructor"); + if (!ctr) { + return []; + } + var result = []; + for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts.Debug.assert(decl.kind === 151); + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 96, function (node) { + if (ts.isCallExpressionTarget(node)) { + result.push(node); + } + }); } } - function getImplementationReferenceEntryForNode(refNode, result) { - if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { - result.push(getReferenceEntryFromNode(refNode.parent)); + ; + return result; + } + function getImplementationReferenceEntryForNode(refNode, result, typeChecker) { + if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { + result.push(getReferenceEntryFromNode(refNode.parent)); + } + else if (refNode.kind === 70) { + if (refNode.parent.kind === 260) { + getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); } - else if (refNode.kind === 70) { - if (refNode.parent.kind === 259) { - getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); - } - var containingClass = getContainingClassIfInHeritageClause(refNode); - if (containingClass) { - result.push(getReferenceEntryFromNode(containingClass)); - return; - } - var containingTypeReference = getContainingTypeReference(refNode); - if (containingTypeReference) { - var parent_19 = containingTypeReference.parent; - if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); - } - else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { - if (parent_19.body.kind === 205) { - ts.forEachReturnStatement(parent_19.body, function (returnStatement) { - if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { - maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); - } - }); - } - else if (isImplementationExpression(parent_19.body)) { - maybeAdd(getReferenceEntryFromNode(parent_19.body)); - } + var containingClass = getContainingClassIfInHeritageClause(refNode); + if (containingClass) { + result.push(getReferenceEntryFromNode(containingClass)); + return; + } + var containingTypeReference = getContainingTypeReference(refNode); + if (containingTypeReference) { + var parent = containingTypeReference.parent; + if (ts.isVariableLike(parent) && parent.type === containingTypeReference && parent.initializer && isImplementationExpression(parent.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent.initializer)); + } + else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { + if (parent.body.kind === 206) { + ts.forEachReturnStatement(parent.body, function (returnStatement) { + if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { + maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); + } + }); } - else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_19.expression)); + else if (isImplementationExpression(parent.body)) { + maybeAdd(getReferenceEntryFromNode(parent.body)); } } - } - function maybeAdd(a) { - if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { - result.push(a); + else if (ts.isAssertionExpression(parent) && isImplementationExpression(parent.expression)) { + maybeAdd(getReferenceEntryFromNode(parent.expression)); } } } - function getSymbolsForClassAndInterfaceComponents(type, result) { - if (result === void 0) { result = []; } - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var componentType = _a[_i]; - if (componentType.symbol && componentType.symbol.getFlags() & (32 | 64)) { - result.push(componentType.symbol); - } - if (componentType.getFlags() & 196608) { - getSymbolsForClassAndInterfaceComponents(componentType, result); - } + function maybeAdd(a) { + if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { + result.push(a); } - return result; } - function getContainingTypeReference(node) { - var topLevelTypeReference = undefined; - while (node) { - if (ts.isTypeNode(node)) { - topLevelTypeReference = node; - } - node = node.parent; + } + function getSymbolsForClassAndInterfaceComponents(type, result) { + if (result === void 0) { result = []; } + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var componentType = _a[_i]; + if (componentType.symbol && componentType.symbol.getFlags() & (32 | 64)) { + result.push(componentType.symbol); + } + if (componentType.getFlags() & 196608) { + getSymbolsForClassAndInterfaceComponents(componentType, result); } - return topLevelTypeReference; } - function getContainingClassIfInHeritageClause(node) { - if (node && node.parent) { - if (node.kind === 199 - && node.parent.kind === 256 - && ts.isClassLike(node.parent.parent)) { - return node.parent.parent; - } - else if (node.kind === 70 || node.kind === 177) { - return getContainingClassIfInHeritageClause(node.parent); - } + return result; + } + function getContainingTypeReference(node) { + var topLevelTypeReference = undefined; + while (node) { + if (ts.isTypeNode(node)) { + topLevelTypeReference = node; + } + node = node.parent; + } + return topLevelTypeReference; + } + function getContainingClassIfInHeritageClause(node) { + if (node && node.parent) { + if (node.kind === 200 + && node.parent.kind === 257 + && ts.isClassLike(node.parent.parent)) { + return node.parent.parent; + } + else if (node.kind === 70 || node.kind === 178) { + return getContainingClassIfInHeritageClause(node.parent); } - return undefined; } - function isImplementationExpression(node) { - if (node.kind === 183) { + return undefined; + } + function isImplementationExpression(node) { + switch (node.kind) { + case 184: return isImplementationExpression(node.expression); + case 186: + case 185: + case 177: + case 198: + case 176: + return true; + default: + return false; + } + } + function explicitlyInheritsFrom(child, parent, cachedResults, typeChecker) { + var parentIsInterface = parent.getFlags() & 64; + return searchHierarchy(child); + function searchHierarchy(symbol) { + if (symbol === parent) { + return true; } - return node.kind === 185 || - node.kind === 184 || - node.kind === 176 || - node.kind === 197 || - node.kind === 175; - } - function explicitlyInheritsFrom(child, parent, cachedResults) { - var parentIsInterface = parent.getFlags() & 64; - return searchHierarchy(child); - function searchHierarchy(symbol) { - if (symbol === parent) { - return true; - } - var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); - if (key in cachedResults) { - return cachedResults[key]; - } - cachedResults[key] = false; - var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { - if (ts.isClassLike(declaration)) { - if (parentIsInterface) { - var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration); - if (interfaceReferences) { - for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) { - var typeReference = interfaceReferences_1[_i]; - if (searchTypeReference(typeReference)) { - return true; - } + var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); + var cached = cachedResults.get(key); + if (cached !== undefined) { + return cached; + } + cachedResults.set(key, false); + var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { + if (ts.isClassLike(declaration)) { + if (parentIsInterface) { + var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration); + if (interfaceReferences) { + for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) { + var typeReference = interfaceReferences_1[_i]; + if (searchTypeReference(typeReference)) { + return true; } } } - return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); - } - else if (declaration.kind === 228) { - if (parentIsInterface) { - return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); - } } - return false; - }); - cachedResults[key] = inherits; - return inherits; - } - function searchTypeReference(typeReference) { - if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); - if (type && type.symbol) { - return searchHierarchy(type.symbol); + return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + } + else if (declaration.kind === 229) { + if (parentIsInterface) { + return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } } return false; + }); + cachedResults.set(key, inherits); + return inherits; + } + function searchTypeReference(typeReference) { + if (typeReference) { + var type = typeChecker.getTypeAtLocation(typeReference); + if (type && type.symbol) { + return searchHierarchy(type.symbol); + } } + return false; } - function getReferencesForSuperKeyword(superKeyword) { - var searchSpaceNode = ts.getSuperContainer(superKeyword, false); - if (!searchSpaceNode) { + } + function getReferencesForSuperKeyword(superKeyword, typeChecker, cancellationToken) { + var searchSpaceNode = ts.getSuperContainer(superKeyword, false); + if (!searchSpaceNode) { + return undefined; + } + var staticFlag = 32; + switch (searchSpaceNode.kind) { + case 148: + case 147: + case 150: + case 149: + case 151: + case 152: + case 153: + staticFlag &= ts.getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; + break; + default: return undefined; + } + var references = []; + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd(), cancellationToken); + for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) { + var position = possiblePositions_3[_i]; + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 96) { + continue; } - var staticFlag = 32; - switch (searchSpaceNode.kind) { - case 147: - case 146: - case 149: - case 148: - case 150: - case 151: - case 152: - staticFlag &= ts.getModifierFlags(searchSpaceNode); - searchSpaceNode = searchSpaceNode.parent; + var container = ts.getSuperContainer(node, false); + if (container && (32 & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + references.push(getReferenceEntryFromNode(node)); + } + } + var definition = getDefinition(searchSpaceNode.symbol, superKeyword, typeChecker); + return [{ definition: definition, references: references }]; + } + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, typeChecker, cancellationToken) { + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); + var staticFlag = 32; + switch (searchSpaceNode.kind) { + case 150: + case 149: + if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; - default: + } + case 148: + case 147: + case 151: + case 152: + case 153: + staticFlag &= ts.getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; + break; + case 263: + if (ts.isExternalModule(searchSpaceNode)) { return undefined; - } - var references = []; + } + case 227: + case 185: + break; + default: + return undefined; + } + var references = []; + var possiblePositions; + if (searchSpaceNode.kind === 263) { + ts.forEach(sourceFiles, function (sourceFile) { + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); + }); + } + else { var sourceFile = searchSpaceNode.getSourceFile(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd(), cancellationToken); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); + } + var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); + var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: thisOrSuperKeyword.getSourceFile().fileName, + kind: ts.ScriptElementKind.variableElement, + name: "this", + textSpan: ts.createTextSpanFromNode(thisOrSuperKeyword), + displayParts: displayParts + }, + references: references + }]; + function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 96) { + if (!node || !ts.isThis(node)) { return; } - var container = ts.getSuperContainer(node, false); - if (container && (32 & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - references.push(getReferenceEntryFromNode(node)); + var container = ts.getThisContainer(node, false); + switch (searchSpaceNode.kind) { + case 185: + case 227: + if (searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 150: + case 149: + if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 198: + case 228: + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 263: + if (container.kind === 263 && !ts.isExternalModule(container)) { + result.push(getReferenceEntryFromNode(node)); + } + break; } }); - var definition = getDefinition(searchSpaceNode.symbol); - return [{ definition: definition, references: references }]; } - function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { - var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); - var staticFlag = 32; - switch (searchSpaceNode.kind) { - case 149: - case 148: - if (ts.isObjectLiteralMethod(searchSpaceNode)) { - break; - } - case 147: - case 146: - case 150: - case 151: - case 152: - staticFlag &= ts.getModifierFlags(searchSpaceNode); - searchSpaceNode = searchSpaceNode.parent; - break; - case 262: - if (ts.isExternalModule(searchSpaceNode)) { - return undefined; - } - case 226: - case 184: - break; - default: - return undefined; - } - var references = []; - var possiblePositions; - if (searchSpaceNode.kind === 262) { - ts.forEach(sourceFiles, function (sourceFile) { - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); - getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); - }); - } - else { - var sourceFile = searchSpaceNode.getSourceFile(); - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); - } - var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); - var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: "this", - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: displayParts - }, - references: references - }]; - function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || !ts.isThis(node)) { - return; - } - var container = ts.getThisContainer(node, false); - switch (searchSpaceNode.kind) { - case 184: - case 226: - if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 149: - case 148: - if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 197: - case 227: - if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 262: - if (container.kind === 262 && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); - } - break; - } - }); - } + } + function getReferencesForStringLiteral(node, sourceFiles, typeChecker, cancellationToken) { + var type = ts.getStringLiteralTypeForNode(node, typeChecker); + if (!type) { + return undefined; } - function getReferencesForStringLiteral(node, sourceFiles) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (!type) { - return undefined; - } - var references = []; - for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { - var sourceFile = sourceFiles_9[_i]; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); - getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); - } - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: type.text, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] - }, - references: references - }]; - function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { - for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { - var position = possiblePositions_1[_i]; - cancellationToken.throwIfCancellationRequested(); - var node_3 = ts.getTouchingWord(sourceFile, position); - if (!node_3 || node_3.kind !== 9) { - return; - } - var type_1 = ts.getStringLiteralTypeForNode(node_3, typeChecker); - if (type_1 === searchType) { - references.push(getReferenceEntryFromNode(node_3)); - } + var references = []; + for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { + var sourceFile = sourceFiles_9[_i]; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ts.ScriptElementKind.variableElement, + name: type.text, + textSpan: ts.createTextSpanFromNode(node), + displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] + }, + references: references + }]; + function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { + for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { + var position = possiblePositions_4[_i]; + cancellationToken.throwIfCancellationRequested(); + var node_2 = ts.getTouchingWord(sourceFile, position); + if (!node_2 || node_2.kind !== 9) { + return; } - } - } - function populateSearchSymbolSet(symbol, location) { - var result = [symbol]; - var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 259) { - var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); - if (propertySymbol) { - result.push(propertySymbol); + var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + if (type_2 === searchType) { + references.push(getReferenceEntryFromNode(node_2)); } } - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); - if (aliasSymbol) { - result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); + } + } + function populateSearchSymbolSet(symbol, location, typeChecker, implementations) { + var result = [symbol]; + var containingObjectLiteralElement = getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 260) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, typeChecker); + if (propertySymbol) { + result.push(propertySymbol); } - if (containingObjectLiteralElement) { - ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); - }); - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); - if (shorthandValueSymbol) { - result.push(shorthandValueSymbol); - } + } + if (containingObjectLiteralElement) { + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, typeChecker), function (contextualSymbol) { + ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); + }); + var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol) { + result.push(shorthandValueSymbol); } - if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 && - ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { - result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 145 && + ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { + ts.addRange(result, typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, typeChecker); + if (bindingElementPropertySymbol) { + result.push(bindingElementPropertySymbol); + } + for (var _i = 0, _a = typeChecker.getRootSymbols(symbol); _i < _a.length; _i++) { + var rootSymbol = _a[_i]; + if (rootSymbol !== symbol) { + result.push(rootSymbol); } - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); - if (bindingElementPropertySymbol) { - result.push(bindingElementPropertySymbol); + if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap(), typeChecker); } - ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { - if (rootSymbol !== symbol) { - result.push(rootSymbol); + } + return result; + } + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, typeChecker) { + if (!symbol) { + return; + } + if (previousIterationSymbolsCache.has(symbol.name)) { + return; + } + if (symbol.flags & (32 | 64)) { + ts.forEach(symbol.getDeclarations(), function (declaration) { + if (ts.isClassLike(declaration)) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap()); + else if (declaration.kind === 229) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); - return result; } - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { - if (!symbol) { - return; - } - if (symbol.name in previousIterationSymbolsCache) { - return; - } - if (symbol.flags & (32 | 64)) { - ts.forEach(symbol.getDeclarations(), function (declaration) { - if (ts.isClassLike(declaration)) { - getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); - ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); - } - else if (declaration.kind === 228) { - ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); - } - }); - } - return; - function getPropertySymbolFromTypeReference(typeReference) { - if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); - if (type) { - var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); - if (propertySymbol) { - result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); - } - previousIterationSymbolsCache[symbol.name] = symbol; - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); + return; + function getPropertySymbolFromTypeReference(typeReference) { + if (typeReference) { + var type = typeChecker.getTypeAtLocation(typeReference); + if (type) { + var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); + if (propertySymbol) { + result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); } + previousIterationSymbolsCache.set(symbol.name, symbol); + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, typeChecker); } } } - function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) { - if (ts.contains(searchSymbols, referenceSymbol)) { - return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol; - } - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); - if (aliasSymbol) { - return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache); + } + function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache, typeChecker) { + if (ts.contains(searchSymbols, referenceSymbol)) { + return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) ? referenceSymbol : undefined; + } + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation, typeChecker); + if (aliasSymbol) { + return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache, typeChecker); + } + var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + if (containingObjectLiteralElement) { + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, typeChecker), function (contextualSymbol) { + return ts.find(typeChecker.getRootSymbols(contextualSymbol), function (symbol) { return ts.contains(searchSymbols, symbol); }); + }); + if (contextualSymbol) { + return contextualSymbol; } - var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); - if (containingObjectLiteralElement) { - var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); - }); - if (contextualSymbol) { - return contextualSymbol; - } - var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); - if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { - return propertySymbol; - } + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, typeChecker); + if (propertySymbol && ts.contains(searchSymbols, propertySymbol)) { + return propertySymbol; } - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); - if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { - return bindingElementPropertySymbol; + } + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, typeChecker); + if (bindingElementPropertySymbol && ts.contains(searchSymbols, bindingElementPropertySymbol)) { + return bindingElementPropertySymbol; + } + return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { + if (ts.contains(searchSymbols, rootSymbol)) { + return rootSymbol; } - return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { - if (searchSymbols.indexOf(rootSymbol) >= 0) { - return rootSymbol; - } - if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - if (parents) { - if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) { - return undefined; - } + if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { + if (parents) { + if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache, typeChecker); })) { + return undefined; } - var result_4 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, ts.createMap()); - return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); - } - return undefined; - }); - } - function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 142) { - var nameExpression = node.name.expression; - if (ts.isStringOrNumericLiteral(nameExpression)) { - return nameExpression.text; } - return undefined; + var result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap(), typeChecker); + return ts.find(result, function (symbol) { return ts.contains(searchSymbols, symbol); }); } - return node.name.text; - } - function getPropertySymbolsFromContextualType(node) { - var objectLiteral = node.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); - var name = getNameFromObjectLiteralElement(node); - if (name && contextualType) { - var result_5 = []; - var symbol_2 = contextualType.getProperty(name); - if (symbol_2) { - result_5.push(symbol_2); - } - if (contextualType.flags & 65536) { - ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name); - if (symbol) { - result_5.push(symbol); - } - }); - } - return result_5; + return undefined; + }); + } + function getNameFromObjectLiteralElement(node) { + if (node.name.kind === 143) { + var nameExpression = node.name.expression; + if (ts.isStringOrNumericLiteral(nameExpression)) { + return nameExpression.text; } return undefined; } - function getIntersectingMeaningFromDeclarations(meaning, declarations) { - if (declarations) { - var lastIterationMeaning = void 0; - do { - lastIterationMeaning = meaning; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; - var declarationMeaning = ts.getMeaningFromDeclaration(declaration); - if (declarationMeaning & meaning) { - meaning |= declarationMeaning; - } + return node.name.text; + } + function getPropertySymbolsFromContextualType(node, typeChecker) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = getNameFromObjectLiteralElement(node); + if (name && contextualType) { + var result_4 = []; + var symbol = contextualType.getProperty(name); + if (symbol) { + result_4.push(symbol); + } + if (contextualType.flags & 65536) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_4.push(symbol); } - } while (meaning !== lastIterationMeaning); + }); } - return meaning; + return result_4; } + return undefined; + } + function getIntersectingMeaningFromDeclarations(meaning, declarations) { + if (declarations) { + var lastIterationMeaning = void 0; + do { + lastIterationMeaning = meaning; + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; + var declarationMeaning = ts.getMeaningFromDeclaration(declaration); + if (declarationMeaning & meaning) { + meaning |= declarationMeaning; + } + } + } while (meaning !== lastIterationMeaning); + } + return meaning; } - FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; function convertReferences(referenceSymbols) { if (!referenceSymbols) { return undefined; @@ -57727,7 +58101,7 @@ var ts; if (node.initializer) { return true; } - else if (node.kind === 224) { + else if (node.kind === 225) { var parentStatement = getParentStatementOfVariableDeclaration(node); return parentStatement && ts.hasModifier(parentStatement, 2); } @@ -57737,18 +58111,18 @@ var ts; } else { switch (node.kind) { - case 227: - case 197: - case 230: + case 228: + case 198: case 231: + case 232: return true; } } return false; } function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 206) { - ts.Debug.assert(node.parent.kind === 225); + if (node.parent && node.parent.parent && node.parent.parent.kind === 207) { + ts.Debug.assert(node.parent.kind === 226); return node.parent.parent; } } @@ -57786,10 +58160,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 191 || parent.kind === 190) { + if (parent.kind === 192 || parent.kind === 191) { return true; } - else if (parent.kind === 192 && parent.left === node) { + else if (parent.kind === 193 && parent.left === node) { var operator = parent.operatorToken.kind; return 57 <= operator && operator <= 69; } @@ -57808,7 +58182,7 @@ var ts; switch (node.kind) { case 9: case 8: - if (node.parent.kind === 142) { + if (node.parent.kind === 143) { return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; } case 70: @@ -57818,11 +58192,11 @@ var ts; } function isObjectLiteralPropertyDeclaration(node) { switch (node.kind) { - case 258: case 259: - case 149: - case 151: + case 260: + case 150: case 152: + case 153: return true; } return false; @@ -57836,6 +58210,9 @@ var ts; } return false; } + function isImportDefaultSymbol(symbol) { + return symbol.declarations[0].kind === 238; + } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); var ts; @@ -57853,11 +58230,9 @@ var ts; } var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { - var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; - if (referenceFile && referenceFile.resolvedFileName) { - return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; - } - return undefined; + var referenceFile = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName); + return referenceFile && referenceFile.resolvedFileName && + [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } var node = ts.getTouchingPropertyName(sourceFile, position); if (node === sourceFile) { @@ -57866,7 +58241,7 @@ var ts; if (ts.isJumpStatementTarget(node)) { var labelName = node.text; var label = ts.getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, undefined)] : undefined; + return label ? [createDefinitionInfoFromName(label, ts.ScriptElementKind.label, labelName, undefined)] : undefined; } var typeChecker = program.getTypeChecker(); var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); @@ -57881,11 +58256,11 @@ var ts; var declaration = symbol.declarations[0]; if (node.kind === 70 && (node.parent === declaration || - (declaration.kind === 240 && declaration.parent && declaration.parent.kind === 239))) { + (declaration.kind === 241 && declaration.parent && declaration.parent.kind === 240))) { symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 259) { + if (node.parent.kind === 260) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -57913,13 +58288,13 @@ var ts; return undefined; } if (type.flags & 65536 && !(type.flags & 16)) { - var result_6 = []; + var result_5 = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(result_6, getDefinitionFromSymbol(typeChecker, t.symbol, node)); + ts.addRange(result_5, getDefinitionFromSymbol(typeChecker, t.symbol, node)); } }); - return result_6; + return result_5; } if (!type.symbol) { return undefined; @@ -57961,29 +58336,40 @@ var ts; function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { var declarations = []; var definition; - ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 150) || - (!selectConstructors && (d.kind === 226 || d.kind === 149 || d.kind === 148))) { + for (var _i = 0, signatureDeclarations_1 = signatureDeclarations; _i < signatureDeclarations_1.length; _i++) { + var d = signatureDeclarations_1[_i]; + if (selectConstructors ? d.kind === 151 : isSignatureDeclaration(d)) { declarations.push(d); if (d.body) definition = d; } - }); - if (definition) { - result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); - return true; } - else if (declarations.length) { - result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); + if (declarations.length) { + result.push(createDefinitionInfo(definition || ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); return true; } return false; } } + function isSignatureDeclaration(node) { + switch (node.kind) { + case 151: + case 227: + case 150: + case 149: + return true; + default: + return false; + } + } function createDefinitionInfo(node, symbolKind, symbolName, containerName) { + return createDefinitionInfoFromName(node.name || node, symbolKind, symbolName, containerName); + } + function createDefinitionInfoFromName(name, symbolKind, symbolName, containerName) { + var sourceFile = name.getSourceFile(); return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromNode(name, sourceFile), kind: symbolKind, name: symbolName, containerKind: undefined, @@ -58030,7 +58416,11 @@ var ts; } function tryGetSignatureDeclaration(typeChecker, node) { var callLike = getAncestorCallLikeExpression(node); - return callLike && typeChecker.getResolvedSignature(callLike).declaration; + var decl = callLike && typeChecker.getResolvedSignature(callLike).declaration; + if (decl && isSignatureDeclaration(decl)) { + return decl; + } + return undefined; } })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); })(ts || (ts = {})); @@ -58039,7 +58429,7 @@ var ts; var GoToImplementation; (function (GoToImplementation) { function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { - if (node.parent.kind === 259) { + if (node.parent.kind === 260) { var result = []; ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); return result.length > 0 ? result : undefined; @@ -58049,7 +58439,7 @@ var ts; return symbol.valueDeclaration && [ts.FindAllReferences.getReferenceEntryFromNode(symbol.valueDeclaration)]; } else { - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, false, false, true); + var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, false, false, false, true); var result = ts.flatMap(referencedSymbols, function (symbol) { return ts.map(symbol.references, function (_a) { var textSpan = _a.textSpan, fileName = _a.fileName; @@ -58165,16 +58555,16 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 226: - case 149: - case 150: case 227: - case 206: + case 150: + case 151: + case 228: + case 207: break findOwner; - case 262: + case 263: return undefined; - case 231: - if (commentOwner.parent.kind === 231) { + case 232: + if (commentOwner.parent.kind === 232) { return undefined; } break findOwner; @@ -58214,7 +58604,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 206) { + if (commentOwner.kind === 207) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -58224,17 +58614,17 @@ var ts; return ts.emptyArray; } function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 183) { + while (rightHandSide.kind === 184) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 184: case 185: + case 186: return rightHandSide.parameters; - case 197: + case 198: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150) { + if (member.kind === 151) { return member.parameters; } } @@ -58251,41 +58641,43 @@ var ts; function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; - ts.forEach(sourceFiles, function (sourceFile) { + var _loop_4 = function (sourceFile) { cancellationToken.throwIfCancellationRequested(); if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) { - return; + return "continue"; } - var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_48 in nameToDeclarations) { - var declarations = nameToDeclarations[name_48]; + ts.forEachEntry(sourceFile.getNamedDeclarations(), function (declarations, name) { if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_48); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); if (!matches) { - continue; + return; } for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; if (patternMatcher.patternContainsDots) { var containers = getContainers(declaration); if (!containers) { - return undefined; + return true; } - matches = patternMatcher.getMatches(containers, name_48); + matches = patternMatcher.getMatches(containers, name); if (!matches) { - continue; + return; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_48, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } - } - }); + }); + }; + for (var _i = 0, sourceFiles_10 = sourceFiles; _i < sourceFiles_10.length; _i++) { + var sourceFile = sourceFiles_10[_i]; + _loop_4(sourceFile); + } rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 237 || decl.kind === 240 || decl.kind === 235) { + if (decl.kind === 238 || decl.kind === 241 || decl.kind === 236) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -58326,7 +58718,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 142) { + else if (declaration.name.kind === 143) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -58343,7 +58735,7 @@ var ts; } return true; } - if (expression.kind === 177) { + if (expression.kind === 178) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -58354,7 +58746,7 @@ var ts; } function getContainers(declaration) { var containers = []; - if (declaration.name.kind === 142) { + if (declaration.name.kind === 143) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -58395,7 +58787,7 @@ var ts; matchKind: ts.PatternMatchKind[rawItem.matchKind], isCaseSensitive: rawItem.isCaseSensitive, fileName: rawItem.fileName, - textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + textSpan: ts.createTextSpanFromNode(declaration), containerName: container && container.name ? container.name.text : "", containerKind: container && container.name ? ts.getNodeKind(container) : "" }; @@ -58486,7 +58878,7 @@ var ts; return; } switch (node.kind) { - case 150: + case 151: var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); for (var _i = 0, _a = ctr.parameters; _i < _a.length; _i++) { @@ -58496,28 +58888,28 @@ var ts; } } break; - case 149: - case 151: + case 150: case 152: - case 148: + case 153: + case 149: if (!ts.hasDynamicName(node)) { addNodeWithRecursiveChild(node, node.body); } break; + case 148: case 147: - case 146: if (!ts.hasDynamicName(node)) { addLeafNode(node); } break; - case 237: + case 238: var importClause = node; if (importClause.name) { addLeafNode(importClause); } var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 238) { + if (namedBindings.kind === 239) { addLeafNode(namedBindings); } else { @@ -58528,12 +58920,12 @@ var ts; } } break; - case 174: - case 224: + case 175: + case 225: var decl = node; - var name_49 = decl.name; - if (ts.isBindingPattern(name_49)) { - addChildrenRecursively(name_49); + var name = decl.name; + if (ts.isBindingPattern(name)) { + addChildrenRecursively(name); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { addChildrenRecursively(decl.initializer); @@ -58542,12 +58934,12 @@ var ts; addNodeWithRecursiveChild(decl, decl.initializer); } break; + case 186: + case 227: case 185: - case 226: - case 184: addNodeWithRecursiveChild(node, node.body); break; - case 230: + case 231: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -58557,9 +58949,9 @@ var ts; } endNode(); break; - case 227: - case 197: case 228: + case 198: + case 229: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -58567,21 +58959,21 @@ var ts; } endNode(); break; - case 231: + case 232: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 244: - case 235: - case 155: - case 153: + case 245: + case 236: + case 156: case 154: - case 229: + case 155: + case 230: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 286) { + if (tag.kind === 287) { addLeafNode(tag); } }); @@ -58597,9 +58989,9 @@ var ts; if (!name) { return true; } - var itemsWithSameName = nameToItems[name]; + var itemsWithSameName = nameToItems.get(name); if (!itemsWithSameName) { - nameToItems[name] = child; + nameToItems.set(name, child); return true; } if (itemsWithSameName instanceof Array) { @@ -58617,7 +59009,7 @@ var ts; if (tryMerge(itemWithSameName, child)) { return false; } - nameToItems[name] = [itemWithSameName, child]; + nameToItems.set(name, [itemWithSameName, child]); return true; } function tryMerge(a, b) { @@ -58629,12 +59021,12 @@ var ts; } }); function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 231 || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 232 || areSameModule(a, b)); function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 231) { + if (a.body.kind !== 232) { return true; } return areSameModule(a.body, b.body); @@ -58660,32 +59052,15 @@ var ts; function compareChildren(child1, child2) { var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node); if (name1 && name2) { - var cmp = localeCompareFix(name1, name2); + var cmp = ts.compareStringsCaseInsensitive(name1, name2); return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } else { return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } } - var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; - var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) { - for (var i = 0; i < Math.min(a.length, b.length); i++) { - var chA = a.charAt(i), chB = b.charAt(i); - if (chA === "\"" && chB === "'") { - return 1; - } - if (chA === "'" && chB === "\"") { - return -1; - } - var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase()); - if (cmp !== 0) { - return cmp; - } - } - return a.length - b.length; - }; function tryGetName(node) { - if (node.kind === 231) { + if (node.kind === 232) { return getModuleName(node); } var decl = node; @@ -58693,18 +59068,18 @@ var ts; return ts.getPropertyNameForPropertyNameNode(decl.name); } switch (node.kind) { - case 184: case 185: - case 197: + case 186: + case 198: return getFunctionOrClassName(node); - case 286: + case 287: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 231) { + if (node.kind === 232) { return getModuleName(node); } var name = node.name; @@ -58715,29 +59090,29 @@ var ts; } } switch (node.kind) { - case 262: + case 263: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 185: - case 226: - case 184: + case 186: case 227: - case 197: + case 185: + case 228: + case 198: if (ts.getModifierFlags(node) & 512) { return "default"; } return getFunctionOrClassName(node); - case 150: + case 151: return "constructor"; - case 154: + case 155: return "new()"; - case 153: + case 154: return "()"; - case 155: + case 156: return "[]"; - case 286: + case 287: return getJSDocTypedefTagName(node); default: return ""; @@ -58749,7 +59124,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 206) { + if (parentNode && parentNode.kind === 207) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -58777,24 +59152,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 227: - case 197: - case 230: case 228: + case 198: case 231: - case 262: case 229: - case 286: + case 232: + case 263: + case 230: + case 287: return true; - case 150: - case 149: case 151: + case 150: case 152: - case 224: + case 153: + case 225: return hasSomeImportantChild(item); + case 186: + case 227: case 185: - case 226: - case 184: return isTopLevelFunctionDeclaration(item); default: return false; @@ -58804,10 +59179,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 232: - case 262: - case 149: + case 233: + case 263: case 150: + case 151: return true; default: return hasSomeImportantChild(item); @@ -58816,7 +59191,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 224 && childKind !== 174; + return childKind !== 225 && childKind !== 175; }); } } @@ -58826,7 +59201,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToTree) }; @@ -58835,7 +59210,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray, indent: n.indent, @@ -58871,35 +59246,41 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 231) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 232) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } return result.join("."); } function getInteriorModule(decl) { - return decl.body.kind === 231 ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 232 ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 142; + return !member.name || member.name.kind === 143; } function getNodeSpan(node) { - return node.kind === 262 + return node.kind === 263 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); + : ts.createTextSpanFromNode(node, curSourceFile); + } + function getModifiers(node) { + if (node.parent && node.parent.kind === 225) { + node = node.parent; + } + return ts.getNodeModifiers(node); } function getFunctionOrClassName(node) { if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 224) { + else if (node.parent.kind === 225) { return ts.declarationNameToString(node.parent.name); } - else if (node.parent.kind === 192 && + else if (node.parent.kind === 193 && node.parent.operatorToken.kind === 57) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 258 && node.parent.name) { + else if (node.parent.kind === 259 && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512) { @@ -58910,7 +59291,7 @@ var ts; } } function isFunctionOrClassExpression(node) { - return node.kind === 184 || node.kind === 185 || node.kind === 197; + return node.kind === 185 || node.kind === 186 || node.kind === 198; } var whiteSpaceRegex = /\s+/g; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); @@ -58926,7 +59307,7 @@ var ts; if (hintSpanNode && startElement && endElement) { var span_12 = { textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), - hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + hintSpan: ts.createTextSpanFromNode(hintSpanNode, sourceFile), bannerText: collapseText, autoCollapse: autoCollapse }; @@ -58983,7 +59364,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 185; + return ts.isFunctionBlock(node) && node.parent.kind !== 186; } var depth = 0; var maxDepth = 20; @@ -58995,26 +59376,26 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 205: + case 206: if (!ts.isFunctionBlock(n)) { - var parent_20 = n.parent; + var parent = n.parent; var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); - if (parent_20.kind === 210 || - parent_20.kind === 213 || - parent_20.kind === 214 || - parent_20.kind === 212 || - parent_20.kind === 209 || - parent_20.kind === 211 || - parent_20.kind === 218 || - parent_20.kind === 257) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + if (parent.kind === 211 || + parent.kind === 214 || + parent.kind === 215 || + parent.kind === 213 || + parent.kind === 210 || + parent.kind === 212 || + parent.kind === 219 || + parent.kind === 258) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_20.kind === 222) { - var tryStatement = parent_20; + if (parent.kind === 223) { + var tryStatement = parent; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -59025,7 +59406,7 @@ var ts; } } } - var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end); + var span_14 = ts.createTextSpanFromNode(n); elements.push({ textSpan: span_14, hintSpan: span_14, @@ -59034,23 +59415,23 @@ var ts; }); break; } - case 232: { + case 233: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 227: case 228: - case 230: - case 176: - case 233: { + case 229: + case 231: + case 177: + case 234: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 175: + case 176: var openBracket = ts.findChildOfKind(n, 20, sourceFile); var closeBracket = ts.findChildOfKind(n, 21, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -59127,10 +59508,11 @@ var ts; return totalMatch; } function getWordSpans(word) { - if (!(word in stringToWordSpans)) { - stringToWordSpans[word] = breakIntoWordSpans(word); + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - return stringToWordSpans[word]; + return spans; } function matchTextChunk(candidate, chunk, punctuationStripped) { var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); @@ -59563,7 +59945,7 @@ var ts; else { if (token === 70 || ts.isKeyword(token)) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59589,7 +59971,7 @@ var ts; } if (token === 17) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59603,7 +59985,7 @@ var ts; token = nextToken(); if (token === 70 || ts.isKeyword(token)) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59629,7 +60011,7 @@ var ts; } if (token === 17) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59639,7 +60021,7 @@ var ts; } else if (token === 38) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59766,90 +60148,82 @@ var ts; var Rename; (function (Rename) { function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) { - var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); + var getCanonicalDefaultLibName = ts.memoize(function () { return getCanonicalFileName(ts.normalizePath(defaultLibFileName)); }); var node = ts.getTouchingWord(sourceFile, position, true); - if (node) { - if (node.kind === 70 || - node.kind === 9 || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - ts.isThis(node)) { - var symbol = typeChecker.getSymbolAtLocation(node); - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - if (ts.forEach(declarations, isDefinedInLibraryFile)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - if (kind) { - return { - canRename: true, - kind: kind, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } - else if (node.kind === 9) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (type) { - if (isDefinedInLibraryFile(node)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - else { - var displayName = ts.stripQuotes(type.text); - return { - canRename: true, - kind: ts.ScriptElementKind.variableElement, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: displayName, - kindModifiers: ts.ScriptElementKindModifier.none, - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } + var renameInfo = node && nodeIsEligibleForRename(node) + ? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) + : undefined; + return renameInfo || getRenameInfoError(ts.Diagnostics.You_cannot_rename_this_element); + function isDefinedInLibraryFile(declaration) { + if (!defaultLibFileName) { + return false; } + var sourceFile = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName)); + return canonicalName === getCanonicalDefaultLibName(); } - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element)); - function getRenameInfoError(localizedErrorMessage) { - return { - canRename: false, - localizedErrorMessage: localizedErrorMessage, - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }; - } - function isDefinedInLibraryFile(declaration) { - if (defaultLibFileName) { - var sourceFile_1 = declaration.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)); - if (canonicalName === canonicalDefaultLibName) { - return true; + } + Rename.getRenameInfo = getRenameInfo; + function getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) { + var symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + if (ts.some(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); + return kind ? getRenameInfoSuccess(displayName, typeChecker.getFullyQualifiedName(symbol), kind, ts.SymbolDisplay.getSymbolModifiers(symbol), node, sourceFile) : undefined; } - return false; } - function createTriggerSpanForNode(node, sourceFile) { - var start = node.getStart(sourceFile); - var width = node.getWidth(sourceFile); - if (node.kind === 9) { - start += 1; - width -= 2; + else if (node.kind === 9) { + var type = ts.getStringLiteralTypeForNode(node, typeChecker); + if (type) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); + } + var displayName = ts.stripQuotes(type.text); + return getRenameInfoSuccess(displayName, displayName, ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, node, sourceFile); } - return ts.createTextSpan(start, width); } } - Rename.getRenameInfo = getRenameInfo; + function getRenameInfoSuccess(displayName, fullDisplayName, kind, kindModifiers, node, sourceFile) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: fullDisplayName, + kindModifiers: kindModifiers, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + function getRenameInfoError(diagnostic) { + return { + canRename: false, + localizedErrorMessage: ts.getLocaleSpecificMessage(diagnostic), + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9) { + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } + function nodeIsEligibleForRename(node) { + return node.kind === 70 || node.kind === 9 || + ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + ts.isThis(node); + } })(Rename = ts.Rename || (ts.Rename = {})); })(ts || (ts = {})); var ts; @@ -59882,14 +60256,14 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 179) { + if (argumentInfo.invocation.kind !== 180) { return undefined; } var callExpression = argumentInfo.invocation; var expression = callExpression.expression; var name = expression.kind === 70 ? expression - : expression.kind === 177 + : expression.kind === 178 ? expression.name : undefined; if (!name || !name.text) { @@ -59899,7 +60273,7 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameToDeclarations = sourceFile.getNamedDeclarations(); - var declarations = nameToDeclarations[name.text]; + var declarations = nameToDeclarations.get(name.text); if (declarations) { for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) { var declaration = declarations_10[_b]; @@ -59918,7 +60292,7 @@ var ts; } } function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { - if (node.parent.kind === 179 || node.parent.kind === 180) { + if (node.parent.kind === 180 || node.parent.kind === 181) { var callExpression = node.parent; if (node.kind === 26 || node.kind === 18) { @@ -59950,23 +60324,23 @@ var ts; } return undefined; } - else if (node.kind === 12 && node.parent.kind === 181) { + else if (node.kind === 12 && node.parent.kind === 182) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0, sourceFile); } } - else if (node.kind === 13 && node.parent.parent.kind === 181) { + else if (node.kind === 13 && node.parent.parent.kind === 182) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194); + ts.Debug.assert(templateExpression.kind === 195); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 203 && node.parent.parent.parent.kind === 181) { + else if (node.parent.kind === 204 && node.parent.parent.parent.kind === 182) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194); + ts.Debug.assert(templateExpression.kind === 195); if (node.kind === 15 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } @@ -59976,6 +60350,7 @@ var ts; } return undefined; } + SignatureHelp.getImmediatelyContainingArgumentInfo = getImmediatelyContainingArgumentInfo; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); @@ -60030,7 +60405,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 194) { + if (template.kind === 195) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -60039,7 +60414,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 262; n = n.parent) { + for (var n = node; n.kind !== 263; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -60171,7 +60546,7 @@ var ts; function getSymbolKind(typeChecker, symbol, location) { var flags = symbol.getFlags(); if (flags & 32) - return ts.getDeclarationOfKind(symbol, 197) ? + return ts.getDeclarationOfKind(symbol, 198) ? ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement; if (flags & 384) return ts.ScriptElementKind.enumElement; @@ -60271,14 +60646,14 @@ var ts; var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 177) { + if (location.parent && location.parent.kind === 178) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } var callExpression = void 0; - if (location.kind === 179 || location.kind === 180) { + if (location.kind === 180 || location.kind === 181) { callExpression = location; } else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) { @@ -60290,7 +60665,7 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 180 || callExpression.expression.kind === 96; + var useConstructSignatures = callExpression.kind === 181 || callExpression.expression.kind === 96; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -60338,21 +60713,21 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 122 && location.parent.kind === 150)) { + (location.kind === 122 && location.parent.kind === 151)) { var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 150 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration.kind === 151 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 150) { + if (functionDeclaration.kind === 151) { symbolKind = ts.ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 154 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -60361,7 +60736,7 @@ var ts; } } if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) { - if (ts.getDeclarationOfKind(symbol, 197)) { + if (ts.getDeclarationOfKind(symbol, 198)) { pushTypePart(ts.ScriptElementKind.localClassElement); } else { @@ -60380,7 +60755,7 @@ var ts; } if (symbolFlags & 524288) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(136)); + displayParts.push(ts.keywordPart(137)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -60401,7 +60776,7 @@ var ts; } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 231); + var declaration = ts.getDeclarationOfKind(symbol, 232); var isNamespace = declaration && declaration.name && declaration.name.kind === 70; displayParts.push(ts.keywordPart(isNamespace ? 128 : 127)); displayParts.push(ts.spacePart()); @@ -60420,25 +60795,25 @@ var ts; writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - var declaration = ts.getDeclarationOfKind(symbol, 143); + var declaration = ts.getDeclarationOfKind(symbol, 144); ts.Debug.assert(declaration !== undefined); declaration = declaration.parent; if (declaration) { if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 154) { + if (declaration.kind === 155) { displayParts.push(ts.keywordPart(93)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 153 && declaration.name) { + else if (declaration.kind !== 154 && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); } - else if (declaration.kind === 229) { + else if (declaration.kind === 230) { addInPrefix(); - displayParts.push(ts.keywordPart(136)); + displayParts.push(ts.keywordPart(137)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -60449,7 +60824,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 261) { + if (declaration.kind === 262) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -60461,7 +60836,7 @@ var ts; } if (symbolFlags & 8388608) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 234) { + if (symbol.declarations[0].kind === 235) { displayParts.push(ts.keywordPart(83)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128)); @@ -60472,7 +60847,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 235) { + if (declaration.kind === 236) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -60540,10 +60915,10 @@ var ts; if (!documentation) { documentation = symbol.getDocumentationComment(); if (documentation.length === 0 && symbol.flags & 4) { - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 262; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 263; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 192) { + if (!declaration.parent || declaration.parent.kind !== 193) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -60623,14 +60998,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 184) { + if (declaration.kind === 185) { return true; } - if (declaration.kind !== 224 && declaration.kind !== 226) { + if (declaration.kind !== 225 && declaration.kind !== 227) { return false; } - for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { - if (parent_21.kind === 262 || parent_21.kind === 232) { + for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { + if (parent.kind === 263 || parent.kind === 233) { return false; } } @@ -60665,7 +61040,7 @@ var ts; sourceFile.moduleName = transpileOptions.moduleName; } if (transpileOptions.renamedDependencies) { - sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies); + sourceFile.renamedDependencies = ts.createMapFromTemplate(transpileOptions.renamedDependencies); } var newLine = ts.getNewLineCharacter(options); var outputText; @@ -60711,10 +61086,10 @@ var ts; var commandLineOptionsStringToEnum; function fixupCompilerOptions(options, diagnostics) { commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { - return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); + return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_3 = function (opt) { + var _loop_5 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -60723,14 +61098,14 @@ var ts; options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics); } else { - if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) { + if (!ts.forEachEntry(opt.type, function (v) { return v === value; })) { diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt)); } } }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_3(opt); + _loop_5(opt); } return options; } @@ -60821,10 +61196,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { + case 252: + case 250: case 251: case 249: - case 250: - case 248: return node.kind === 70; } } @@ -61157,7 +61532,7 @@ var ts; this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromRange(0, 140, [19])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromRange(0, 141, [19])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17, 81), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17, 105), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); @@ -61200,14 +61575,14 @@ var ts; this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([19, 80, 81, 72]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNotForContext), 2)); this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101, 86]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 133]), 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 134]), 70), 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.IsNonJsxSameLineTokenContext, 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.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127, 131]), 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 130, 133, 114, 136, 138, 126]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 138])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 130, 134, 114, 137, 139, 126]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 139])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(35, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); @@ -61221,7 +61596,7 @@ var ts; this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8)); this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116, 70, 83, 78, 74, 114, 113, 111, 112, 124, 133, 20, 38])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116, 70, 83, 78, 74, 114, 113, 111, 112, 124, 134, 20, 38])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38, formatting.Shared.TokenRange.FromTokens([70, 18])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); @@ -61327,44 +61702,44 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_50 in o) { - if (o[name_50] === rule) { - return name_50; + for (var name in o) { + if (o[name] === rule) { + return name; } } throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 212; + return context.contextNode.kind === 213; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 192: case 193: - case 200: - case 244: - case 240: - case 156: - case 164: + case 194: + case 201: + case 245: + case 241: + case 157: case 165: + case 166: return true; - case 174: - case 229: - case 235: - case 224: - case 144: - case 261: + case 175: + case 230: + case 236: + case 225: + case 145: + case 262: + case 148: case 147: - case 146: return context.currentTokenSpan.kind === 57 || context.nextTokenSpan.kind === 57; - case 213: - case 143: - return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91; case 214: - return context.currentTokenSpan.kind === 140 || context.nextTokenSpan.kind === 140; + case 144: + return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91; + case 215: + return context.currentTokenSpan.kind === 141 || context.nextTokenSpan.kind === 141; } return false; }; @@ -61372,13 +61747,13 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 193; + return context.contextNode.kind === 194; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; Rules.IsBraceWrappedContext = function (context) { - return context.contextNode.kind === 172 || Rules.IsSingleLineBlockContext(context); + return context.contextNode.kind === 173 || Rules.IsSingleLineBlockContext(context); }; Rules.IsBeforeMultilineBlockContext = function (context) { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); @@ -61400,65 +61775,65 @@ var ts; return true; } switch (node.kind) { - case 205: + case 206: + case 234: + case 177: case 233: - case 176: - case 232: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 226: + case 227: + case 150: case 149: - case 148: - case 151: case 152: case 153: - case 184: - case 150: + case 154: case 185: - case 228: + case 151: + case 186: + case 229: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 226 || context.contextNode.kind === 184; + return context.contextNode.kind === 227 || context.contextNode.kind === 185; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 227: - case 197: case 228: - case 230: - case 161: + case 198: + case 229: case 231: - case 242: + case 162: + case 232: case 243: - case 236: - case 239: + case 244: + case 237: + case 240: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 227: - case 231: - case 230: - case 257: + case 228: case 232: - case 219: + case 231: + case 258: + case 233: + case 220: return true; - case 205: { + case 206: { var blockParent = context.currentTokenParent.parent; - if (blockParent.kind !== 185 && - blockParent.kind !== 184) { + if (blockParent.kind !== 186 && + blockParent.kind !== 185) { return true; } } @@ -61467,29 +61842,29 @@ var ts; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 209: - case 219: - case 212: + case 210: + case 220: case 213: case 214: + case 215: + case 212: + case 223: case 211: - case 222: - case 210: - case 218: - case 257: + case 219: + case 258: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 176; + return context.contextNode.kind === 177; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 179; + return context.contextNode.kind === 180; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 180; + return context.contextNode.kind === 181; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -61501,25 +61876,25 @@ var ts; return context.nextTokenSpan.kind !== 21; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 185; + return context.contextNode.kind === 186; }; Rules.IsNonJsxSameLineTokenContext = function (context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 247; + return context.contextNode.kind !== 248; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 253; + return context.contextNode.kind === 254; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 251; + return context.nextTokenParent.kind === 252; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 251; + return context.contextNode.kind === 252; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 248; + return context.contextNode.kind === 249; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -61534,42 +61909,42 @@ var ts; while (ts.isPartOfExpression(node)) { node = node.parent; } - return node.kind === 145; + return node.kind === 146; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 225 && + return context.currentTokenParent.kind === 226 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 231; + return context.contextNode.kind === 232; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 161; + return context.contextNode.kind === 162; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 26 && token.kind !== 28) { return false; } switch (parent.kind) { - case 157: - case 182: + case 158: + case 183: + case 230: + case 228: + case 198: case 229: case 227: - case 197: - case 228: - case 226: - case 184: case 185: + case 186: + case 150: case 149: - case 148: - case 153: case 154: - case 179: + case 155: case 180: - case 199: + case 181: + case 200: return true; default: return false; @@ -61580,16 +61955,16 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 182; + return context.contextNode.kind === 183; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 104 && context.currentTokenParent.kind === 188; + return context.currentTokenSpan.kind === 104 && context.currentTokenParent.kind === 189; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 195 && context.contextNode.expression !== undefined; + return context.contextNode.kind === 196 && context.contextNode.expression !== undefined; }; Rules.IsNonNullAssertionContext = function (context) { - return context.contextNode.kind === 201; + return context.contextNode.kind === 202; }; return Rules; }()); @@ -61611,7 +61986,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 140 + 1; + this.mapRowLength = 141 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -61624,7 +61999,7 @@ var ts; }); }; RulesMap.prototype.GetRuleBucketIndex = function (row, column) { - ts.Debug.assert(row <= 140 && column <= 140, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 141 && column <= 141, "Must compute formatting context from tokens"); var rulesBucketIndex = (row * this.mapRowLength) + column; return rulesBucketIndex; }; @@ -61788,7 +62163,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 140; token++) { + for (var token = 0; token <= 141; token++) { result.push(token); } return result; @@ -61832,9 +62207,9 @@ var ts; }()); TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(71, 140); + TokenRange.Keywords = TokenRange.FromRange(71, 141); TokenRange.BinaryOperators = TokenRange.FromRange(26, 69); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91, 92, 140, 117, 125]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91, 92, 141, 117, 125]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42, 43, 51, 50]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 70, 18, 20, 16, 98, 93]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]); @@ -61842,7 +62217,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70, 19, 21, 93]); TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([70, 132, 134, 121, 135, 104, 118]); + TokenRange.TypeNames = TokenRange.FromTokens([70, 132, 135, 121, 136, 104, 118]); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -62062,17 +62437,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 227: case 228: + case 229: return ts.rangeContainsRange(parent.members, node); - case 231: - var body = parent.body; - return body && body.kind === 232 && ts.rangeContainsRange(body.statements, node); - case 262: - case 205: case 232: + var body = parent.body; + return body && body.kind === 233 && ts.rangeContainsRange(body.statements, node); + case 263: + case 206: + case 233: return ts.rangeContainsRange(parent.statements, node); - case 257: + case 258: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -62228,18 +62603,18 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 227: return 74; - case 228: return 108; - case 226: return 88; - case 230: return 230; - case 151: return 124; - case 152: return 133; - case 149: + case 228: return 74; + case 229: return 108; + case 227: return 88; + case 231: return 231; + case 152: return 124; + case 153: return 134; + case 150: if (node.asteriskToken) { return 38; } - case 147: - case 144: + case 148: + case 145: return node.name.kind; } } @@ -62271,16 +62646,16 @@ var ts; return indentation; case 40: case 28: { - if (container.kind === 249 || - container.kind === 250 || - container.kind === 248) { + if (container.kind === 250 || + container.kind === 251 || + container.kind === 249) { return indentation; } break; } case 20: case 21: { - if (container.kind !== 170) { + if (container.kind !== 171) { return indentation; } break; @@ -62368,11 +62743,11 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 145 ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 146 ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 175 && inheritedIndentation === -1) { + if (isFirstListItem && parent.kind === 176 && inheritedIndentation === -1) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -62688,12 +63063,12 @@ var ts; } function getOpenTokenForList(node, list) { switch (node.kind) { + case 151: + case 227: + case 185: case 150: - case 226: - case 184: case 149: - case 148: - case 185: + case 186: if (node.typeParameters === list) { return 26; } @@ -62701,8 +63076,8 @@ var ts; return 18; } break; - case 179: case 180: + case 181: if (node.typeArguments === list) { return 26; } @@ -62710,7 +63085,7 @@ var ts; return 18; } break; - case 157: + case 158: if (node.typeArguments === list) { return 26; } @@ -62811,7 +63186,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 25 && precedingToken.parent.kind !== 192) { + if (precedingToken.kind === 25 && precedingToken.parent.kind !== 193) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -62913,7 +63288,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 262 || !parentAndChildShareLine); + (parent.kind === 263 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -62937,7 +63312,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 209 && parent.elseStatement === child) { + if (parent.kind === 210 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -62949,23 +63324,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 157: + case 158: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 176: + case 177: return node.parent.properties; - case 175: + case 176: return node.parent.elements; - case 226: - case 184: + case 227: case 185: + case 186: + case 150: case 149: - case 148: - case 153: - case 154: { + case 154: + case 155: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -62976,8 +63351,8 @@ var ts; } break; } - case 180: - case 179: { + case 181: + case 180: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -63005,8 +63380,8 @@ var ts; if (node.kind === 19) { return -1; } - if (node.parent && (node.parent.kind === 179 || - node.parent.kind === 180) && + if (node.parent && (node.parent.kind === 180 || + node.parent.kind === 181) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -63024,10 +63399,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 179: case 180: - case 177: + case 181: case 178: + case 179: node = node.expression; break; default: @@ -63081,49 +63456,49 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 208: - case 227: - case 197: + case 209: case 228: - case 230: + case 198: case 229: - case 175: - case 205: - case 232: + case 231: + case 230: case 176: - case 161: - case 170: - case 163: + case 206: case 233: - case 255: - case 254: - case 183: case 177: - case 179: + case 162: + case 171: + case 164: + case 234: + case 256: + case 255: + case 184: + case 178: case 180: - case 206: - case 224: - case 241: - case 217: - case 193: + case 181: + case 207: + case 225: + case 242: + case 218: + case 194: + case 174: case 173: - case 172: + case 250: case 249: - case 248: - case 253: - case 148: - case 153: + case 254: + case 149: case 154: - case 144: - case 158: + case 155: + case 145: case 159: - case 166: - case 181: - case 189: - case 243: - case 239: + case 160: + case 167: + case 182: + case 190: case 244: case 240: + case 245: + case 241: return true; } return false; @@ -63131,27 +63506,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0; switch (parent.kind) { - case 210: case 211: - case 213: - case 214: case 212: - case 209: - case 226: - case 184: - case 149: + case 214: + case 215: + case 213: + case 210: + case 227: case 185: case 150: + case 186: case 151: case 152: - return childKind !== 205; - case 242: - return childKind !== 243; - case 236: - return childKind !== 237 || - (child.namedBindings && child.namedBindings.kind !== 239); - case 247: - return childKind !== 250; + case 153: + return childKind !== 206; + case 243: + return childKind !== 244; + case 237: + return childKind !== 238 || + (child.namedBindings && child.namedBindings.kind !== 240); + case 248: + return childKind !== 251; } return indentByDefault; } @@ -63167,7 +63542,7 @@ var ts; (function (ts) { var codefix; (function (codefix) { - var codeFixes = ts.createMap(); + var codeFixes = []; function registerCodeFix(action) { ts.forEach(action.errorCodes, function (error) { var fixes = codeFixes[error]; @@ -63240,9 +63615,9 @@ var ts; if (IndexInfoOfKind) { var writer = ts.getSingleLineStringWriter(); checker.getSymbolDisplayBuilder().buildIndexSignatureDisplay(IndexInfoOfKind, writer, kind, enclosingDeclaration); - var result_7 = writer.string(); + var result_6 = writer.string(); ts.releaseStringWriter(writer); - return result_7; + return result_6; } } return ""; @@ -63328,7 +63703,7 @@ var ts; if (!superCall) { return undefined; } - if (superCall.expression && superCall.expression.kind == 179) { + if (superCall.expression && superCall.expression.kind == 180) { var arguments_1 = superCall.expression.arguments; for (var i = 0; i < arguments_1.length; i++) { if (arguments_1[i].expression === token) { @@ -63352,7 +63727,7 @@ var ts; changes: changes }]; function findSuperCall(n) { - if (n.kind === 208 && ts.isSuperCall(n.expression)) { + if (n.kind === 209 && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -63431,6 +63806,24 @@ var ts; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + var start = token.getStart(sourceFile); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_this_to_unresolved_variable), + changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "this.", span: { start: start, length: 0 } }] }] + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var codefix; (function (codefix) { @@ -63449,9 +63842,9 @@ var ts; switch (token.kind) { case 70: switch (token.parent.kind) { - case 224: + case 225: switch (token.parent.parent.parent.kind) { - case 212: + case 213: var forStatement = token.parent.parent.parent; var forInitializer = forStatement.initializer; if (forInitializer.declarations.length === 1) { @@ -63460,16 +63853,16 @@ var ts; else { return removeSingleItem(forInitializer.declarations, token); } - case 214: + case 215: var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 225) { + if (forOfStatement.initializer.kind === 226) { var forOfInitializer = forOfStatement.initializer; return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); } break; - case 213: + case 214: return undefined; - case 257: + case 258: var catchClause = token.parent.parent; var parameter = catchClause.variableDeclaration.getChildren()[0]; return createCodeFix("", parameter.pos, parameter.end - parameter.pos); @@ -63483,7 +63876,7 @@ var ts; return removeSingleItem(declarations, token); } } - case 143: + case 144: var typeParameters = token.parent.parent.typeParameters; if (typeParameters.length === 1) { return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); @@ -63491,7 +63884,7 @@ var ts; else { return removeSingleItem(typeParameters, token); } - case 144: + case 145: var functionDeclaration = token.parent.parent; if (functionDeclaration.parameters.length === 1) { return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); @@ -63499,10 +63892,10 @@ var ts; else { return removeSingleItem(functionDeclaration.parameters, token); } - case 235: + case 236: var importEquals = findImportDeclaration(token); return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 240: + case 241: var namedImports = token.parent.parent; if (namedImports.elements.length === 1) { var importSpec = findImportDeclaration(token); @@ -63511,7 +63904,7 @@ var ts; else { return removeSingleItem(namedImports.elements, token); } - case 237: + case 238: var importClause = token.parent; if (!importClause.namedBindings) { var importDecl = findImportDeclaration(importClause); @@ -63520,7 +63913,7 @@ var ts; else { return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); } - case 238: + case 239: var namespaceImport = token.parent; if (namespaceImport.name == token && !namespaceImport.parent.name) { var importDecl = findImportDeclaration(namespaceImport); @@ -63532,9 +63925,9 @@ var ts; } } break; - case 147: + case 148: return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 238: + case 239: return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); } if (ts.isDeclarationName(token)) { @@ -63548,14 +63941,14 @@ var ts; } function findImportDeclaration(token) { var importDecl = token; - while (importDecl.kind != 236 && importDecl.parent) { + while (importDecl.kind != 237 && importDecl.parent) { importDecl = importDecl.parent; } return importDecl; } function createCodeFix(newText, start, length) { return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_declaration_for_Colon_0), { 0: token.getText() }), changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: newText, span: { start: start, length: length } }] @@ -63586,18 +63979,19 @@ var ts; })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); var ImportCodeActionMap = (function () { function ImportCodeActionMap() { - this.symbolIdToActionMap = ts.createMap(); + this.symbolIdToActionMap = []; } ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { if (!newAction) { return; } - if (!this.symbolIdToActionMap[symbolId]) { + var actions = this.symbolIdToActionMap[symbolId]; + if (!actions) { this.symbolIdToActionMap[symbolId] = [newAction]; return; } if (newAction.kind === "CodeChange") { - this.symbolIdToActionMap[symbolId].push(newAction); + actions.push(newAction); return; } var updatedNewImports = []; @@ -63630,8 +64024,8 @@ var ts; }; ImportCodeActionMap.prototype.getAllActions = function () { var result = []; - for (var symbolId in this.symbolIdToActionMap) { - result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + for (var key in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[key]); } return result; }; @@ -63672,7 +64066,7 @@ var ts; var token = ts.getTokenAtPosition(sourceFile, context.span.start); var name = token.getText(); var symbolIdActionMap = new ImportCodeActionMap(); - var cachedImportDeclarations = ts.createMap(); + var cachedImportDeclarations = []; var cachedNewImportInsertPosition; var currentTokenMeaning = ts.getMeaningFromLocation(token); if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -63706,8 +64100,9 @@ var ts; return symbolIdActionMap.getAllActions(); function getImportDeclarations(moduleSymbol) { var moduleSymbolId = getUniqueSymbolId(moduleSymbol); - if (cachedImportDeclarations[moduleSymbolId]) { - return cachedImportDeclarations[moduleSymbolId]; + var cached = cachedImportDeclarations[moduleSymbolId]; + if (cached) { + return cached; } var existingDeclarations = []; for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { @@ -63722,10 +64117,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 236) { + if (node.kind === 237) { return node; } - if (node.kind === 235) { + if (node.kind === 236) { return node; } node = node.parent; @@ -63758,9 +64153,9 @@ var ts; var existingModuleSpecifier; for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { var declaration = declarations_11[_i]; - if (declaration.kind === 236) { + if (declaration.kind === 237) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 238) { + if (namedBindings && namedBindings.kind === 239) { namespaceImportDeclaration = declaration; } else { @@ -63787,7 +64182,7 @@ var ts; } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 246) { + if (declaration.moduleReference && declaration.moduleReference.kind === 247) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); @@ -63820,7 +64215,7 @@ var ts; } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 236) { + if (declaration.kind === 237) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { @@ -63859,13 +64254,13 @@ var ts; var sourceDirectory = ts.getDirectoryPath(fileName); var options = context.program.getCompilerOptions(); return tryGetModuleNameFromAmbientModule() || - tryGetModuleNameFromBaseUrl() || - tryGetModuleNameFromRootDirs() || tryGetModuleNameFromTypeRoots() || tryGetModuleNameAsNodeModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 262) { + if (moduleSymbol.valueDeclaration.kind !== 263) { return moduleSymbol.name; } } @@ -64019,7 +64414,7 @@ var ts; (function (codefix) { function getMissingMembersInsertion(classDeclaration, possiblyMissingSymbols, checker, newlineChar) { var classMembers = classDeclaration.symbol.members; - var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !(symbol.getName() in classMembers); }); + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !classMembers.has(symbol.getName()); }); var insertion = ""; for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { var symbol = missingMembers_1[_i]; @@ -64038,14 +64433,14 @@ var ts; var name = declaration.name ? declaration.name.getText() : undefined; var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration)); switch (declaration.kind) { - case 151: case 152: - case 146: + case 153: case 147: + case 148: var typeString = checker.typeToString(type, enclosingDeclaration, 0); return "" + visibility + name + ": " + typeString + ";" + newlineChar; - case 148: case 149: + case 150: var signatures = checker.getSignaturesOfType(type, 0); if (!(signatures && signatures.length > 0)) { return ""; @@ -64076,7 +64471,7 @@ var ts; } } function createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker) { - var newSignatureDeclaration = ts.createNode(153); + var newSignatureDeclaration = ts.createNode(154); newSignatureDeclaration.parent = enclosingDeclaration; newSignatureDeclaration.name = signatures[0].getDeclaration().name; var maxNonRestArgs = -1; @@ -64107,7 +64502,7 @@ var ts; } return checker.getSignatureFromDeclaration(newSignatureDeclaration); function createParameterDeclarationWithoutType(index, minArgCount, enclosingSignatureDeclaration) { - var newParameter = ts.createNode(144); + var newParameter = ts.createNode(145); newParameter.symbol = new SymbolConstructor(1, maxArgsParameterSymbolNames[index] || "rest"); newParameter.symbol.valueDeclaration = newParameter; newParameter.symbol.declarations = [newParameter]; @@ -64137,7 +64532,7 @@ var ts; (function (ts) { ts.servicesVersion = "0.5"; function createNode(kind, pos, end, parent) { - var node = kind >= 141 ? new NodeObject(kind, pos, end) : + var node = kind >= 142 ? new NodeObject(kind, pos, end) : kind === 70 ? new IdentifierObject(70, pos, end) : new TokenObject(kind, pos, end); node.parent = parent; @@ -64195,7 +64590,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(293, nodes.pos, nodes.end, this); + var list = createNode(294, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -64214,11 +64609,11 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 141) { + if (this.kind >= 142) { ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 279 && this.kind <= 292; + var useJSDocScanner_1 = this.kind >= 280 && this.kind <= 293; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -64271,8 +64666,10 @@ var ts; if (!children.length) { return undefined; } - var child = children[0]; - return child.kind < 141 ? child : child.getFirstToken(sourceFile); + var child = ts.find(children, function (kid) { return kid.kind < 264 || kid.kind > 293; }); + return child.kind < 142 ? + child : + child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -64280,7 +64677,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 141 ? child : child.getLastToken(sourceFile); + return child.kind < 142 ? child : child.getLastToken(sourceFile); }; return NodeObject; }()); @@ -64477,27 +64874,31 @@ var ts; return this.namedDeclarations; }; SourceFileObject.prototype.computeNamedDeclarations = function () { - var result = ts.createMap(); + var result = ts.createMultiMap(); ts.forEachChild(this, visit); return result; function addDeclaration(declaration) { var name = getDeclarationName(declaration); if (name) { - ts.multiMapAdd(result, name, declaration); + result.add(name, declaration); } } function getDeclarations(name) { - return result[name] || (result[name] = []); + var declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; } function getDeclarationName(declaration) { if (declaration.name) { - var result_8 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_8 !== undefined) { - return result_8; + var result_7 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_7 !== undefined) { + return result_7; } - if (declaration.name.kind === 142) { + if (declaration.name.kind === 143) { var expr = declaration.name.expression; - if (expr.kind === 177) { + if (expr.kind === 178) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -64517,10 +64918,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 226: - case 184: + case 227: + case 185: + case 150: case 149: - case 148: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -64537,30 +64938,30 @@ var ts; } ts.forEachChild(node, visit); break; - case 227: - case 197: case 228: + case 198: case 229: case 230: case 231: - case 235: - case 244: - case 240: - case 235: - case 237: + case 232: + case 236: + case 245: + case 241: + case 236: case 238: - case 151: + case 239: case 152: - case 161: + case 153: + case 162: addDeclaration(node); ts.forEachChild(node, visit); break; - case 144: + case 145: if (!ts.hasModifier(node, 92)) { break; } - case 224: - case 174: { + case 225: + case 175: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -64569,24 +64970,24 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 261: + case 262: + case 148: case 147: - case 146: addDeclaration(node); break; - case 242: + case 243: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 236: + case 237: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 238) { + if (importClause.namedBindings.kind === 239) { addDeclaration(importClause.namedBindings); } else { @@ -65029,10 +65430,10 @@ var ts; if (!symbol || typeChecker.isUnknownSymbol(symbol)) { switch (node.kind) { case 70: - case 177: - case 141: + case 178: + case 142: case 98: - case 167: + case 168: case 96: var type = typeChecker.getTypeAtLocation(node); if (type) { @@ -65071,8 +65472,8 @@ var ts; function getOccurrencesAtPosition(fileName, position) { var results = getOccurrencesAtPositionCore(fileName, position); if (results) { - var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); - results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; }); + var sourceFile_1 = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_1; }); } return results; } @@ -65106,20 +65507,20 @@ var ts; } } function findRenameLocations(fileName, position, findInStrings, findInComments) { - var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments); + var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments, true); return ts.FindAllReferences.convertReferences(referencedSymbols); } function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); + var referencedSymbols = findReferencedSymbols(fileName, position, false, false, false); return ts.FindAllReferences.convertReferences(referencedSymbols); } function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); + var referencedSymbols = findReferencedSymbols(fileName, position, false, false, false); return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); } - function findReferencedSymbols(fileName, position, findInStrings, findInComments) { + function findReferencedSymbols(fileName, position, findInStrings, findInComments, isForRename) { synchronizeHostData(); - return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments); + return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments, isForRename); } function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { synchronizeHostData(); @@ -65161,15 +65562,15 @@ var ts; return; } switch (node.kind) { - case 177: - case 141: + case 178: + case 142: case 9: case 85: case 100: case 94: case 96: case 98: - case 167: + case 168: case 70: break; default: @@ -65181,7 +65582,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 231 && + if (nodeForStartPos.parent.parent.kind === 232 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -65474,15 +65875,15 @@ var ts; function walk(node) { switch (node.kind) { case 70: - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); break; case 9: case 8: if (ts.isDeclarationName(node) || - node.parent.kind === 246 || + node.parent.kind === 247 || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); } break; default: @@ -65495,11 +65896,14 @@ var ts; } } } + function setNameTable(text, node) { + nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); + } } function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 178 && + node.parent.kind === 179 && node.parent.argumentExpression === node; } function getDefaultLibFilePath(options) { @@ -65595,14 +65999,14 @@ var ts; }; } server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings; - function mergeMaps(target, source) { + function mergeMapLikes(target, source) { for (var key in source) { if (ts.hasProperty(source, key)) { target[key] = source[key]; } } } - server.mergeMaps = mergeMaps; + server.mergeMapLikes = mergeMapLikes; function removeItemFromSet(items, itemToRemove) { if (items.length === 0) { return; @@ -65633,19 +66037,19 @@ var ts; } server.asNormalizedPath = asNormalizedPath; function createNormalizedPathMap() { - var map = Object.create(null); + var map = ts.createMap(); return { get: function (path) { - return map[path]; + return map.get(path); }, set: function (path, value) { - map[path] = value; + map.set(path, value); }, contains: function (path) { - return ts.hasProperty(map, path); + return map.has(path); }, remove: function (path) { - delete map[path]; + map.delete(path); } }; } @@ -65669,13 +66073,14 @@ var ts; this.pendingTimeouts = ts.createMap(); } ThrottledOperations.prototype.schedule = function (operationId, delay, cb) { - if (ts.hasProperty(this.pendingTimeouts, operationId)) { - this.host.clearTimeout(this.pendingTimeouts[operationId]); + var pendingTimeout = this.pendingTimeouts.get(operationId); + if (pendingTimeout) { + this.host.clearTimeout(pendingTimeout); } - this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb); + this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb)); }; ThrottledOperations.run = function (self, operationId, cb) { - delete self.pendingTimeouts[operationId]; + self.pendingTimeouts.delete(operationId); cb(); }; return ThrottledOperations; @@ -66777,7 +67182,7 @@ var ts; if (!this.formatCodeSettings) { this.formatCodeSettings = server.getDefaultFormatCodeSettings(this.host); } - server.mergeMaps(this.formatCodeSettings, formatSettings); + server.mergeMapLikes(this.formatCodeSettings, formatSettings); } }; ScriptInfo.prototype.setWatcher = function (watcher) { @@ -66832,6 +67237,9 @@ var ts; ScriptInfo.prototype.positionToLineOffset = function (position) { return this.textStorage.positionToLineOffset(position); }; + ScriptInfo.prototype.isJavaScript = function () { + return this.scriptKind === 1 || this.scriptKind === 2; + }; return ScriptInfo; }()); server.ScriptInfo = ScriptInfo; @@ -66886,15 +67294,16 @@ var ts; var compilerOptions = this.getCompilationSettings(); var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName; for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { - var name_51 = names_2[_i]; - var resolution = newResolutions[name_51]; + var name = names_2[_i]; + var resolution = newResolutions.get(name); if (!resolution) { - var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_51]; + var existingResolution = currentResolutionsInFile && currentResolutionsInFile.get(name); if (moduleResolutionIsValid(existingResolution)) { resolution = existingResolution; } else { - newResolutions[name_51] = resolution = loader(name_51, containingFile, compilerOptions, this); + resolution = loader(name, containingFile, compilerOptions, this); + newResolutions.set(name, resolution); } if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) { this.filesWithChangedSetOfUnresolvedImports.push(path); @@ -67042,18 +67451,19 @@ var ts; var unique = 0; for (var _i = 0, arr1_1 = arr1; _i < arr1_1.length; _i++) { var v = arr1_1[_i]; - if (set[v] !== true) { - set[v] = true; + if (set.get(v) !== true) { + set.set(v, true); unique++; } } for (var _a = 0, arr2_1 = arr2; _a < arr2_1.length; _a++) { var v = arr2_1[_a]; - if (!ts.hasProperty(set, v)) { + var isSet = set.get(v); + if (isSet === undefined) { return false; } - if (set[v] === true) { - set[v] = false; + if (isSet === true) { + set.set(v, false); unique--; } } @@ -67083,38 +67493,38 @@ var ts; if (!typeAcquisition || !typeAcquisition.enable) { return server.emptyArray; } - var entry = this.perProjectCache[project.getProjectName()]; + var entry = this.perProjectCache.get(project.getProjectName()); var result = entry ? entry.typings : server.emptyArray; if (forceRefresh || !entry || typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions) || unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) { - this.perProjectCache[project.getProjectName()] = { + this.perProjectCache.set(project.getProjectName(), { compilerOptions: project.getCompilerOptions(), typeAcquisition: typeAcquisition, typings: result, unresolvedImports: unresolvedImports, poisoned: true - }; + }); this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); } return result; }; TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) { - this.perProjectCache[projectName] = { + this.perProjectCache.set(projectName, { compilerOptions: compilerOptions, typeAcquisition: typeAcquisition, typings: server.toSortedReadonlyArray(newTypings), unresolvedImports: unresolvedImports, poisoned: false - }; + }); }; TypingsCache.prototype.deleteTypingsForProject = function (projectName) { - delete this.perProjectCache[projectName]; + this.perProjectCache.delete(projectName); }; TypingsCache.prototype.onProjectClosed = function (project) { - delete this.perProjectCache[project.getProjectName()]; + this.perProjectCache.delete(project.getProjectName()); this.installer.onProjectClosed(project); }; return TypingsCache; @@ -67142,7 +67552,7 @@ var ts; BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) { for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var statement = _a[_i]; - if (statement.kind !== 231 || statement.name.kind !== 9) { + if (statement.kind !== 232 || statement.name.kind !== 9) { return false; } } @@ -67395,25 +67805,25 @@ var ts; } var queue = fileInfo.referencedBy.slice(0); var fileNameSet = ts.createMap(); - fileNameSet[scriptInfo.fileName] = scriptInfo; + fileNameSet.set(scriptInfo.fileName, scriptInfo); while (queue.length > 0) { var processingFileInfo = queue.pop(); if (processingFileInfo.updateShapeSignature() && processingFileInfo.referencedBy.length > 0) { for (var _i = 0, _a = processingFileInfo.referencedBy; _i < _a.length; _i++) { var potentialFileInfo = _a[_i]; - if (!fileNameSet[potentialFileInfo.scriptInfo.fileName]) { + if (!fileNameSet.has(potentialFileInfo.scriptInfo.fileName)) { queue.push(potentialFileInfo); } } } - fileNameSet[processingFileInfo.scriptInfo.fileName] = processingFileInfo.scriptInfo; + fileNameSet.set(processingFileInfo.scriptInfo.fileName, processingFileInfo.scriptInfo); } var result = []; - for (var fileName in fileNameSet) { - if (shouldEmitFile(fileNameSet[fileName])) { + fileNameSet.forEach(function (scriptInfo, fileName) { + if (shouldEmitFile(scriptInfo)) { result.push(fileName); } - } + }); return result; }; return ModuleBuilder; @@ -67737,7 +68147,9 @@ var ts; }; Project.prototype.removeFile = function (info, detachFromProject) { if (detachFromProject === void 0) { detachFromProject = true; } - this.removeRootFileIfNecessary(info); + if (this.isRoot(info)) { + this.removeRoot(info); + } this.lsHost.notifyFileRemoved(info); this.cachedUnresolvedImportsPerFile.remove(info.path); if (detachFromProject) { @@ -67746,7 +68158,7 @@ var ts; this.markAsDirty(); }; Project.prototype.registerFileUpdate = function (fileName) { - (this.updatedFileNames || (this.updatedFileNames = ts.createMap()))[fileName] = fileName; + (this.updatedFileNames || (this.updatedFileNames = ts.createMap())).set(fileName, fileName); }; Project.prototype.markAsDirty = function () { this.projectStateVersion++; @@ -67754,17 +68166,17 @@ var ts; Project.prototype.extractUnresolvedImportsFromSourceFile = function (file, result) { var cached = this.cachedUnresolvedImportsPerFile.get(file.path); if (cached) { - for (var _i = 0, cached_1 = cached; _i < cached_1.length; _i++) { - var f = cached_1[_i]; + for (var _i = 0, cached_2 = cached; _i < cached_2.length; _i++) { + var f = cached_2[_i]; result.push(f); } return; } var unresolvedImports; if (file.resolvedModules) { - for (var name_52 in file.resolvedModules) { - if (!file.resolvedModules[name_52] && !ts.isExternalModuleNameRelative(name_52)) { - var trimmed = name_52.trim(); + file.resolvedModules.forEach(function (resolvedModule, name) { + if (!resolvedModule && !ts.isExternalModuleNameRelative(name)) { + var trimmed = name.trim(); var i = trimmed.indexOf("/"); if (i !== -1 && trimmed.charCodeAt(0) === 64) { i = trimmed.indexOf("/", i + 1); @@ -67775,7 +68187,7 @@ var ts; (unresolvedImports || (unresolvedImports = [])).push(trimmed); result.push(trimmed); } - } + }); } this.cachedUnresolvedImportsPerFile.set(file.path, unresolvedImports || server.emptyArray); }; @@ -67871,9 +68283,6 @@ var ts; }; Project.prototype.setCompilerOptions = function (compilerOptions) { if (compilerOptions) { - if (this.projectKind === ProjectKind.Inferred) { - compilerOptions.allowJs = true; - } compilerOptions.allowNonTsExtensions = true; if (ts.changesAffectModuleResolution(this.compilerOptions, compilerOptions)) { this.cachedUnresolvedImportsPerFile.clear(); @@ -67909,24 +68318,24 @@ var ts; if (this.projectStructureVersion == this.lastReportedVersion && !updatedFileNames) { return { info: info, projectErrors: this.projectErrors }; } - var lastReportedFileNames = this.lastReportedFileNames; - var currentFiles = ts.arrayToMap(this.getFileNames(), function (x) { return x; }); - var added = []; - var removed = []; - var updated = ts.getOwnKeys(updatedFileNames); - for (var id in currentFiles) { - if (!ts.hasProperty(lastReportedFileNames, id)) { - added.push(id); + var lastReportedFileNames_1 = this.lastReportedFileNames; + var currentFiles_1 = ts.arrayToMap(this.getFileNames(), function (x) { return x; }); + var added_1 = []; + var removed_1 = []; + var updated = ts.arrayFrom(updatedFileNames.keys()); + ts.forEachKey(currentFiles_1, function (id) { + if (!lastReportedFileNames_1.has(id)) { + added_1.push(id); } - } - for (var id in lastReportedFileNames) { - if (!ts.hasProperty(currentFiles, id)) { - removed.push(id); + }); + ts.forEachKey(lastReportedFileNames_1, function (id) { + if (!currentFiles_1.has(id)) { + removed_1.push(id); } - } - this.lastReportedFileNames = currentFiles; + }); + this.lastReportedFileNames = currentFiles_1; this.lastReportedVersion = this.projectStructureVersion; - return { info: info, changes: { added: added, removed: removed, updated: updated }, projectErrors: this.projectErrors }; + return { info: info, changes: { added: added_1, removed: removed_1, updated: updated }, projectErrors: this.projectErrors }; } else { var projectFileNames = this.getFileNames(); @@ -67953,7 +68362,7 @@ var ts; if (symbol && symbol.declarations && symbol.declarations[0]) { var declarationSourceFile = symbol.declarations[0].getSourceFile(); if (declarationSourceFile) { - referencedFiles[declarationSourceFile.path] = true; + referencedFiles.set(declarationSourceFile.path, true); } } } @@ -67964,28 +68373,25 @@ var ts; for (var _b = 0, _c = sourceFile.referencedFiles; _b < _c.length; _b++) { var referencedFile = _c[_b]; var referencedPath = ts.toPath(referencedFile.fileName, currentDirectory, getCanonicalFileName); - referencedFiles[referencedPath] = true; + referencedFiles.set(referencedPath, true); } } if (sourceFile.resolvedTypeReferenceDirectiveNames) { - for (var typeName in sourceFile.resolvedTypeReferenceDirectiveNames) { - var resolvedTypeReferenceDirective = sourceFile.resolvedTypeReferenceDirectiveNames[typeName]; + sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (resolvedTypeReferenceDirective) { if (!resolvedTypeReferenceDirective) { - continue; + return; } var fileName = resolvedTypeReferenceDirective.resolvedFileName; var typeFilePath = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - referencedFiles[typeFilePath] = true; - } + referencedFiles.set(typeFilePath, true); + }); } - var allFileNames = ts.map(Object.keys(referencedFiles), function (key) { return key; }); + var allFileNames = ts.arrayFrom(referencedFiles.keys()); return ts.filter(allFileNames, function (file) { return _this.projectService.host.fileExists(file); }); }; - Project.prototype.removeRootFileIfNecessary = function (info) { - if (this.isRoot(info)) { - remove(this.rootFiles, info); - this.rootFilesMap.remove(info.path); - } + Project.prototype.removeRoot = function (info) { + remove(this.rootFiles, info); + this.rootFilesMap.remove(info.path); }; return Project; }()); @@ -67994,9 +68400,44 @@ var ts; __extends(InferredProject, _super); function InferredProject(projectService, documentRegistry, compilerOptions) { var _this = _super.call(this, InferredProject.newName(), ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this; + _this._isJsInferredProject = false; _this.directoriesWatchedForTsconfig = []; return _this; } + InferredProject.prototype.toggleJsInferredProject = function (isJsInferredProject) { + if (isJsInferredProject !== this._isJsInferredProject) { + this._isJsInferredProject = isJsInferredProject; + this.setCompilerOptions(); + } + }; + InferredProject.prototype.setCompilerOptions = function (options) { + var newOptions = options ? ts.clone(options) : this.getCompilerOptions(); + if (!newOptions) { + return; + } + if (this._isJsInferredProject && typeof newOptions.maxNodeModuleJsDepth !== "number") { + newOptions.maxNodeModuleJsDepth = 2; + } + else if (!this._isJsInferredProject) { + newOptions.maxNodeModuleJsDepth = undefined; + } + newOptions.allowJs = true; + _super.prototype.setCompilerOptions.call(this, newOptions); + }; + InferredProject.prototype.addRoot = function (info) { + if (!this._isJsInferredProject && info.isJavaScript()) { + this.toggleJsInferredProject(true); + } + _super.prototype.addRoot.call(this, info); + }; + InferredProject.prototype.removeRoot = function (info) { + if (this._isJsInferredProject && info.isJavaScript()) { + if (ts.filter(this.getRootScriptInfos(), function (info) { return info.isJavaScript(); }).length === 0) { + this.toggleJsInferredProject(false); + } + } + _super.prototype.removeRoot.call(this, info); + }; InferredProject.prototype.getProjectRootPath = function () { if (this.projectService.useSingleInferredProject) { return undefined; @@ -68084,14 +68525,14 @@ var ts; return; } var configDirectoryPath = ts.getDirectoryPath(this.getConfigFilePath()); - this.directoriesWatchedForWildcards = ts.reduceProperties(this.wildcardDirectories, function (watchers, flag, directory) { + this.directoriesWatchedForWildcards = ts.createMap(); + this.wildcardDirectories.forEach(function (flag, directory) { if (ts.comparePaths(configDirectoryPath, directory, ".", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) { var recursive = (flag & 1) !== 0; _this.projectService.logger.info("Add " + (recursive ? "recursive " : "") + "watcher for: " + directory); - watchers[directory] = _this.projectService.host.watchDirectory(directory, function (path) { return callback(_this, path); }, recursive); + _this.directoriesWatchedForWildcards.set(directory, _this.projectService.host.watchDirectory(directory, function (path) { return callback(_this, path); }, recursive)); } - return watchers; - }, {}); + }); }; ConfiguredProject.prototype.stopWatchingDirectory = function () { if (this.directoryWatcher) { @@ -68111,9 +68552,9 @@ var ts; } this.typeRootsWatchers = undefined; } - for (var id in this.directoriesWatchedForWildcards) { - this.directoriesWatchedForWildcards[id].close(); - } + this.directoriesWatchedForWildcards.forEach(function (watcher) { + watcher.close(); + }); this.directoriesWatchedForWildcards = undefined; this.stopWatchingDirectory(); }; @@ -68190,36 +68631,35 @@ var ts; var option = commandLineOptions_1[_i]; if (typeof option.type === "object") { var optionMap = option.type; - for (var id in optionMap) { - ts.Debug.assert(typeof optionMap[id] === "number"); - } - map[option.name] = optionMap; + optionMap.forEach(function (value) { + ts.Debug.assert(typeof value === "number"); + }); + map.set(option.name, optionMap); } } return map; } var compilerOptionConverters = prepareConvertersForEnumLikeCompilerOptions(ts.optionDeclarations); - var indentStyle = ts.createMap({ + var indentStyle = ts.createMapFromTemplate({ "none": ts.IndentStyle.None, "block": ts.IndentStyle.Block, "smart": ts.IndentStyle.Smart }); function convertFormatOptions(protocolOptions) { if (typeof protocolOptions.indentStyle === "string") { - protocolOptions.indentStyle = indentStyle[protocolOptions.indentStyle.toLowerCase()]; + protocolOptions.indentStyle = indentStyle.get(protocolOptions.indentStyle.toLowerCase()); ts.Debug.assert(protocolOptions.indentStyle !== undefined); } return protocolOptions; } server.convertFormatOptions = convertFormatOptions; function convertCompilerOptions(protocolOptions) { - for (var id in compilerOptionConverters) { + compilerOptionConverters.forEach(function (mappedValues, id) { var propertyValue = protocolOptions[id]; if (typeof propertyValue === "string") { - var mappedValues = compilerOptionConverters[id]; - protocolOptions[id] = mappedValues[propertyValue.toLowerCase()]; + protocolOptions[id] = mappedValues.get(propertyValue.toLowerCase()); } - } + }); return protocolOptions; } server.convertCompilerOptions = convertCompilerOptions; @@ -68286,24 +68726,25 @@ var ts; this.directoryWatchersRefCount = ts.createMap(); } DirectoryWatchers.prototype.stopWatchingDirectory = function (directory) { - this.directoryWatchersRefCount[directory]--; - if (this.directoryWatchersRefCount[directory] === 0) { + var refCount = this.directoryWatchersRefCount.get(directory) - 1; + this.directoryWatchersRefCount.set(directory, refCount); + if (refCount === 0) { this.projectService.logger.info("Close directory watcher for: " + directory); - this.directoryWatchersForTsconfig[directory].close(); - delete this.directoryWatchersForTsconfig[directory]; + this.directoryWatchersForTsconfig.get(directory).close(); + this.directoryWatchersForTsconfig.delete(directory); } }; DirectoryWatchers.prototype.startWatchingContainingDirectoriesForFile = function (fileName, project, callback) { var currentPath = ts.getDirectoryPath(fileName); var parentPath = ts.getDirectoryPath(currentPath); while (currentPath != parentPath) { - if (!this.directoryWatchersForTsconfig[currentPath]) { + if (!this.directoryWatchersForTsconfig.has(currentPath)) { this.projectService.logger.info("Add watcher for: " + currentPath); - this.directoryWatchersForTsconfig[currentPath] = this.projectService.host.watchDirectory(currentPath, callback); - this.directoryWatchersRefCount[currentPath] = 1; + this.directoryWatchersForTsconfig.set(currentPath, this.projectService.host.watchDirectory(currentPath, callback)); + this.directoryWatchersRefCount.set(currentPath, 1); } else { - this.directoryWatchersRefCount[currentPath] += 1; + this.directoryWatchersRefCount.set(currentPath, this.directoryWatchersRefCount.get(currentPath) + 1); } project.directoriesWatchedForTsconfig.push(currentPath); currentPath = parentPath; @@ -68750,7 +69191,7 @@ var ts; files: parsedCommandLine.fileNames, compilerOptions: parsedCommandLine.options, configHasFilesProperty: config["files"] !== undefined, - wildcardDirectories: ts.createMap(parsedCommandLine.wildcardDirectories), + wildcardDirectories: ts.createMapFromTemplate(parsedCommandLine.wildcardDirectories), typeAcquisition: parsedCommandLine.typeAcquisition, compileOnSave: parsedCommandLine.compileOnSave }; @@ -69008,7 +69449,7 @@ var ts; this.logger.info("Host information " + args.hostInfo); } if (args.formatOptions) { - server.mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); + server.mergeMapLikes(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); this.logger.info("Format host information updated"); } if (args.extraFileExtensions) { @@ -69088,13 +69529,13 @@ var ts; this.printProjects(); }; ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) { - var _loop_4 = function (proj) { + var _loop_6 = function (proj) { var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; }); result.push(proj.getChangesSinceVersion(knownProject && knownProject.version)); }; for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) { var proj = currentProjects_1[_i]; - _loop_4(proj); + _loop_6(proj); } }; ProjectService.prototype.synchronizeProjectList = function (knownProjects) { @@ -69153,7 +69594,7 @@ var ts; ProjectService.prototype.closeExternalProject = function (uncheckedFileName, suppressRefresh) { if (suppressRefresh === void 0) { suppressRefresh = false; } var fileName = server.toNormalizedPath(uncheckedFileName); - var configFiles = this.externalProjectToConfiguredProjectMap[fileName]; + var configFiles = this.externalProjectToConfiguredProjectMap.get(fileName); if (configFiles) { var shouldRefreshInferredProjects = false; for (var _i = 0, configFiles_1 = configFiles; _i < configFiles_1.length; _i++) { @@ -69162,7 +69603,7 @@ var ts; shouldRefreshInferredProjects = true; } } - delete this.externalProjectToConfiguredProjectMap[fileName]; + this.externalProjectToConfiguredProjectMap.delete(fileName); if (shouldRefreshInferredProjects && !suppressRefresh) { this.refreshInferredProjects(); } @@ -69178,18 +69619,19 @@ var ts; } }; ProjectService.prototype.openExternalProjects = function (projects) { + var _this = this; var projectsToClose = ts.arrayToMap(this.externalProjects, function (p) { return p.getProjectName(); }, function (_) { return true; }); - for (var externalProjectName in this.externalProjectToConfiguredProjectMap) { - projectsToClose[externalProjectName] = true; - } + ts.forEachKey(this.externalProjectToConfiguredProjectMap, function (externalProjectName) { + projectsToClose.set(externalProjectName, true); + }); for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) { var externalProject = projects_4[_i]; this.openExternalProject(externalProject, true); - delete projectsToClose[externalProject.projectFileName]; - } - for (var externalProjectName in projectsToClose) { - this.closeExternalProject(externalProjectName, true); + projectsToClose.delete(externalProject.projectFileName); } + ts.forEachKey(projectsToClose, function (externalProjectName) { + _this.closeExternalProject(externalProjectName, true); + }); this.refreshInferredProjects(); }; ProjectService.prototype.openExternalProject = function (proj, suppressRefreshOfInferredProjects) { @@ -69231,12 +69673,12 @@ var ts; } this.closeExternalProject(proj.projectFileName, true); } - else if (this.externalProjectToConfiguredProjectMap[proj.projectFileName]) { + else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) { if (!tsConfigFiles) { this.closeExternalProject(proj.projectFileName, true); } else { - var oldConfigFiles = this.externalProjectToConfiguredProjectMap[proj.projectFileName]; + var oldConfigFiles = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName); var iNew = 0; var iOld = 0; while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) { @@ -69261,7 +69703,7 @@ var ts; } } if (tsConfigFiles) { - this.externalProjectToConfiguredProjectMap[proj.projectFileName] = tsConfigFiles; + this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, tsConfigFiles); for (var _b = 0, tsConfigFiles_1 = tsConfigFiles; _b < tsConfigFiles_1.length; _b++) { var tsconfigFile = tsConfigFiles_1[_b]; var project = this.findConfiguredProjectByProjectName(tsconfigFile); @@ -69275,7 +69717,7 @@ var ts; } } else { - delete this.externalProjectToConfiguredProjectMap[proj.projectFileName]; + this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName); this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); } if (!suppressRefreshOfInferredProjects) { @@ -69440,7 +69882,7 @@ var ts; this.logger = logger; this.canUseEvents = canUseEvents; this.changeSeq = 0; - this.handlers = ts.createMap((_a = {}, + this.handlers = ts.createMapFromTemplate((_a = {}, _a[CommandNames.OpenExternalProject] = function (request) { _this.projectService.openExternalProject(request.arguments, false); return _this.requiredResponse(true); @@ -69932,18 +70374,21 @@ var ts; }; Session.prototype.getImplementation = function (args, simplifiedResult) { var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); + var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); var implementations = project.getLanguageService().getImplementationAtPosition(file, position); if (!implementations) { return []; } if (simplifiedResult) { - return implementations.map(function (impl) { return ({ - file: impl.fileName, - start: scriptInfo.positionToLineOffset(impl.textSpan.start), - end: scriptInfo.positionToLineOffset(ts.textSpanEnd(impl.textSpan)) - }); }); + return implementations.map(function (_a) { + var fileName = _a.fileName, textSpan = _a.textSpan; + var scriptInfo = project.getScriptInfo(fileName); + return { + file: fileName, + start: scriptInfo.positionToLineOffset(textSpan.start), + end: scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan)) + }; + }); } else { return implementations; @@ -70353,9 +70798,9 @@ var ts; if (simplifiedResult) { return completions.entries.reduce(function (result, entry) { if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) { - var name_53 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; + var name = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined; - result.push({ name: name_53, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); + result.push({ name: name, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); } return result; }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); }); @@ -70697,13 +71142,13 @@ var ts; return { response: response, responseRequired: true }; }; Session.prototype.addProtocolHandler = function (command, handler) { - if (command in this.handlers) { + if (this.handlers.has(command)) { throw new Error("Protocol handler already exists for command \"" + command + "\""); } - this.handlers[command] = handler; + this.handlers.set(command, handler); }; Session.prototype.executeCommand = function (request) { - var handler = this.handlers[request.command]; + var handler = this.handlers.get(request.command); if (handler) { return handler(request); } @@ -71313,7 +71758,9 @@ var ts; if (settingsJson == null || settingsJson == "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); } - return JSON.parse(settingsJson); + var compilerOptions = JSON.parse(settingsJson); + compilerOptions.allowNonTsExtensions = true; + return compilerOptions; }; LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { var encoded = this.shimHost.getScriptFileNames(); @@ -71751,12 +72198,6 @@ var ts; var compilerOptions = JSON.parse(compilerOptionsJson); var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; - if (resolvedFileName && !compilerOptions.allowJs && ts.fileExtensionIs(resolvedFileName, ".js")) { - return { - resolvedFileName: undefined, - failedLookupLocations: [] - }; - } return { resolvedFileName: resolvedFileName, failedLookupLocations: result.failedLookupLocations diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index 232684eedc66c..16e8f363fdfea 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -17,8 +17,26 @@ declare namespace ts { interface MapLike { [index: string]: T; } - interface Map extends MapLike { - __mapBrand: any; + interface Map { + get(key: string): T; + has(key: string): boolean; + set(key: string, value: T): this; + delete(key: string): boolean; + clear(): void; + forEach(action: (value: T, key: string) => void): void; + readonly size: number; + keys(): Iterator; + values(): Iterator; + entries(): Iterator<[string, T]>; + } + interface Iterator { + next(): { + value: T; + done: false; + } | { + value: never; + done: true; + }; } type Path = string & { __pathBrand: any; @@ -170,172 +188,173 @@ declare namespace ts { ReadonlyKeyword = 130, RequireKeyword = 131, NumberKeyword = 132, - SetKeyword = 133, - StringKeyword = 134, - SymbolKeyword = 135, - TypeKeyword = 136, - UndefinedKeyword = 137, - FromKeyword = 138, - GlobalKeyword = 139, - OfKeyword = 140, - QualifiedName = 141, - ComputedPropertyName = 142, - TypeParameter = 143, - Parameter = 144, - Decorator = 145, - PropertySignature = 146, - PropertyDeclaration = 147, - MethodSignature = 148, - MethodDeclaration = 149, - Constructor = 150, - GetAccessor = 151, - SetAccessor = 152, - CallSignature = 153, - ConstructSignature = 154, - IndexSignature = 155, - TypePredicate = 156, - TypeReference = 157, - FunctionType = 158, - ConstructorType = 159, - TypeQuery = 160, - TypeLiteral = 161, - ArrayType = 162, - TupleType = 163, - UnionType = 164, - IntersectionType = 165, - ParenthesizedType = 166, - ThisType = 167, - TypeOperator = 168, - IndexedAccessType = 169, - MappedType = 170, - LiteralType = 171, - ObjectBindingPattern = 172, - ArrayBindingPattern = 173, - BindingElement = 174, - ArrayLiteralExpression = 175, - ObjectLiteralExpression = 176, - PropertyAccessExpression = 177, - ElementAccessExpression = 178, - CallExpression = 179, - NewExpression = 180, - TaggedTemplateExpression = 181, - TypeAssertionExpression = 182, - ParenthesizedExpression = 183, - FunctionExpression = 184, - ArrowFunction = 185, - DeleteExpression = 186, - TypeOfExpression = 187, - VoidExpression = 188, - AwaitExpression = 189, - PrefixUnaryExpression = 190, - PostfixUnaryExpression = 191, - BinaryExpression = 192, - ConditionalExpression = 193, - TemplateExpression = 194, - YieldExpression = 195, - SpreadElement = 196, - ClassExpression = 197, - OmittedExpression = 198, - ExpressionWithTypeArguments = 199, - AsExpression = 200, - NonNullExpression = 201, - MetaProperty = 202, - TemplateSpan = 203, - SemicolonClassElement = 204, - Block = 205, - VariableStatement = 206, - EmptyStatement = 207, - ExpressionStatement = 208, - IfStatement = 209, - DoStatement = 210, - WhileStatement = 211, - ForStatement = 212, - ForInStatement = 213, - ForOfStatement = 214, - ContinueStatement = 215, - BreakStatement = 216, - ReturnStatement = 217, - WithStatement = 218, - SwitchStatement = 219, - LabeledStatement = 220, - ThrowStatement = 221, - TryStatement = 222, - DebuggerStatement = 223, - VariableDeclaration = 224, - VariableDeclarationList = 225, - FunctionDeclaration = 226, - ClassDeclaration = 227, - InterfaceDeclaration = 228, - TypeAliasDeclaration = 229, - EnumDeclaration = 230, - ModuleDeclaration = 231, - ModuleBlock = 232, - CaseBlock = 233, - NamespaceExportDeclaration = 234, - ImportEqualsDeclaration = 235, - ImportDeclaration = 236, - ImportClause = 237, - NamespaceImport = 238, - NamedImports = 239, - ImportSpecifier = 240, - ExportAssignment = 241, - ExportDeclaration = 242, - NamedExports = 243, - ExportSpecifier = 244, - MissingDeclaration = 245, - ExternalModuleReference = 246, - JsxElement = 247, - JsxSelfClosingElement = 248, - JsxOpeningElement = 249, - JsxClosingElement = 250, - JsxAttribute = 251, - JsxSpreadAttribute = 252, - JsxExpression = 253, - CaseClause = 254, - DefaultClause = 255, - HeritageClause = 256, - CatchClause = 257, - PropertyAssignment = 258, - ShorthandPropertyAssignment = 259, - SpreadAssignment = 260, - EnumMember = 261, - SourceFile = 262, - JSDocTypeExpression = 263, - JSDocAllType = 264, - JSDocUnknownType = 265, - JSDocArrayType = 266, - JSDocUnionType = 267, - JSDocTupleType = 268, - JSDocNullableType = 269, - JSDocNonNullableType = 270, - JSDocRecordType = 271, - JSDocRecordMember = 272, - JSDocTypeReference = 273, - JSDocOptionalType = 274, - JSDocFunctionType = 275, - JSDocVariadicType = 276, - JSDocConstructorType = 277, - JSDocThisType = 278, - JSDocComment = 279, - JSDocTag = 280, - JSDocAugmentsTag = 281, - JSDocParameterTag = 282, - JSDocReturnTag = 283, - JSDocTypeTag = 284, - JSDocTemplateTag = 285, - JSDocTypedefTag = 286, - JSDocPropertyTag = 287, - JSDocTypeLiteral = 288, - JSDocLiteralType = 289, - JSDocNullKeyword = 290, - JSDocUndefinedKeyword = 291, - JSDocNeverKeyword = 292, - SyntaxList = 293, - NotEmittedStatement = 294, - PartiallyEmittedExpression = 295, - MergeDeclarationMarker = 296, - EndOfDeclarationMarker = 297, - Count = 298, + ObjectKeyword = 133, + SetKeyword = 134, + StringKeyword = 135, + SymbolKeyword = 136, + TypeKeyword = 137, + UndefinedKeyword = 138, + FromKeyword = 139, + GlobalKeyword = 140, + OfKeyword = 141, + QualifiedName = 142, + ComputedPropertyName = 143, + TypeParameter = 144, + Parameter = 145, + Decorator = 146, + PropertySignature = 147, + PropertyDeclaration = 148, + MethodSignature = 149, + MethodDeclaration = 150, + Constructor = 151, + GetAccessor = 152, + SetAccessor = 153, + CallSignature = 154, + ConstructSignature = 155, + IndexSignature = 156, + TypePredicate = 157, + TypeReference = 158, + FunctionType = 159, + ConstructorType = 160, + TypeQuery = 161, + TypeLiteral = 162, + ArrayType = 163, + TupleType = 164, + UnionType = 165, + IntersectionType = 166, + ParenthesizedType = 167, + ThisType = 168, + TypeOperator = 169, + IndexedAccessType = 170, + MappedType = 171, + LiteralType = 172, + ObjectBindingPattern = 173, + ArrayBindingPattern = 174, + BindingElement = 175, + ArrayLiteralExpression = 176, + ObjectLiteralExpression = 177, + PropertyAccessExpression = 178, + ElementAccessExpression = 179, + CallExpression = 180, + NewExpression = 181, + TaggedTemplateExpression = 182, + TypeAssertionExpression = 183, + ParenthesizedExpression = 184, + FunctionExpression = 185, + ArrowFunction = 186, + DeleteExpression = 187, + TypeOfExpression = 188, + VoidExpression = 189, + AwaitExpression = 190, + PrefixUnaryExpression = 191, + PostfixUnaryExpression = 192, + BinaryExpression = 193, + ConditionalExpression = 194, + TemplateExpression = 195, + YieldExpression = 196, + SpreadElement = 197, + ClassExpression = 198, + OmittedExpression = 199, + ExpressionWithTypeArguments = 200, + AsExpression = 201, + NonNullExpression = 202, + MetaProperty = 203, + TemplateSpan = 204, + SemicolonClassElement = 205, + Block = 206, + VariableStatement = 207, + EmptyStatement = 208, + ExpressionStatement = 209, + IfStatement = 210, + DoStatement = 211, + WhileStatement = 212, + ForStatement = 213, + ForInStatement = 214, + ForOfStatement = 215, + ContinueStatement = 216, + BreakStatement = 217, + ReturnStatement = 218, + WithStatement = 219, + SwitchStatement = 220, + LabeledStatement = 221, + ThrowStatement = 222, + TryStatement = 223, + DebuggerStatement = 224, + VariableDeclaration = 225, + VariableDeclarationList = 226, + FunctionDeclaration = 227, + ClassDeclaration = 228, + InterfaceDeclaration = 229, + TypeAliasDeclaration = 230, + EnumDeclaration = 231, + ModuleDeclaration = 232, + ModuleBlock = 233, + CaseBlock = 234, + NamespaceExportDeclaration = 235, + ImportEqualsDeclaration = 236, + ImportDeclaration = 237, + ImportClause = 238, + NamespaceImport = 239, + NamedImports = 240, + ImportSpecifier = 241, + ExportAssignment = 242, + ExportDeclaration = 243, + NamedExports = 244, + ExportSpecifier = 245, + MissingDeclaration = 246, + ExternalModuleReference = 247, + JsxElement = 248, + JsxSelfClosingElement = 249, + JsxOpeningElement = 250, + JsxClosingElement = 251, + JsxAttribute = 252, + JsxSpreadAttribute = 253, + JsxExpression = 254, + CaseClause = 255, + DefaultClause = 256, + HeritageClause = 257, + CatchClause = 258, + PropertyAssignment = 259, + ShorthandPropertyAssignment = 260, + SpreadAssignment = 261, + EnumMember = 262, + SourceFile = 263, + JSDocTypeExpression = 264, + JSDocAllType = 265, + JSDocUnknownType = 266, + JSDocArrayType = 267, + JSDocUnionType = 268, + JSDocTupleType = 269, + JSDocNullableType = 270, + JSDocNonNullableType = 271, + JSDocRecordType = 272, + JSDocRecordMember = 273, + JSDocTypeReference = 274, + JSDocOptionalType = 275, + JSDocFunctionType = 276, + JSDocVariadicType = 277, + JSDocConstructorType = 278, + JSDocThisType = 279, + JSDocComment = 280, + JSDocTag = 281, + JSDocAugmentsTag = 282, + JSDocParameterTag = 283, + JSDocReturnTag = 284, + JSDocTypeTag = 285, + JSDocTemplateTag = 286, + JSDocTypedefTag = 287, + JSDocPropertyTag = 288, + JSDocTypeLiteral = 289, + JSDocLiteralType = 290, + JSDocNullKeyword = 291, + JSDocUndefinedKeyword = 292, + JSDocNeverKeyword = 293, + SyntaxList = 294, + NotEmittedStatement = 295, + PartiallyEmittedExpression = 296, + MergeDeclarationMarker = 297, + EndOfDeclarationMarker = 298, + Count = 299, FirstAssignment = 57, LastAssignment = 69, FirstCompoundAssignment = 58, @@ -343,15 +362,15 @@ declare namespace ts { FirstReservedWord = 71, LastReservedWord = 106, FirstKeyword = 71, - LastKeyword = 140, + LastKeyword = 141, FirstFutureReservedWord = 107, LastFutureReservedWord = 115, - FirstTypeNode = 156, - LastTypeNode = 171, + FirstTypeNode = 157, + LastTypeNode = 172, FirstPunctuation = 16, LastPunctuation = 69, FirstToken = 0, - LastToken = 140, + LastToken = 141, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -360,11 +379,11 @@ declare namespace ts { LastTemplateToken = 15, FirstBinaryOperator = 26, LastBinaryOperator = 69, - FirstNode = 141, - FirstJSDocNode = 263, - LastJSDocNode = 289, - FirstJSDocTagNode = 279, - LastJSDocTagNode = 292, + FirstNode = 142, + FirstJSDocNode = 264, + LastJSDocNode = 293, + FirstJSDocTagNode = 280, + LastJSDocTagNode = 293, } const enum NodeFlags { None = 0, @@ -622,7 +641,7 @@ declare namespace ts { _typeNodeBrand: any; } interface KeywordTypeNode extends TypeNode { - kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword; + kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword; } interface ThisTypeNode extends TypeNode { kind: SyntaxKind.ThisType; @@ -1518,7 +1537,7 @@ declare namespace ts { getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; - getBaseTypes(type: InterfaceType): ObjectType[]; + getBaseTypes(type: InterfaceType): BaseType[]; getReturnTypeOfSignature(signature: Signature): Type; getNonNullableType(type: Type): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; @@ -1718,6 +1737,7 @@ declare namespace ts { Intersection = 131072, Index = 262144, IndexedAccess = 524288, + NonPrimitive = 16777216, Literal = 480, StringOrNumberLiteral = 96, PossiblyFalsy = 7406, @@ -1727,10 +1747,10 @@ declare namespace ts { EnumLike = 272, UnionOrIntersection = 196608, StructuredType = 229376, - StructuredOrTypeParameter = 507904, + StructuredOrTypeVariable = 1032192, TypeVariable = 540672, - Narrowable = 1033215, - NotUnionOrUnit = 33281, + Narrowable = 17810431, + NotUnionOrUnit = 16810497, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -1746,7 +1766,7 @@ declare namespace ts { regularType?: LiteralType; } interface EnumType extends Type { - memberTypes: Map; + memberTypes: EnumLiteralType[]; } interface EnumLiteralType extends LiteralType { baseType: EnumType & UnionType; @@ -1762,6 +1782,7 @@ declare namespace ts { ObjectLiteral = 128, EvolvingArray = 256, ObjectLiteralPatternWithComputedProperties = 512, + NonPrimitive = 1024, ClassOrInterface = 3, } interface ObjectType extends Type { @@ -1773,6 +1794,7 @@ declare namespace ts { localTypeParameters: TypeParameter[]; thisType: TypeParameter; } + type BaseType = ObjectType | IntersectionType; interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; declaredCallSignatures: Signature[]; @@ -1956,6 +1978,7 @@ declare namespace ts { None = 0, Preserve = 1, React = 2, + ReactNative = 3, } const enum NewLineKind { CarriageReturnLineFeed = 0, @@ -2068,6 +2091,8 @@ declare namespace ts { declare namespace ts { const version = "2.2.0"; } +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; +declare function clearTimeout(handle: any): void; declare namespace ts { type FileWatcherCallback = (fileName: string, removed?: boolean) => void; type DirectoryWatcherCallback = (fileName: string) => void; @@ -2157,8 +2182,8 @@ declare namespace ts { function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; - function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined; function getShebang(text: string): string; function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; @@ -2186,6 +2211,9 @@ declare namespace ts { }; } declare namespace ts { + interface Push { + push(value: T): void; + } function moduleHasNonRelativeName(moduleName: string): boolean; function getEffectiveTypeRoots(options: CompilerOptions, host: { directoryExists?: (directoryName: string) => boolean; @@ -2294,7 +2322,7 @@ declare namespace ts { getConstructSignatures(): Signature[]; getStringIndexType(): Type; getNumberIndexType(): Type; - getBaseTypes(): ObjectType[]; + getBaseTypes(): BaseType[]; getNonNullableType(): Type; } interface Signature { @@ -3613,9 +3641,10 @@ declare namespace ts.server.protocol { namespace JsxEmit { type None = "None"; type Preserve = "Preserve"; + type ReactNative = "ReactNative"; type React = "React"; } - type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React; + type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React | JsxEmit.ReactNative; namespace ModuleKind { type None = "None"; type CommonJS = "CommonJS"; @@ -3759,7 +3788,7 @@ declare namespace ts.server { function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never; } function getDefaultFormatCodeSettings(host: ServerHost): FormatCodeSettings; - function mergeMaps(target: MapLike, source: MapLike): void; + function mergeMapLikes(target: MapLike, source: MapLike): void; function removeItemFromSet(items: T[], itemToRemove: T): void; type NormalizedPath = string & { __normalizedPathTag: any; @@ -3964,6 +3993,7 @@ declare namespace ts.server { lineToTextSpan(line: number): TextSpan; lineOffsetToPosition(line: number, offset: number): number; positionToLineOffset(position: number): ILineInfo; + isJavaScript(): boolean; } } declare namespace ts.server { @@ -4110,12 +4140,17 @@ declare namespace ts.server { setCompilerOptions(compilerOptions: CompilerOptions): void; reloadScript(filename: NormalizedPath, tempFileName?: NormalizedPath): boolean; getReferencedFiles(path: Path): Path[]; - private removeRootFileIfNecessary(info); + protected removeRoot(info: ScriptInfo): void; } class InferredProject extends Project { private static newName; + private _isJsInferredProject; + toggleJsInferredProject(isJsInferredProject: boolean): void; + setCompilerOptions(options?: CompilerOptions): void; directoriesWatchedForTsconfig: string[]; constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions); + addRoot(info: ScriptInfo): void; + removeRoot(info: ScriptInfo): void; getProjectRootPath(): string; close(): void; getTypeAcquisition(): TypeAcquisition; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index ab1a5cdfe053f..b04ee3a2f9bf8 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -98,32 +98,32 @@ var ts; var measures; function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } performance.mark = mark; function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; function enable() { @@ -145,19 +145,93 @@ var ts; ts.version = "2.2.0"; })(ts || (ts = {})); (function (ts) { - var createObject = Object.create; - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + function createDictionaryObject() { + var map = Object.create(null); map["__"] = undefined; delete map["__"]; + return map; + } + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -170,32 +244,27 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -209,6 +278,10 @@ var ts; return getCanonicalFileName(nonCanonicalizedPath); } ts.toPath = toPath; + function length(array) { + return array ? array.length : 0; + } + ts.length = length; function forEach(array, callback) { if (array) { for (var i = 0; i < array.length; i++) { @@ -249,6 +322,15 @@ var ts; return undefined; } ts.find = find; + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; function findMap(array, callback) { for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); @@ -470,21 +552,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -768,38 +847,46 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + function arrayFrom(iterator) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + ts.arrayFrom = arrayFrom; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } } - return false; + return undefined; + var _b; } - ts.someProperties = someProperties; - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; + ts.forEachEntry = forEachEntry; + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } } + return undefined; + var _b; } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachKey = forEachKey; + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); } - ts.appendProperty = appendProperty; + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -815,14 +902,6 @@ var ts; return t; } ts.assign = assign; - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -847,23 +926,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -890,27 +960,32 @@ var ts; return result; } ts.extend = extend; - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; function isArray(value) { return Array.isArray ? Array.isArray(value) : value instanceof Array; } @@ -1088,8 +1163,10 @@ var ts; if (b === undefined) return 1; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); return result < 0 ? -1 : result > 0 ? 1 : 0; } a = a.toUpperCase(); @@ -1471,36 +1548,26 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } var replaceWildcardCharacter = usage === "files" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther; var singleAsteriskRegexFragment = usage === "files" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther; var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; function isImplicitGlob(lastPathComponent) { return !/[.*?]/.test(lastPathComponent); } @@ -1570,6 +1637,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -1582,34 +1650,48 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); + } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -1625,14 +1707,14 @@ var ts; includeBasePaths.push(getIncludeBasePath(absolute)); } includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } }; for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -2079,32 +2161,32 @@ var ts; var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; function createWatchedFileSet() { var dirWatchers = ts.createMap(); - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -2116,16 +2198,19 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { var fileName = typeof relativeFileName !== "string" ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } @@ -2190,10 +2275,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -2870,6 +2955,7 @@ var ts; Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2880,6 +2966,7 @@ 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_2607", message: "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_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other 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_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -2928,6 +3015,7 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, @@ -3052,7 +3140,7 @@ var ts; Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'" }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -3067,6 +3155,7 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, @@ -3100,7 +3189,7 @@ var ts; Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'" }, File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, @@ -3234,9 +3323,10 @@ var ts; Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: {0}" }, Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, @@ -3252,7 +3342,7 @@ var ts; return token >= 70; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ + var textToToken = ts.createMapFromTemplate({ "abstract": 116, "any": 118, "as": 117, @@ -3276,7 +3366,7 @@ var ts; "false": 85, "finally": 86, "for": 87, - "from": 138, + "from": 139, "function": 88, "get": 124, "if": 89, @@ -3294,27 +3384,28 @@ var ts; "new": 93, "null": 94, "number": 132, + "object": 133, "package": 110, "private": 111, "protected": 112, "public": 113, "readonly": 130, "require": 131, - "global": 139, + "global": 140, "return": 95, - "set": 133, + "set": 134, "static": 114, - "string": 134, + "string": 135, "super": 96, "switch": 97, - "symbol": 135, + "symbol": 136, "this": 98, "throw": 99, "true": 100, "try": 101, - "type": 136, + "type": 137, "typeof": 102, - "undefined": 137, + "undefined": 138, "var": 103, "void": 104, "while": 105, @@ -3322,7 +3413,7 @@ var ts; "yield": 115, "async": 119, "await": 120, - "of": 140, + "of": 141, "{": 16, "}": 17, "(": 18, @@ -3417,9 +3508,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; - } + source.forEach(function (value, name) { + result[value] = name; + }); return result; } var tokenStrings = makeReverseMap(textToToken); @@ -3428,7 +3519,7 @@ var ts; } ts.tokenToString = tokenToString; function stringToToken(s) { - return textToToken[s]; + return textToToken.get(s); } ts.stringToToken = stringToToken; function computeLineStarts(text) { @@ -3488,7 +3579,6 @@ var ts; return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -4147,8 +4237,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= 97 && ch <= 122) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = 70; @@ -4858,12 +4951,13 @@ var ts; }, { name: "jsx", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "preserve": 1, + "react-native": 3, "react": 2 }), paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, }, { name: "reactNamespace", @@ -4893,7 +4987,7 @@ var ts; { name: "module", shortName: "m", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "none": ts.ModuleKind.None, "commonjs": ts.ModuleKind.CommonJS, "amd": ts.ModuleKind.AMD, @@ -4907,7 +5001,7 @@ var ts; }, { name: "newLine", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "crlf": 0, "lf": 1 }), @@ -5004,8 +5098,8 @@ var ts; shortName: "p", type: "string", isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY }, { name: "removeComments", @@ -5055,7 +5149,7 @@ var ts; { name: "target", shortName: "t", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es3": 0, "es5": 1, "es6": 2, @@ -5092,7 +5186,7 @@ var ts; }, { name: "moduleResolution", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "node": ts.ModuleResolutionKind.NodeJs, "classic": ts.ModuleResolutionKind.Classic, }), @@ -5197,7 +5291,7 @@ var ts; type: "list", element: { name: "lib", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es5": "lib.es5.d.ts", "es6": "lib.es2015.d.ts", "es2015": "lib.es2015.d.ts", @@ -5297,9 +5391,9 @@ var ts; var optionNameMap = ts.createMap(); var shortOptionNames = ts.createMap(); ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; @@ -5307,7 +5401,7 @@ var ts; } ts.getOptionNameMap = getOptionNameMap; function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; @@ -5356,11 +5450,12 @@ var ts; } else if (s.charCodeAt(0) === 45) { s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); - if (s in shortOptionNames) { - s = shortOptionNames[s]; + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - var opt = optionNameMap[s]; + var opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -5486,19 +5581,18 @@ var ts; } } function getNameOfCompilerOptionValue(value, customTypeMap) { - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { return key; } - } - return undefined; + }); } function serializeCompilerOptions(options) { - var result = ts.createMap(); + var result = {}; var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_5 in options) { - if (ts.hasProperty(options, name_5)) { - switch (name_5) { + for (var name in options) { + if (ts.hasProperty(options, name)) { + switch (name) { case "init": case "watch": case "version": @@ -5506,12 +5600,12 @@ var ts; case "project": break; default: - var value = options[name_5]; - var optionDefinition = optionsNameMap[name_5.toLowerCase()]; + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { - result[name_5] = value; + result[name] = value; } else { if (optionDefinition.type === "list") { @@ -5520,10 +5614,10 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_5] = convertedValue; + result[name] = convertedValue; } else { - result[name_5] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -5730,8 +5824,8 @@ var ts; } var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; + var opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -5765,8 +5859,9 @@ var ts; } function convertJsonOptionOfCustomType(opt, value, errors) { var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + var val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -5800,7 +5895,7 @@ var ts; for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } if (include && include.length > 0) { @@ -5811,14 +5906,13 @@ var ts; } removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); return { fileNames: literalFiles.concat(wildcardFiles), wildcardDirectories: wildcardDirectories @@ -5826,8 +5920,8 @@ var ts; } function validateSpecs(specs, errors, allowTrailingRecursion) { var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } @@ -5846,7 +5940,7 @@ var ts; function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); + var wildcardDirectories = {}; if (include !== undefined) { var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { @@ -5867,14 +5961,16 @@ var ts; } } } - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } } } - } + ; } return wildcardDirectories; } @@ -5897,7 +5993,7 @@ var ts; for (var i = 0; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i]; var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -5909,13 +6005,9 @@ var ts; for (var i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i]; var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - function addFileToOutput(output, file) { - output.push(file); - return output; - } function caseSensitiveKeyMapper(key) { return key; } @@ -6159,9 +6251,10 @@ var ts; if (!moduleHasNonRelativeName(nonRelativeModuleName)) { return undefined; } - var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); if (!perModuleNameCache) { - moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); } return perModuleNameCache; } @@ -6181,12 +6274,12 @@ var ts; var commonPrefix = getCommonPrefix(path, resolvedFileName); var current = path; while (true) { - var parent_1 = ts.getDirectoryPath(current); - if (parent_1 === current || directoryPathMap.contains(parent_1)) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { break; } - directoryPathMap.set(parent_1, result); - current = parent_1; + directoryPathMap.set(parent, result); + current = parent; if (current == commonPrefix) { break; } @@ -6217,7 +6310,7 @@ var ts; } var containingDirectory = ts.getDirectoryPath(containingFile); var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); - var result = perFolderCache && perFolderCache[moduleName]; + var result = perFolderCache && perFolderCache.get(moduleName); if (result) { if (traceEnabled) { trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); @@ -6245,7 +6338,7 @@ var ts; break; } if (perFolderCache) { - perFolderCache[moduleName] = result; + perFolderCache.set(moduleName, result); var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); if (perModuleNameCache) { perModuleNameCache.set(containingDirectory, result); @@ -6728,25 +6821,25 @@ var ts; } ts.getFullWidth = getFullWidth; function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); } ts.hasResolvedModule = hasResolvedModule; function getResolvedModule(sourceFile, moduleNameText) { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; } ts.getResolvedModule = getResolvedModule; function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = ts.createMap(); } - sourceFile.resolvedModules[moduleNameText] = resolvedModule; + sourceFile.resolvedModules.set(moduleNameText, resolvedModule); } ts.setResolvedModule = setResolvedModule; function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { if (!sourceFile.resolvedTypeReferenceDirectiveNames) { sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap(); } - sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective); } ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; function moduleResolutionIsEqualTo(oldResolution, newResolution) { @@ -6765,7 +6858,7 @@ var ts; } for (var i = 0; i < names.length; i++) { var newResolution = newResolutions[i]; - var oldResolution = oldResolutions && oldResolutions[names[i]]; + var oldResolution = oldResolutions && oldResolutions.get(names[i]); var changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; @@ -6792,7 +6885,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 262) { + while (node && node.kind !== 263) { node = node.parent; } return node; @@ -6800,11 +6893,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 205: - case 233: - case 212: + case 206: + case 234: case 213: case 214: + case 215: return true; } return false; @@ -6869,18 +6962,18 @@ var ts; if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 293 && node._children.length > 0) { + if (node.kind === 294 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 263 && node.kind <= 289; + return node.kind >= 264 && node.kind <= 293; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 279 && node.kind <= 292; + return node.kind >= 280 && node.kind <= 293; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -6940,18 +7033,36 @@ var ts; } ts.getLiteralText = getLiteralText; function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 && text.length > 1) { + return node.kind === 8 + && (getNumericLiteralFlags(text, 6) & 6) !== 0; + } + ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; + function getNumericLiteralFlags(text, hint) { + if (text.length > 1) { switch (text.charCodeAt(1)) { case 98: case 66: + return 2; case 111: case 79: - return true; + return 4; + case 120: + case 88: + return 1; + } + if (hint & 8) { + for (var i = text.length - 1; i >= 0; i--) { + switch (text.charCodeAt(i)) { + case 101: + case 69: + return 8; + } + } } } - return false; + return 0; } - ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; + ts.getNumericLiteralFlags = getNumericLiteralFlags; function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; } @@ -6974,11 +7085,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 224 && node.parent.kind === 257; + return node.kind === 225 && node.parent.kind === 258; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 231 && + return node && node.kind === 232 && (node.name.kind === 9 || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -6987,11 +7098,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return node.kind === 231 && (!node.body); + return node && node.kind === 232 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 262 || - node.kind === 231 || + return node.kind === 263 || + node.kind === 232 || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -7004,9 +7115,9 @@ var ts; return false; } switch (node.parent.kind) { - case 262: + case 263: return ts.isExternalModule(node.parent); - case 232: + case 233: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -7018,22 +7129,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 262: - case 233: - case 257: - case 231: - case 212: + case 263: + case 234: + case 258: + case 232: case 213: case 214: - case 150: - case 149: + case 215: case 151: + case 150: case 152: - case 226: - case 184: + case 153: + case 227: case 185: + case 186: return true; - case 205: + case 206: return parentNode && !isFunctionLike(parentNode); } return false; @@ -7060,7 +7171,7 @@ var ts; case 9: case 8: return name.text; - case 142: + case 143: if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } @@ -7072,9 +7183,9 @@ var ts; switch (name.kind) { case 70: return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name); - case 141: + case 142: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 177: + case 178: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -7111,7 +7222,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 205) { + if (node.body && node.body.kind === 206) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -7123,29 +7234,29 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 262: + case 263: 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 224: - case 174: - case 227: - case 197: + case 225: + case 175: case 228: + case 198: + case 229: + case 232: case 231: - case 230: - case 261: - case 226: - case 184: - case 149: - case 151: + case 262: + case 227: + case 185: + case 150: case 152: - case 229: + case 153: + case 230: errorNode = node.name; break; - case 185: + case 186: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -7166,7 +7277,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 230 && isConst(node); + return node.kind === 231 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -7179,11 +7290,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 179 && n.expression.kind === 96; + return n.kind === 180 && n.expression.kind === 96; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 208 + return node.kind === 209 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; @@ -7196,10 +7307,10 @@ var ts; } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 144 || - node.kind === 143 || - node.kind === 184 || - node.kind === 185) ? + var commentRanges = (node.kind === 145 || + node.kind === 144 || + node.kind === 185 || + node.kind === 186) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, function (comment) { @@ -7213,69 +7324,69 @@ var ts; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (156 <= node.kind && node.kind <= 171) { + if (157 <= node.kind && node.kind <= 172) { return true; } switch (node.kind) { case 118: case 132: - case 134: - case 121: case 135: - case 137: + case 121: + case 136: + case 138: case 129: return true; case 104: - return node.parent.kind !== 188; - case 199: + return node.parent.kind !== 189; + case 200: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 70: - if (node.parent.kind === 141 && node.parent.right === node) { + if (node.parent.kind === 142 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 177 && node.parent.name === node) { + else if (node.parent.kind === 178 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 70 || node.kind === 141 || node.kind === 177, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 141: - case 177: + ts.Debug.assert(node.kind === 70 || node.kind === 142 || node.kind === 178, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 142: + case 178: case 98: - var parent_2 = node.parent; - if (parent_2.kind === 160) { + var parent = node.parent; + if (parent.kind === 161) { return false; } - if (156 <= parent_2.kind && parent_2.kind <= 171) { + if (157 <= parent.kind && parent.kind <= 172) { return true; } - switch (parent_2.kind) { - case 199: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); - case 143: - return node === parent_2.constraint; - case 147: - case 146: + switch (parent.kind) { + case 200: + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 144: - case 224: - return node === parent_2.type; - case 226: - case 184: + return node === parent.constraint; + case 148: + case 147: + case 145: + case 225: + return node === parent.type; + case 227: case 185: + case 186: + case 151: case 150: case 149: - case 148: - case 151: case 152: - return node === parent_2.type; case 153: + return node === parent.type; case 154: case 155: - return node === parent_2.type; - case 182: - return node === parent_2.type; - case 179: + case 156: + return node === parent.type; + case 183: + return node === parent.type; case 180: - return parent_2.typeArguments && ts.indexOf(parent_2.typeArguments, node) >= 0; case 181: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 182: return false; } } @@ -7293,30 +7404,30 @@ var ts; } ts.isChildOfNodeWithKind = isChildOfNodeWithKind; function isPrefixUnaryExpression(node) { - return node.kind === 190; + return node.kind === 191; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 217: + case 218: return visitor(node); - case 233: - case 205: - case 209: + case 234: + case 206: case 210: case 211: case 212: case 213: case 214: - case 218: + case 215: case 219: - case 254: - case 255: case 220: - case 222: - case 257: + case 255: + case 256: + case 221: + case 223: + case 258: return ts.forEachChild(node, traverse); } } @@ -7326,24 +7437,24 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 195: + case 196: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 230: - case 228: case 231: case 229: - case 227: - case 197: + case 232: + case 230: + case 228: + case 198: return; default: if (isFunctionLike(node)) { - var name_6 = node.name; - if (name_6 && name_6.kind === 142) { - traverse(name_6.expression); + var name = node.name; + if (name && name.kind === 143) { + traverse(name.expression); return; } } @@ -7355,10 +7466,10 @@ var ts; } ts.forEachYieldExpression = forEachYieldExpression; function getRestParameterElementType(node) { - if (node && node.kind === 162) { + if (node && node.kind === 163) { return node.elementType; } - else if (node && node.kind === 157) { + else if (node && node.kind === 158) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -7369,14 +7480,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 174: - case 261: - case 144: - case 258: - case 147: - case 146: + case 175: + case 262: + case 145: case 259: - case 224: + case 148: + case 147: + case 260: + case 225: return true; } } @@ -7384,11 +7495,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 151 || node.kind === 152); + return node && (node.kind === 152 || node.kind === 153); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 227 || node.kind === 197); + return node && (node.kind === 228 || node.kind === 198); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -7397,19 +7508,19 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 150: - case 184: - case 226: + case 151: case 185: + case 227: + case 186: + case 150: case 149: - case 148: - case 151: case 152: case 153: case 154: case 155: - case 158: + case 156: case 159: + case 160: return true; } return false; @@ -7417,13 +7528,13 @@ var ts; ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 226: - case 184: + case 153: + case 227: + case 185: return true; } return false; @@ -7431,13 +7542,13 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 212: case 213: case 214: - case 210: + case 215: case 211: + case 212: return true; - case 220: + case 221: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -7448,7 +7559,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 220) { + if (node.statement.kind !== 221) { return node.statement; } node = node.statement; @@ -7456,17 +7567,17 @@ var ts; } ts.unwrapInnermostStatmentOfLabel = unwrapInnermostStatmentOfLabel; function isFunctionBlock(node) { - return node && node.kind === 205 && isFunctionLike(node.parent); + return node && node.kind === 206 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 149 && node.parent.kind === 176; + return node && node.kind === 150 && node.parent.kind === 177; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { - return node.kind === 149 && - (node.parent.kind === 176 || - node.parent.kind === 197); + return node.kind === 150 && + (node.parent.kind === 177 || + node.parent.kind === 198); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -7502,39 +7613,39 @@ var ts; return undefined; } switch (node.kind) { - case 142: + case 143: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 185: + case 186: if (!includeArrowFunctions) { continue; } - case 226: - case 184: - case 231: - case 147: - case 146: - case 149: + case 227: + case 185: + case 232: case 148: + case 147: case 150: + case 149: case 151: case 152: case 153: case 154: case 155: - case 230: - case 262: + case 156: + case 231: + case 263: return node; } } @@ -7544,9 +7655,9 @@ var ts; var container = getThisContainer(node, false); if (container) { switch (container.kind) { - case 150: - case 226: - case 184: + case 151: + case 227: + case 185: return container; } } @@ -7560,25 +7671,25 @@ var ts; return node; } switch (node.kind) { - case 142: + case 143: node = node.parent; break; - case 226: - case 184: + case 227: case 185: + case 186: if (!stopOnFunctions) { continue; } - case 147: - case 146: - case 149: case 148: + case 147: case 150: + case 149: case 151: case 152: + case 153: return node; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { @@ -7590,36 +7701,36 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 184 || func.kind === 185) { + if (func.kind === 185 || func.kind === 186) { var prev = func; - var parent_3 = func.parent; - while (parent_3.kind === 183) { - prev = parent_3; - parent_3 = parent_3.parent; + var parent = func.parent; + while (parent.kind === 184) { + prev = parent; + parent = parent.parent; } - if (parent_3.kind === 179 && parent_3.expression === prev) { - return parent_3; + if (parent.kind === 180 && parent.expression === prev) { + return parent; } } } ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; function isSuperProperty(node) { var kind = node.kind; - return (kind === 177 || kind === 178) + return (kind === 178 || kind === 179) && node.expression.kind === 96; } ts.isSuperProperty = isSuperProperty; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 157: - case 273: + case 158: + case 274: return node.typeName; - case 199: + case 200: return isEntityNameExpression(node.expression) ? node.expression : undefined; case 70: - case 141: + case 142: return node; } return undefined; @@ -7627,10 +7738,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function isCallLikeExpression(node) { switch (node.kind) { - case 179: case 180: case 181: - case 145: + case 182: + case 146: return true; default: return false; @@ -7638,7 +7749,7 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function getInvokedExpression(node) { - if (node.kind === 181) { + if (node.kind === 182) { return node.tag; } return node.expression; @@ -7646,21 +7757,21 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 227: + case 228: return true; - case 147: - return node.parent.kind === 227; - case 151: + case 148: + return node.parent.kind === 228; case 152: - case 149: + case 153: + case 150: return node.body !== undefined - && node.parent.kind === 227; - case 144: + && node.parent.kind === 228; + case 145: return node.parent.body !== undefined - && (node.parent.kind === 150 - || node.parent.kind === 149 - || node.parent.kind === 152) - && node.parent.parent.kind === 227; + && (node.parent.kind === 151 + || node.parent.kind === 150 + || node.parent.kind === 153) + && node.parent.parent.kind === 228; } return false; } @@ -7676,19 +7787,19 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 227: + case 228: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 149: - case 152: + case 150: + case 153: return ts.forEach(node.parameters, nodeIsDecorated); } } ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 249 || - parent.kind === 248 || - parent.kind === 250) { + if (parent.kind === 250 || + parent.kind === 249 || + parent.kind === 251) { return parent.tagName === node; } return false; @@ -7702,96 +7813,96 @@ var ts; case 100: case 85: case 11: - case 175: case 176: case 177: case 178: case 179: case 180: case 181: - case 200: case 182: case 201: case 183: + case 202: case 184: - case 197: case 185: - case 188: + case 198: case 186: + case 189: case 187: - case 190: + case 188: case 191: case 192: case 193: - case 196: case 194: + case 197: + case 195: case 12: - case 198: - case 247: + case 199: case 248: - case 195: - case 189: - case 202: + case 249: + case 196: + case 190: + case 203: return true; - case 141: - while (node.parent.kind === 141) { + case 142: + while (node.parent.kind === 142) { node = node.parent; } - return node.parent.kind === 160 || isJSXTagName(node); + return node.parent.kind === 161 || isJSXTagName(node); case 70: - if (node.parent.kind === 160 || isJSXTagName(node)) { + if (node.parent.kind === 161 || isJSXTagName(node)) { return true; } case 8: case 9: case 98: - var parent_4 = node.parent; - switch (parent_4.kind) { - case 224: - case 144: + var parent = node.parent; + switch (parent.kind) { + case 225: + case 145: + case 148: case 147: - case 146: - case 261: - case 258: - case 174: - return parent_4.initializer === node; - case 208: + case 262: + case 259: + case 175: + return parent.initializer === node; case 209: case 210: case 211: - case 217: + case 212: case 218: case 219: - case 254: - case 221: - case 219: - return parent_4.expression === node; - case 212: - var forStatement = parent_4; - return (forStatement.initializer === node && forStatement.initializer.kind !== 225) || + case 220: + case 255: + case 222: + case 220: + return parent.expression === node; + case 213: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 226) || forStatement.condition === node || forStatement.incrementor === node; - case 213: case 214: - var forInStatement = parent_4; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 225) || + case 215: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 226) || forInStatement.expression === node; - case 182: - case 200: - return node === parent_4.expression; - case 203: - return node === parent_4.expression; - case 142: - return node === parent_4.expression; - case 145: + case 183: + case 201: + return node === parent.expression; + case 204: + return node === parent.expression; + case 143: + return node === parent.expression; + case 146: + case 254: case 253: - case 252: - case 260: + case 261: return true; - case 199: - return parent_4.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_4); + case 200: + return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: - if (isPartOfExpression(parent_4)) { + if (isPartOfExpression(parent)) { return true; } } @@ -7806,7 +7917,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 235 && node.moduleReference.kind === 246; + return node.kind === 236 && node.moduleReference.kind === 247; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7815,7 +7926,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 235 && node.moduleReference.kind !== 246; + return node.kind === 236 && node.moduleReference.kind !== 247; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7827,7 +7938,7 @@ var ts; } ts.isInJavaScriptFile = isInJavaScriptFile; function isRequireCall(expression, checkArgumentIsStringLiteral) { - var isRequire = expression.kind === 179 && + var isRequire = expression.kind === 180 && expression.expression.kind === 70 && expression.expression.text === "require" && expression.arguments.length === 1; @@ -7839,9 +7950,9 @@ var ts; } ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 224) { + if (s.valueDeclaration && s.valueDeclaration.kind === 225) { var declaration = s.valueDeclaration; - return declaration.initializer && declaration.initializer.kind === 184; + return declaration.initializer && declaration.initializer.kind === 185; } return false; } @@ -7850,11 +7961,11 @@ var ts; if (!isInJavaScriptFile(expression)) { return 0; } - if (expression.kind !== 192) { + if (expression.kind !== 193) { return 0; } var expr = expression; - if (expr.operatorToken.kind !== 57 || expr.left.kind !== 177) { + if (expr.operatorToken.kind !== 57 || expr.left.kind !== 178) { return 0; } var lhs = expr.left; @@ -7870,7 +7981,7 @@ var ts; else if (lhs.expression.kind === 98) { return 4; } - else if (lhs.expression.kind === 177) { + else if (lhs.expression.kind === 178) { var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 70) { var innerPropertyAccessIdentifier = innerPropertyAccess.expression; @@ -7886,35 +7997,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 236) { + if (node.kind === 237) { return node.moduleSpecifier; } - if (node.kind === 235) { + if (node.kind === 236) { var reference = node.moduleReference; - if (reference.kind === 246) { + if (reference.kind === 247) { return reference.expression; } } - if (node.kind === 242) { + if (node.kind === 243) { return node.moduleSpecifier; } - if (node.kind === 231 && node.name.kind === 9) { + if (node.kind === 232 && node.name.kind === 9) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 235) { + if (node.kind === 236) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 238) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 239) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 236 + return node.kind === 237 && node.importClause && !!node.importClause.name; } @@ -7922,13 +8033,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 144: + case 145: + case 150: case 149: - case 148: + case 260: case 259: - case 258: + case 148: case 147: - case 146: return node.questionToken !== undefined; } } @@ -7936,9 +8047,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 275 && + return node.kind === 276 && node.parameters.length > 0 && - node.parameters[0].type.kind === 277; + node.parameters[0].type.kind === 278; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { @@ -7951,7 +8062,7 @@ var ts; var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 282) { + if (doc.kind === 283) { if (doc.kind === kind) { result.push(doc); } @@ -7977,9 +8088,9 @@ var ts; var parent = node.parent; var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 206; + parent.parent.parent.kind === 207; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 206; + parent.parent.kind === 207; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -7987,19 +8098,19 @@ var ts; getJSDocsWorker(variableStatementNode); } var isSourceOfAssignmentExpressionStatement = parent && parent.parent && - parent.kind === 192 && + parent.kind === 193 && parent.operatorToken.kind === 57 && - parent.parent.kind === 208; + parent.parent.kind === 209; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 231 && - parent && parent.kind === 231; - var isPropertyAssignmentExpression = parent && parent.kind === 258; + var isModuleDeclaration = node.kind === 232 && + parent && parent.kind === 232; + var isPropertyAssignmentExpression = parent && parent.kind === 259; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } - if (node.kind === 144) { + if (node.kind === 145) { cache = ts.concatenate(cache, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { @@ -8013,17 +8124,17 @@ var ts; return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 282); + var tags = getJSDocTags(func, 283); if (!param.name) { var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 282; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 283; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70) { - var name_7 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 282 && tag.parameterName.text === name_7; }); + var name_1 = param.name.text; + return ts.filter(tags, function (tag) { return tag.kind === 283 && tag.parameterName.text === name_1; }); } else { return undefined; @@ -8031,8 +8142,8 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 284); - if (!tag && node.kind === 144) { + var tag = getFirstJSDocTag(node, 285); + if (!tag && node.kind === 145) { var paramTags = getJSDocParameterTags(node); if (paramTags) { tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); @@ -8042,15 +8153,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 281); + return getFirstJSDocTag(node, 282); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 283); + return getFirstJSDocTag(node, 284); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 285); + return getFirstJSDocTag(node, 286); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -8063,8 +8174,8 @@ var ts; ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { if (node && (node.flags & 65536)) { - if (node.type && node.type.kind === 276 || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 276; })) { + if (node.type && node.type.kind === 277 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 277; })) { return true; } } @@ -8079,28 +8190,33 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 192: + case 193: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 57 ? 1 : 2 : 0; - case 190: case 191: + case 192: var unaryOperator = parent.operator; return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0; - case 213: case 214: + case 215: return parent.initializer === node ? 1 : 0; - case 183: - case 175: - case 196: + case 184: + case 176: + case 197: node = parent; break; - case 259: + case 260: if (parent.name !== node) { return 0; } - case 258: + node = parent.parent; + break; + case 259: + if (parent.name === node) { + return 0; + } node = parent.parent; break; default: @@ -8115,14 +8231,14 @@ var ts; } ts.isAssignmentTarget = isAssignmentTarget; function isDeleteTarget(node) { - if (node.kind !== 177 && node.kind !== 178) { + if (node.kind !== 178 && node.kind !== 179) { return false; } node = node.parent; - while (node && node.kind === 183) { + while (node && node.kind === 184) { node = node.parent; } - return node && node.kind === 186; + return node && node.kind === 187; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -8136,7 +8252,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2) || (node.kind === 262 && node.isDeclarationFile)) { + if (hasModifier(node, 2) || (node.kind === 263 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -8149,7 +8265,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 240 || parent.kind === 244) { + if (parent.kind === 241 || parent.kind === 245) { if (parent.propertyName) { return true; } @@ -8162,48 +8278,48 @@ var ts; ts.isDeclarationName = isDeclarationName; function isLiteralComputedPropertyDeclarationName(node) { return (node.kind === 9 || node.kind === 8) && - node.parent.kind === 142 && + node.parent.kind === 143 && isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { + case 148: case 147: - case 146: + case 150: case 149: - case 148: - case 151: case 152: - case 261: - case 258: - case 177: + case 153: + case 262: + case 259: + case 178: return parent.name === node; - case 141: + case 142: if (parent.right === node) { - while (parent.kind === 141) { + while (parent.kind === 142) { parent = parent.parent; } - return parent.kind === 160; + return parent.kind === 161; } return false; - case 174: - case 240: + case 175: + case 241: return parent.propertyName === node; - case 244: + case 245: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 235 || - node.kind === 234 || - node.kind === 237 && !!node.name || - node.kind === 238 || - node.kind === 240 || - node.kind === 244 || - node.kind === 241 && exportAssignmentIsAlias(node); + return node.kind === 236 || + node.kind === 235 || + node.kind === 238 && !!node.name || + node.kind === 239 || + node.kind === 241 || + node.kind === 245 || + node.kind === 242 && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8289,7 +8405,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 71 <= token && token <= 140; + return 71 <= token && token <= 141; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -8311,7 +8427,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 142 && + return name.kind === 143 && !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } @@ -8321,10 +8437,10 @@ var ts; } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 144) { + if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 145) { return name.text; } - if (name.kind === 142) { + if (name.kind === 143) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -8369,11 +8485,11 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 144; + return root.kind === 145; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 174) { + while (node.kind === 175) { node = node.parent.parent; } return node; @@ -8381,15 +8497,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 150 - || kind === 184 - || kind === 226 + return kind === 151 || kind === 185 - || kind === 149 - || kind === 151 + || kind === 227 + || kind === 186 + || kind === 150 || kind === 152 - || kind === 231 - || kind === 262; + || kind === 153 + || kind === 232 + || kind === 263; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -8440,23 +8556,23 @@ var ts; ts.getOriginalNodeId = getOriginalNodeId; function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 180: + case 181: return hasArguments ? 0 : 1; - case 190: - case 187: + case 191: case 188: - case 186: case 189: - case 193: - case 195: + case 187: + case 190: + case 194: + case 196: return 1; - case 192: + case 193: switch (operator) { case 39: case 57: @@ -8480,15 +8596,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 192) { + if (expression.kind === 193) { return expression.operatorToken.kind; } - else if (expression.kind === 190 || expression.kind === 191) { + else if (expression.kind === 191 || expression.kind === 192) { return expression.operator; } else { @@ -8506,36 +8622,36 @@ var ts; case 85: case 8: case 9: - case 175: case 176: - case 184: + case 177: case 185: - case 197: - case 247: + case 186: + case 198: case 248: + case 249: case 11: case 12: - case 194: - case 183: - case 198: + case 195: + case 184: + case 199: return 19; - case 181: - case 177: + case 182: case 178: + case 179: return 18; - case 180: + case 181: return hasArguments ? 18 : 17; - case 179: + case 180: return 17; - case 191: + case 192: return 16; - case 190: - case 187: + case 191: case 188: - case 186: case 189: + case 187: + case 190: return 15; - case 192: + case 193: switch (operatorKind) { case 50: case 51: @@ -8593,11 +8709,11 @@ var ts; default: return -1; } - case 193: + case 194: return 4; - case 195: - return 2; case 196: + return 2; + case 197: return 1; default: return -1; @@ -8620,21 +8736,15 @@ var ts; return modificationCount; } function reattachFileDiagnostics(newFile) { - if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { - return; - } - for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { - var diagnostic = _a[_i]; - diagnostic.file = newFile; - } + ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } function add(diagnostic) { var diagnostics; if (diagnostic.file) { - diagnostics = fileDiagnostics[diagnostic.file.fileName]; + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); if (!diagnostics) { diagnostics = []; - fileDiagnostics[diagnostic.file.fileName] = diagnostics; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); } } else { @@ -8651,16 +8761,16 @@ var ts; function getDiagnostics(fileName) { sortAndDeduplicate(); if (fileName) { - return fileDiagnostics[fileName] || []; + return fileDiagnostics.get(fileName) || []; } var allDiagnostics = []; function pushDiagnostic(d) { allDiagnostics.push(d); } ts.forEach(nonFileDiagnostics, pushDiagnostic); - for (var key in fileDiagnostics) { - ts.forEach(fileDiagnostics[key], pushDiagnostic); - } + fileDiagnostics.forEach(function (diagnostics) { + ts.forEach(diagnostics, pushDiagnostic); + }); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function sortAndDeduplicate() { @@ -8669,14 +8779,14 @@ var ts; } diagnosticsModified = false; nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (var key in fileDiagnostics) { - fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); - } + fileDiagnostics.forEach(function (diagnostics, key) { + fileDiagnostics.set(key, ts.sortAndDeduplicateDiagnostics(diagnostics)); + }); } } ts.createDiagnosticCollection = createDiagnosticCollection; var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = ts.createMap({ + var escapedCharsMap = ts.createMapFromTemplate({ "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -8695,7 +8805,7 @@ var ts; } ts.escapeString = escapeString; function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); @@ -8839,129 +8949,62 @@ var ts; ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; function getSourceFilesToEmit(host, targetSourceFile) { var options = host.getCompilerOptions(); + var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); }; if (options.outFile || options.out) { var moduleKind = ts.getEmitModuleKind(options); - var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; - var sourceFiles = getAllEmittableSourceFiles(); - return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule); + var moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; + return ts.filter(host.getSourceFiles(), function (sourceFile) { + return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); + }); } else { - var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile]; - return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); }); - } - function getAllEmittableSourceFiles() { - return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles(); + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); }); } } ts.getSourceFilesToEmit = getSourceFilesToEmit; - function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) { - return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); }); - } - ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory; - function isNonDeclarationFile(sourceFile) { - return !isDeclarationFile(sourceFile); - } - function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) { - return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); + function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) { + return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !isDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); } - function isBundleEmitNonExternalModule(sourceFile) { - return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile); - } - function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) { + ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted; + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { + var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); var options = host.getCompilerOptions(); if (options.outFile || options.out) { - onBundledEmit(sourceFiles); + if (sourceFiles.length) { + var jsFilePath = options.outFile || options.out; + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFiles, true, emitOnlyDtsFiles); + } } else { for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { var sourceFile = sourceFiles_2[_i]; - if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { - onSingleFileEmit(host, sourceFile); - } - } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], false); - } - function onBundledEmit(sourceFiles) { - if (sourceFiles.length) { - var jsFilePath = options.outFile || options.out; + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, true); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, [sourceFile], false, emitOnlyDtsFiles); } } } - ts.forEachTransformedEmitFile = forEachTransformedEmitFile; + ts.forEachEmittedFile = forEachEmittedFile; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) { - var options = host.getCompilerOptions(); - if (options.outFile || options.out) { - onBundledEmit(host); - } - else { - var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile]; - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; - if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) { - onSingleFileEmit(host, sourceFile); + function getOutputExtension(sourceFile, options) { + if (options.jsx === 1) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + return ".jsx"; } } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: declarationFilePath - }; - action(emitFileNames, [sourceFile], false, emitOnlyDtsFiles); - } - function onBundledEmit(host) { - var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) && - !host.isSourceFileFromExternalLibrary(sourceFile) && - (!ts.isExternalModule(sourceFile) || - !!ts.getEmitModuleKind(options)); }); - if (bundledSources.length) { - var jsFilePath = options.outFile || options.out; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined - }; - action(emitFileNames, bundledSources, true, emitOnlyDtsFiles); + else if (sourceFile.languageVariant === 1) { + return ".jsx"; } } + return ".js"; } - ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); var commonSourceDirectory = host.getCommonSourceDirectory(); @@ -8986,7 +9029,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 150 && nodeIsPresent(member.body)) { + if (member.kind === 151 && nodeIsPresent(member.body)) { return member; } }); @@ -9027,10 +9070,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 151) { + if (accessor.kind === 152) { getAccessor = accessor; } - else if (accessor.kind === 152) { + else if (accessor.kind === 153) { setAccessor = accessor; } else { @@ -9039,7 +9082,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 151 || member.kind === 152) + if ((member.kind === 152 || member.kind === 153) && hasModifier(member, 32) === hasModifier(accessor, 32)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -9050,10 +9093,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 151 && !getAccessor) { + if (member.kind === 152 && !getAccessor) { getAccessor = member; } - if (member.kind === 152 && !setAccessor) { + if (member.kind === 153 && !setAccessor) { setAccessor = member; } } @@ -9271,7 +9314,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 199 && + if (node.kind === 200 && node.parent.token === 84 && isClassLike(node.parent.parent)) { return node.parent.parent; @@ -9289,8 +9332,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, true)) { var kind = node.left.kind; - return kind === 176 - || kind === 175; + return kind === 177 + || kind === 176; } return false; } @@ -9316,29 +9359,33 @@ var ts; ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isEntityNameExpression(node) { return node.kind === 70 || - node.kind === 177 && isEntityNameExpression(node.expression); + node.kind === 178 && isEntityNameExpression(node.expression); } ts.isEntityNameExpression = isEntityNameExpression; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 141 && node.parent.right === node) || - (node.parent.kind === 177 && node.parent.name === node); + return (node.parent.kind === 142 && node.parent.right === node) || + (node.parent.kind === 178 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 176) { + if (kind === 177) { return expression.properties.length === 0; } - if (kind === 175) { + if (kind === 176) { return expression.elements.length === 0; } return false; } ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512) ? symbol.valueDeclaration.localSymbol : undefined; + return isExportDefaultSymbol(symbol) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function isExportDefaultSymbol(symbol) { + return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512); + } + ts.isExportDefaultSymbol = isExportDefaultSymbol; function tryExtractTypeScriptExtension(fileName) { return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); } @@ -9430,39 +9477,39 @@ var ts; || kind === 94) { return true; } - else if (kind === 177) { + else if (kind === 178) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 178) { + else if (kind === 179) { return isSimpleExpressionWorker(node.expression, depth + 1) && isSimpleExpressionWorker(node.argumentExpression, depth + 1); } - else if (kind === 190 - || kind === 191) { + else if (kind === 191 + || kind === 192) { return isSimpleExpressionWorker(node.operand, depth + 1); } - else if (kind === 192) { + else if (kind === 193) { return node.operatorToken.kind !== 39 && isSimpleExpressionWorker(node.left, depth + 1) && isSimpleExpressionWorker(node.right, depth + 1); } - else if (kind === 193) { + else if (kind === 194) { return isSimpleExpressionWorker(node.condition, depth + 1) && isSimpleExpressionWorker(node.whenTrue, depth + 1) && isSimpleExpressionWorker(node.whenFalse, depth + 1); } - else if (kind === 188 - || kind === 187 - || kind === 186) { + else if (kind === 189 + || kind === 188 + || kind === 187) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 175) { + else if (kind === 176) { return node.elements.length === 0; } - else if (kind === 176) { + else if (kind === 177) { return node.properties.length === 0; } - else if (kind === 179) { + else if (kind === 180) { if (!isSimpleExpressionWorker(node.expression, depth + 1)) { return false; } @@ -9477,16 +9524,19 @@ var ts; } return false; } - var syntaxKindCache = ts.createMap(); + var syntaxKindCache = []; function formatSyntaxKind(kind) { var syntaxKindEnum = ts.SyntaxKind; if (syntaxKindEnum) { - if (syntaxKindCache[kind]) { - return syntaxKindCache[kind]; + var cached = syntaxKindCache[kind]; + if (cached !== undefined) { + return cached; } - for (var name_8 in syntaxKindEnum) { - if (syntaxKindEnum[name_8] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name_8 + ")"; + for (var name in syntaxKindEnum) { + if (syntaxKindEnum[name] === kind) { + var result = kind + " (" + name + ")"; + syntaxKindCache[kind] = result; + return result; } } } @@ -9572,8 +9622,8 @@ var ts; var parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 230: case 231: + case 232: return parseNode === parseNode.parent.name; } } @@ -9591,7 +9641,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 && declaration !== node) { + if (declaration.kind === 228 && declaration !== node) { return true; } } @@ -9643,7 +9693,7 @@ var ts; } ts.isIdentifier = isIdentifier; function isVoidExpression(node) { - return node.kind === 188; + return node.kind === 189; } ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { @@ -9655,16 +9705,16 @@ var ts; } ts.isModifier = isModifier; function isQualifiedName(node) { - return node.kind === 141; + return node.kind === 142; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 142; + return node.kind === 143; } ts.isComputedPropertyName = isComputedPropertyName; function isEntityName(node) { var kind = node.kind; - return kind === 141 + return kind === 142 || kind === 70; } ts.isEntityName = isEntityName; @@ -9673,7 +9723,7 @@ var ts; return kind === 70 || kind === 9 || kind === 8 - || kind === 142; + || kind === 143; } ts.isPropertyName = isPropertyName; function isModuleName(node) { @@ -9685,101 +9735,101 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 70 - || kind === 172 - || kind === 173; + || kind === 173 + || kind === 174; } ts.isBindingName = isBindingName; function isTypeParameter(node) { - return node.kind === 143; + return node.kind === 144; } ts.isTypeParameter = isTypeParameter; function isParameter(node) { - return node.kind === 144; + return node.kind === 145; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 145; + return node.kind === 146; } ts.isDecorator = isDecorator; function isMethodDeclaration(node) { - return node.kind === 149; + return node.kind === 150; } ts.isMethodDeclaration = isMethodDeclaration; function isClassElement(node) { var kind = node.kind; - return kind === 150 - || kind === 147 - || kind === 149 - || kind === 151 + return kind === 151 + || kind === 148 + || kind === 150 || kind === 152 - || kind === 155 - || kind === 204; + || kind === 153 + || kind === 156 + || kind === 205; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 258 - || kind === 259 + return kind === 259 || kind === 260 - || kind === 149 - || kind === 151 + || kind === 261 + || kind === 150 || kind === 152 - || kind === 245; + || kind === 153 + || kind === 246; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNodeKind(kind) { - return (kind >= 156 && kind <= 171) + return (kind >= 157 && kind <= 172) || kind === 118 || kind === 132 || kind === 121 - || kind === 134 || kind === 135 + || kind === 136 || kind === 104 || kind === 129 - || kind === 199; + || kind === 200; } function isTypeNode(node) { return isTypeNodeKind(node.kind); } ts.isTypeNode = isTypeNode; function isArrayBindingPattern(node) { - return node.kind === 173; + return node.kind === 174; } ts.isArrayBindingPattern = isArrayBindingPattern; function isObjectBindingPattern(node) { - return node.kind === 172; + return node.kind === 173; } ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 173 - || kind === 172; + return kind === 174 + || kind === 173; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 175 - || kind === 176; + return kind === 176 + || kind === 177; } ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { - return node.kind === 174; + return node.kind === 175; } ts.isBindingElement = isBindingElement; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 174 - || kind === 198; + return kind === 175 + || kind === 199; } ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 224: - case 144: - case 174: + case 225: + case 145: + case 175: return true; } return false; @@ -9792,8 +9842,8 @@ var ts; ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 172: - case 176: + case 173: + case 177: return true; } return false; @@ -9801,94 +9851,94 @@ var ts; ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 173: - case 175: + case 174: + case 176: return true; } return false; } ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; function isArrayLiteralExpression(node) { - return node.kind === 175; + return node.kind === 176; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 176; + return node.kind === 177; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 177; + return node.kind === 178; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 178; + return node.kind === 179; } ts.isElementAccessExpression = isElementAccessExpression; function isBinaryExpression(node) { - return node.kind === 192; + return node.kind === 193; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 193; + return node.kind === 194; } ts.isConditionalExpression = isConditionalExpression; function isCallExpression(node) { - return node.kind === 179; + return node.kind === 180; } ts.isCallExpression = isCallExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 194 + return kind === 195 || kind === 12; } ts.isTemplateLiteral = isTemplateLiteral; function isSpreadExpression(node) { - return node.kind === 196; + return node.kind === 197; } ts.isSpreadExpression = isSpreadExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 199; + return node.kind === 200; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isLeftHandSideExpressionKind(kind) { - return kind === 177 - || kind === 178 - || kind === 180 + return kind === 178 || kind === 179 - || kind === 247 - || kind === 248 || kind === 181 - || kind === 175 - || kind === 183 + || kind === 180 + || kind === 248 + || kind === 249 + || kind === 182 || kind === 176 - || kind === 197 || kind === 184 + || kind === 177 + || kind === 198 + || kind === 185 || kind === 70 || kind === 11 || kind === 8 || kind === 9 || kind === 12 - || kind === 194 + || kind === 195 || kind === 85 || kind === 94 || kind === 98 || kind === 100 || kind === 96 - || kind === 201 - || kind === 202; + || kind === 202 + || kind === 203; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isUnaryExpressionKind(kind) { - return kind === 190 - || kind === 191 - || kind === 186 + return kind === 191 + || kind === 192 || kind === 187 || kind === 188 || kind === 189 - || kind === 182 + || kind === 190 + || kind === 183 || isLeftHandSideExpressionKind(kind); } function isUnaryExpression(node) { @@ -9896,13 +9946,13 @@ var ts; } ts.isUnaryExpression = isUnaryExpression; function isExpressionKind(kind) { - return kind === 193 - || kind === 195 - || kind === 185 - || kind === 192 + return kind === 194 || kind === 196 - || kind === 200 - || kind === 198 + || kind === 186 + || kind === 193 + || kind === 197 + || kind === 201 + || kind === 199 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -9911,16 +9961,16 @@ var ts; ts.isExpression = isExpression; function isAssertionExpression(node) { var kind = node.kind; - return kind === 182 - || kind === 200; + return kind === 183 + || kind === 201; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 295; + return node.kind === 296; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 294; + return node.kind === 295; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -9929,15 +9979,15 @@ var ts; } ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isOmittedExpression(node) { - return node.kind === 198; + return node.kind === 199; } ts.isOmittedExpression = isOmittedExpression; function isTemplateSpan(node) { - return node.kind === 203; + return node.kind === 204; } ts.isTemplateSpan = isTemplateSpan; function isBlock(node) { - return node.kind === 205; + return node.kind === 206; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -9955,121 +10005,121 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 224; + return node.kind === 225; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 225; + return node.kind === 226; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 233; + return node.kind === 234; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 232 - || kind === 231; + return kind === 233 + || kind === 232; } ts.isModuleBody = isModuleBody; function isImportEqualsDeclaration(node) { - return node.kind === 235; + return node.kind === 236; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 237; + return node.kind === 238; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 239 - || kind === 238; + return kind === 240 + || kind === 239; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 240; + return node.kind === 241; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 243; + return node.kind === 244; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 244; + return node.kind === 245; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 231 || node.kind === 230; + return node.kind === 232 || node.kind === 231; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 185 - || kind === 174 + return kind === 186 + || kind === 175 + || kind === 228 + || kind === 198 + || kind === 151 + || kind === 231 + || kind === 262 + || kind === 245 || kind === 227 - || kind === 197 + || kind === 185 + || kind === 152 + || kind === 238 + || kind === 236 + || kind === 241 + || kind === 229 || kind === 150 - || kind === 230 - || kind === 261 - || kind === 244 - || kind === 226 - || kind === 184 - || kind === 151 - || kind === 237 - || kind === 235 - || kind === 240 - || kind === 228 || kind === 149 + || kind === 232 + || kind === 235 + || kind === 239 + || kind === 145 + || kind === 259 || kind === 148 - || kind === 231 - || kind === 234 - || kind === 238 - || kind === 144 - || kind === 258 || kind === 147 - || kind === 146 - || kind === 152 - || kind === 259 - || kind === 229 - || kind === 143 - || kind === 224 - || kind === 286; + || kind === 153 + || kind === 260 + || kind === 230 + || kind === 144 + || kind === 225 + || kind === 287; } function isDeclarationStatementKind(kind) { - return kind === 226 - || kind === 245 - || kind === 227 + return kind === 227 + || kind === 246 || kind === 228 || kind === 229 || kind === 230 || kind === 231 + || kind === 232 + || kind === 237 || kind === 236 - || kind === 235 + || kind === 243 || kind === 242 - || kind === 241 - || kind === 234; + || kind === 235; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 216 + return kind === 217 + || kind === 216 + || kind === 224 + || kind === 211 + || kind === 209 + || kind === 208 + || kind === 214 || kind === 215 - || kind === 223 + || kind === 213 || kind === 210 - || kind === 208 + || kind === 221 + || kind === 218 + || kind === 220 + || kind === 222 + || kind === 223 || kind === 207 - || kind === 213 - || kind === 214 || kind === 212 - || kind === 209 - || kind === 220 - || kind === 217 || kind === 219 - || kind === 221 - || kind === 222 - || kind === 206 - || kind === 211 - || kind === 218 - || kind === 294 - || kind === 297 - || kind === 296; + || kind === 295 + || kind === 298 + || kind === 297; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10087,87 +10137,87 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 205; + || kind === 206; } ts.isStatement = isStatement; function isModuleReference(node) { var kind = node.kind; - return kind === 246 - || kind === 141 + return kind === 247 + || kind === 142 || kind === 70; } ts.isModuleReference = isModuleReference; function isJsxOpeningElement(node) { - return node.kind === 249; + return node.kind === 250; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 250; + return node.kind === 251; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { var kind = node.kind; return kind === 98 || kind === 70 - || kind === 177; + || kind === 178; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 247 - || kind === 253 - || kind === 248 + return kind === 248 + || kind === 254 + || kind === 249 || kind === 10; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 251 - || kind === 252; + return kind === 252 + || kind === 253; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 252; + return node.kind === 253; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 251; + return node.kind === 252; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 253; + || kind === 254; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 254 - || kind === 255; + return kind === 255 + || kind === 256; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 256; + return node.kind === 257; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 257; + return node.kind === 258; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 258; + return node.kind === 259; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 259; + return node.kind === 260; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isEnumMember(node) { - return node.kind === 261; + return node.kind === 262; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 262; + return node.kind === 263; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -10306,9 +10356,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 143) { + if (d && d.kind === 144) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 228) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 229) { return current; } } @@ -10316,11 +10366,11 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return ts.hasModifier(node, 92) && node.parent.kind === 150 && ts.isClassLike(node.parent.parent); + return ts.hasModifier(node, 92) && node.parent.kind === 151 && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 174 || ts.isBindingPattern(node))) { + while (node && (node.kind === 175 || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -10328,14 +10378,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 224) { + if (node.kind === 225) { node = node.parent; } - if (node && node.kind === 225) { + if (node && node.kind === 226) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 206) { + if (node && node.kind === 207) { flags |= ts.getModifierFlags(node); } return flags; @@ -10344,14 +10394,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 224) { + if (node.kind === 225) { node = node.parent; } - if (node && node.kind === 225) { + if (node && node.kind === 226) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 206) { + if (node && node.kind === 207) { flags |= node.flags; } return flags; @@ -10410,7 +10460,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, location, flags) { - var ConstructorForKind = kind === 262 + var ConstructorForKind = kind === 263 ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); var node = location @@ -10580,7 +10630,7 @@ var ts; } ts.createNull = createNull; function createComputedPropertyName(expression, location) { - var node = createNode(142, location); + var node = createNode(143, location); node.expression = expression; return node; } @@ -10593,7 +10643,7 @@ var ts; } ts.updateComputedPropertyName = updateComputedPropertyName; function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) { - var node = createNode(144, location, flags); + var node = createNode(145, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.dotDotDotToken = dotDotDotToken; @@ -10612,7 +10662,7 @@ var ts; } ts.updateParameter = updateParameter; function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) { - var node = createNode(147, location); + var node = createNode(148, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10630,7 +10680,7 @@ var ts; } ts.updateProperty = updateProperty; function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(149, location, flags); + var node = createNode(150, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -10650,7 +10700,7 @@ var ts; } ts.updateMethod = updateMethod; function createConstructor(decorators, modifiers, parameters, body, location, flags) { - var node = createNode(150, location, flags); + var node = createNode(151, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.typeParameters = undefined; @@ -10668,7 +10718,7 @@ var ts; } ts.updateConstructor = updateConstructor; function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) { - var node = createNode(151, location, flags); + var node = createNode(152, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10687,7 +10737,7 @@ var ts; } ts.updateGetAccessor = updateGetAccessor; function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) { - var node = createNode(152, location, flags); + var node = createNode(153, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10705,7 +10755,7 @@ var ts; } ts.updateSetAccessor = updateSetAccessor; function createObjectBindingPattern(elements, location) { - var node = createNode(172, location); + var node = createNode(173, location); node.elements = createNodeArray(elements); return node; } @@ -10718,7 +10768,7 @@ var ts; } ts.updateObjectBindingPattern = updateObjectBindingPattern; function createArrayBindingPattern(elements, location) { - var node = createNode(173, location); + var node = createNode(174, location); node.elements = createNodeArray(elements); return node; } @@ -10731,7 +10781,7 @@ var ts; } ts.updateArrayBindingPattern = updateArrayBindingPattern; function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) { - var node = createNode(174, location); + var node = createNode(175, location); node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; node.dotDotDotToken = dotDotDotToken; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10747,7 +10797,7 @@ var ts; } ts.updateBindingElement = updateBindingElement; function createArrayLiteral(elements, location, multiLine) { - var node = createNode(175, location); + var node = createNode(176, location); node.elements = parenthesizeListElements(createNodeArray(elements)); if (multiLine) { node.multiLine = true; @@ -10763,7 +10813,7 @@ var ts; } ts.updateArrayLiteral = updateArrayLiteral; function createObjectLiteral(properties, location, multiLine) { - var node = createNode(176, location); + var node = createNode(177, location); node.properties = createNodeArray(properties); if (multiLine) { node.multiLine = true; @@ -10779,7 +10829,7 @@ var ts; } ts.updateObjectLiteral = updateObjectLiteral; function createPropertyAccess(expression, name, location, flags) { - var node = createNode(177, location, flags); + var node = createNode(178, location, flags); node.expression = parenthesizeForAccess(expression); (node.emitNode || (node.emitNode = {})).flags |= 65536; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10796,7 +10846,7 @@ var ts; } ts.updatePropertyAccess = updatePropertyAccess; function createElementAccess(expression, index, location) { - var node = createNode(178, location); + var node = createNode(179, location); node.expression = parenthesizeForAccess(expression); node.argumentExpression = typeof index === "number" ? createLiteral(index) : index; return node; @@ -10810,7 +10860,7 @@ var ts; } ts.updateElementAccess = updateElementAccess; function createCall(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(179, location, flags); + var node = createNode(180, location, flags); node.expression = parenthesizeForAccess(expression); if (typeArguments) { node.typeArguments = createNodeArray(typeArguments); @@ -10827,7 +10877,7 @@ var ts; } ts.updateCall = updateCall; function createNew(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(180, location, flags); + var node = createNode(181, location, flags); node.expression = parenthesizeForNew(expression); node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; @@ -10842,7 +10892,7 @@ var ts; } ts.updateNew = updateNew; function createTaggedTemplate(tag, template, location) { - var node = createNode(181, location); + var node = createNode(182, location); node.tag = parenthesizeForAccess(tag); node.template = template; return node; @@ -10856,7 +10906,7 @@ var ts; } ts.updateTaggedTemplate = updateTaggedTemplate; function createParen(expression, location) { - var node = createNode(183, location); + var node = createNode(184, location); node.expression = expression; return node; } @@ -10869,7 +10919,7 @@ var ts; } ts.updateParen = updateParen; function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(184, location, flags); + var node = createNode(185, location, flags); node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10888,7 +10938,7 @@ var ts; } ts.updateFunctionExpression = updateFunctionExpression; function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) { - var node = createNode(185, location, flags); + var node = createNode(186, location, flags); node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; node.parameters = createNodeArray(parameters); @@ -10906,7 +10956,7 @@ var ts; } ts.updateArrowFunction = updateArrowFunction; function createDelete(expression, location) { - var node = createNode(186, location); + var node = createNode(187, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -10919,7 +10969,7 @@ var ts; } ts.updateDelete = updateDelete; function createTypeOf(expression, location) { - var node = createNode(187, location); + var node = createNode(188, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -10932,7 +10982,7 @@ var ts; } ts.updateTypeOf = updateTypeOf; function createVoid(expression, location) { - var node = createNode(188, location); + var node = createNode(189, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -10945,7 +10995,7 @@ var ts; } ts.updateVoid = updateVoid; function createAwait(expression, location) { - var node = createNode(189, location); + var node = createNode(190, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -10958,7 +11008,7 @@ var ts; } ts.updateAwait = updateAwait; function createPrefix(operator, operand, location) { - var node = createNode(190, location); + var node = createNode(191, location); node.operator = operator; node.operand = parenthesizePrefixOperand(operand); return node; @@ -10972,7 +11022,7 @@ var ts; } ts.updatePrefix = updatePrefix; function createPostfix(operand, operator, location) { - var node = createNode(191, location); + var node = createNode(192, location); node.operand = parenthesizePostfixOperand(operand); node.operator = operator; return node; @@ -10988,7 +11038,7 @@ var ts; function createBinary(left, operator, right, location) { var operatorToken = typeof operator === "number" ? createToken(operator) : operator; var operatorKind = operatorToken.kind; - var node = createNode(192, location); + var node = createNode(193, location); node.left = parenthesizeBinaryOperand(operatorKind, left, true, undefined); node.operatorToken = operatorToken; node.right = parenthesizeBinaryOperand(operatorKind, right, false, node.left); @@ -11003,7 +11053,7 @@ var ts; } ts.updateBinary = updateBinary; function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { - var node = createNode(193, whenFalse ? location : colonTokenOrLocation); + var node = createNode(194, whenFalse ? location : colonTokenOrLocation); node.condition = parenthesizeForConditionalHead(condition); if (whenFalse) { node.questionToken = questionTokenOrWhenTrue; @@ -11028,7 +11078,7 @@ var ts; } ts.updateConditional = updateConditional; function createTemplateExpression(head, templateSpans, location) { - var node = createNode(194, location); + var node = createNode(195, location); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; @@ -11042,7 +11092,7 @@ var ts; } ts.updateTemplateExpression = updateTemplateExpression; function createYield(asteriskToken, expression, location) { - var node = createNode(195, location); + var node = createNode(196, location); node.asteriskToken = asteriskToken; node.expression = expression; return node; @@ -11056,7 +11106,7 @@ var ts; } ts.updateYield = updateYield; function createSpread(expression, location) { - var node = createNode(196, location); + var node = createNode(197, location); node.expression = parenthesizeExpressionForList(expression); return node; } @@ -11069,7 +11119,7 @@ var ts; } ts.updateSpread = updateSpread; function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(197, location); + var node = createNode(198, location); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11087,12 +11137,12 @@ var ts; } ts.updateClassExpression = updateClassExpression; function createOmittedExpression(location) { - var node = createNode(198, location); + var node = createNode(199, location); return node; } ts.createOmittedExpression = createOmittedExpression; function createExpressionWithTypeArguments(typeArguments, expression, location) { - var node = createNode(199, location); + var node = createNode(200, location); node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; node.expression = parenthesizeForAccess(expression); return node; @@ -11106,7 +11156,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createTemplateSpan(expression, literal, location) { - var node = createNode(203, location); + var node = createNode(204, location); node.expression = expression; node.literal = literal; return node; @@ -11120,7 +11170,7 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createBlock(statements, location, multiLine, flags) { - var block = createNode(205, location, flags); + var block = createNode(206, location, flags); block.statements = createNodeArray(statements); if (multiLine) { block.multiLine = true; @@ -11136,7 +11186,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(206, location, flags); + var node = createNode(207, location, flags); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -11151,7 +11201,7 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(225, location, flags); + var node = createNode(226, location, flags); node.declarations = createNodeArray(declarations); return node; } @@ -11164,7 +11214,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(224, location, flags); + var node = createNode(225, location, flags); node.name = typeof name === "string" ? createIdentifier(name) : name; node.type = type; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11179,11 +11229,11 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createEmptyStatement(location) { - return createNode(207, location); + return createNode(208, location); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression, location, flags) { - var node = createNode(208, location, flags); + var node = createNode(209, location, flags); node.expression = parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -11196,7 +11246,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(209, location); + var node = createNode(210, location); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11211,7 +11261,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression, location) { - var node = createNode(210, location); + var node = createNode(211, location); node.statement = statement; node.expression = expression; return node; @@ -11225,7 +11275,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement, location) { - var node = createNode(211, location); + var node = createNode(212, location); node.expression = expression; node.statement = statement; return node; @@ -11239,7 +11289,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(212, location, undefined); + var node = createNode(213, location, undefined); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11255,7 +11305,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement, location) { - var node = createNode(213, location); + var node = createNode(214, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11270,7 +11320,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(initializer, expression, statement, location) { - var node = createNode(214, location); + var node = createNode(215, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11285,7 +11335,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label, location) { - var node = createNode(215, location); + var node = createNode(216, location); if (label) { node.label = label; } @@ -11300,7 +11350,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label, location) { - var node = createNode(216, location); + var node = createNode(217, location); if (label) { node.label = label; } @@ -11315,7 +11365,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression, location) { - var node = createNode(217, location); + var node = createNode(218, location); node.expression = expression; return node; } @@ -11328,7 +11378,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement, location) { - var node = createNode(218, location); + var node = createNode(219, location); node.expression = expression; node.statement = statement; return node; @@ -11342,7 +11392,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock, location) { - var node = createNode(219, location); + var node = createNode(220, location); node.expression = parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -11356,7 +11406,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement, location) { - var node = createNode(220, location); + var node = createNode(221, location); node.label = typeof label === "string" ? createIdentifier(label) : label; node.statement = statement; return node; @@ -11370,7 +11420,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression, location) { - var node = createNode(221, location); + var node = createNode(222, location); node.expression = expression; return node; } @@ -11383,7 +11433,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(222, location); + var node = createNode(223, location); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11398,7 +11448,7 @@ var ts; } ts.updateTry = updateTry; function createCaseBlock(clauses, location) { - var node = createNode(233, location); + var node = createNode(234, location); node.clauses = createNodeArray(clauses); return node; } @@ -11411,7 +11461,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(226, location, flags); + var node = createNode(227, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -11431,7 +11481,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(227, location); + var node = createNode(228, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11449,7 +11499,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(236, location); + var node = createNode(237, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.importClause = importClause; @@ -11465,7 +11515,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings, location) { - var node = createNode(237, location); + var node = createNode(238, location); node.name = name; node.namedBindings = namedBindings; return node; @@ -11479,7 +11529,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name, location) { - var node = createNode(238, location); + var node = createNode(239, location); node.name = name; return node; } @@ -11492,7 +11542,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements, location) { - var node = createNode(239, location); + var node = createNode(240, location); node.elements = createNodeArray(elements); return node; } @@ -11505,7 +11555,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name, location) { - var node = createNode(240, location); + var node = createNode(241, location); node.propertyName = propertyName; node.name = name; return node; @@ -11519,7 +11569,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(241, location); + var node = createNode(242, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.isExportEquals = isExportEquals; @@ -11535,7 +11585,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(242, location); + var node = createNode(243, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.exportClause = exportClause; @@ -11551,7 +11601,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements, location) { - var node = createNode(243, location); + var node = createNode(244, location); node.elements = createNodeArray(elements); return node; } @@ -11564,7 +11614,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(name, propertyName, location) { - var node = createNode(244, location); + var node = createNode(245, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; return node; @@ -11578,7 +11628,7 @@ var ts; } ts.updateExportSpecifier = updateExportSpecifier; function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(247, location); + var node = createNode(248, location); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11593,7 +11643,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(248, location); + var node = createNode(249, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11607,7 +11657,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(249, location); + var node = createNode(250, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11621,7 +11671,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName, location) { - var node = createNode(250, location); + var node = createNode(251, location); node.tagName = tagName; return node; } @@ -11634,7 +11684,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxAttribute(name, initializer, location) { - var node = createNode(251, location); + var node = createNode(252, location); node.name = name; node.initializer = initializer; return node; @@ -11648,7 +11698,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxSpreadAttribute(expression, location) { - var node = createNode(252, location); + var node = createNode(253, location); node.expression = expression; return node; } @@ -11661,7 +11711,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(expression, dotDotDotToken, location) { - var node = createNode(253, location); + var node = createNode(254, location); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -11675,7 +11725,7 @@ var ts; } ts.updateJsxExpression = updateJsxExpression; function createHeritageClause(token, types, location) { - var node = createNode(256, location); + var node = createNode(257, location); node.token = token; node.types = createNodeArray(types); return node; @@ -11689,7 +11739,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCaseClause(expression, statements, location) { - var node = createNode(254, location); + var node = createNode(255, location); node.expression = parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -11703,7 +11753,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements, location) { - var node = createNode(255, location); + var node = createNode(256, location); node.statements = createNodeArray(statements); return node; } @@ -11716,7 +11766,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createCatchClause(variableDeclaration, block, location) { - var node = createNode(257, location); + var node = createNode(258, location); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -11730,7 +11780,7 @@ var ts; } ts.updateCatchClause = updateCatchClause; function createPropertyAssignment(name, initializer, location) { - var node = createNode(258, location); + var node = createNode(259, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.questionToken = undefined; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11745,14 +11795,14 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(259, location); + var node = createNode(260, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; function createSpreadAssignment(expression, location) { - var node = createNode(260, location); + var node = createNode(261, location); node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; return node; } @@ -11773,7 +11823,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(262, node, node.flags); + var updated = createNode(263, node, node.flags); updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -11833,27 +11883,27 @@ var ts; } ts.updateSourceFileNode = updateSourceFileNode; function createNotEmittedStatement(original) { - var node = createNode(294, original); + var node = createNode(295, original); node.original = original; return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(297); + var node = createNode(298); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(296); + var node = createNode(297); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(295, location || original); + var node = createNode(296, location || original); node.expression = expression; node.original = original; return node; @@ -12033,7 +12083,7 @@ var ts; if (!outermostLabeledStatement) { return node; } - var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 220 + var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 221 ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); if (afterRestoreLabelCallback) { @@ -12051,13 +12101,13 @@ var ts; case 8: case 9: return false; - case 175: + case 176: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 176: + case 177: return target.properties.length > 0; default: return true; @@ -12077,7 +12127,7 @@ var ts; } else { switch (callee.kind) { - case 177: { + case 178: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = createTempVariable(recordTempVariable); target = createPropertyAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.name, callee); @@ -12088,7 +12138,7 @@ var ts; } break; } - case 178: { + case 179: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { thisArg = createTempVariable(recordTempVariable); target = createElementAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.argumentExpression, callee); @@ -12138,14 +12188,14 @@ var ts; ts.createExpressionForPropertyName = createExpressionForPropertyName; function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { - case 151: case 152: + case 153: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 258: - return createExpressionForPropertyAssignment(property, receiver); case 259: + return createExpressionForPropertyAssignment(property, receiver); + case 260: return createExpressionForShorthandPropertyAssignment(property, receiver); - case 149: + case 150: return createExpressionForMethodDeclaration(property, receiver); } } @@ -12208,15 +12258,15 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_9 = getMutableClone(node.name); + var name = getMutableClone(node.name); emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) emitFlags |= 48; if (!allowComments) emitFlags |= 1536; if (emitFlags) - setEmitFlags(name_9, emitFlags); - return name_9; + setEmitFlags(name, emitFlags); + return name; } return getGeneratedNameForNode(node); } @@ -12311,7 +12361,7 @@ var ts; ts.ensureUseStrict = ensureUseStrict; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 183) { + if (skipped.kind === 184) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -12320,15 +12370,15 @@ var ts; } ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var binaryOperatorPrecedence = ts.getOperatorPrecedence(192, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(192, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(193, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(193, binaryOperator); var emittedOperand = skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { case -1: if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 - && operand.kind === 195) { + && operand.kind === 196) { return false; } return true; @@ -12367,7 +12417,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 192 && node.operatorToken.kind === 36) { + if (node.kind === 193 && node.operatorToken.kind === 36) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -12382,7 +12432,7 @@ var ts; return 0; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(193, 54); + var conditionalPrecedence = ts.getOperatorPrecedence(194, 54); var emittedCondition = skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { @@ -12392,16 +12442,16 @@ var ts; } ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; function parenthesizeSubexpressionOfConditionalExpression(e) { - return e.kind === 192 && e.operatorToken.kind === 25 + return e.kind === 193 && e.operatorToken.kind === 25 ? createParen(e) : e; } function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { - case 179: - return createParen(expression); case 180: + return createParen(expression); + case 181: return emittedExpression.arguments ? expression : createParen(expression); @@ -12412,7 +12462,7 @@ var ts; function parenthesizeForAccess(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 180 || emittedExpression.arguments) + && (emittedExpression.kind !== 181 || emittedExpression.arguments) && emittedExpression.kind !== 8) { return expression; } @@ -12450,7 +12500,7 @@ var ts; function parenthesizeExpressionForList(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(192, 25); + var commaPrecedence = ts.getOperatorPrecedence(193, 25); return expressionPrecedence > commaPrecedence ? expression : createParen(expression, expression); @@ -12461,7 +12511,7 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 184 || kind === 185) { + if (kind === 185 || kind === 186) { var mutableCall = getMutableClone(emittedExpression); mutableCall.expression = createParen(callee, callee); return recreatePartiallyEmittedExpressions(expression, mutableCall); @@ -12469,7 +12519,7 @@ var ts; } else { var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; - if (leftmostExpressionKind === 176 || leftmostExpressionKind === 184) { + if (leftmostExpressionKind === 177 || leftmostExpressionKind === 185) { return createParen(expression, expression); } } @@ -12487,21 +12537,21 @@ var ts; function getLeftmostExpression(node) { while (true) { switch (node.kind) { - case 191: + case 192: node = node.operand; continue; - case 192: + case 193: node = node.left; continue; - case 193: + case 194: node = node.condition; continue; + case 180: case 179: case 178: - case 177: node = node.expression; continue; - case 295: + case 296: node = node.expression; continue; } @@ -12510,7 +12560,7 @@ var ts; } function parenthesizeConciseBody(body) { var emittedBody = skipPartiallyEmittedExpressions(body); - if (emittedBody.kind === 176) { + if (emittedBody.kind === 177) { return createParen(body, body); } return body; @@ -12535,7 +12585,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipParentheses(node) { - while (node.kind === 183) { + while (node.kind === 184) { node = node.expression; } return node; @@ -12549,7 +12599,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 295) { + while (node.kind === 296) { node = node.expression; } return node; @@ -12590,8 +12640,10 @@ var ts; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { if (!destRanges) - destRanges = ts.createMap(); - ts.copyProperties(sourceRanges, destRanges); + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } return destRanges; } function disposeEmitNodes(sourceFile) { @@ -12609,7 +12661,7 @@ var ts; function getOrCreateEmitNode(node) { if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 262) { + if (node.kind === 263) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -12648,7 +12700,7 @@ var ts; ts.getTokenSourceMapRange = getTokenSourceMapRange; function setTokenSourceMapRange(node, token, range) { var emitNode = getOrCreateEmitNode(node); - var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); tokenSourceMapRanges[token] = range; return node; } @@ -12797,13 +12849,13 @@ var ts; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_10 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_10) ? name_10 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name) ? name : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 236 && node.importClause) { + if (node.kind === 237 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 242 && node.moduleSpecifier) { + if (node.kind === 243 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } return undefined; @@ -12820,10 +12872,8 @@ var ts; } ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral; function tryRenameExternalModule(moduleName, sourceFile) { - if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) { - return createLiteral(sourceFile.renamedDependencies[moduleName.text]); - } - return undefined; + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && createLiteral(rename); } function tryGetModuleNameFromFile(file, host, options) { if (!file) { @@ -12867,11 +12917,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 258: - return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 259: - return bindingElement.name; + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 260: + return bindingElement.name; + case 261: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -12887,11 +12937,11 @@ var ts; ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 144: - case 174: + case 145: + case 175: return bindingElement.dotDotDotToken; - case 196: - case 260: + case 197: + case 261: return bindingElement; } return undefined; @@ -12899,7 +12949,7 @@ var ts; ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 174: + case 175: if (bindingElement.propertyName) { var propertyName = bindingElement.propertyName; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -12907,7 +12957,7 @@ var ts; : propertyName; } break; - case 258: + case 259: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -12915,7 +12965,7 @@ var ts; : propertyName; } break; - case 260: + case 261: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -12929,11 +12979,11 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 172: case 173: - case 175: - return name.elements; + case 174: case 176: + return name.elements; + case 177: return name.properties; } } @@ -12970,11 +13020,11 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 173: - case 175: - return convertToArrayAssignmentPattern(node); - case 172: + case 174: case 176: + return convertToArrayAssignmentPattern(node); + case 173: + case 177: return convertToObjectAssignmentPattern(node); } } @@ -13005,8 +13055,8 @@ var ts; ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); + var exportSpecifiers = ts.createMultiMap(); + var exportedBindings = []; var uniqueExports = ts.createMap(); var exportedNames; var hasExportDefault = false; @@ -13020,15 +13070,15 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 236: + case 237: externalImports.push(node); break; - case 235: - if (node.moduleReference.kind === 246) { + case 236: + if (node.moduleReference.kind === 247) { externalImports.push(node); } break; - case 242: + case 243: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -13041,26 +13091,26 @@ var ts; else { for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_11 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_11.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_11) - || resolver.getReferencedValueDeclaration(name_11); + if (!uniqueExports.get(specifier.name.text)) { + var name = specifier.propertyName || specifier.name; + exportSpecifiers.add(name.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); if (decl) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); } - uniqueExports[specifier.name.text] = true; + uniqueExports.set(specifier.name.text, true); exportedNames = ts.append(exportedNames, specifier.name); } } } break; - case 241: + case 242: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 206: + case 207: if (ts.hasModifier(node, 1)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13068,38 +13118,38 @@ var ts; } } break; - case 226: + case 227: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_12 = node.name; - if (!uniqueExports[name_12.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12); - uniqueExports[name_12.text] = true; - exportedNames = ts.append(exportedNames, name_12); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } break; - case 227: + case 228: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_13 = node.name; - if (!uniqueExports[name_13.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_13); - uniqueExports[name_13.text] = true; - exportedNames = ts.append(exportedNames, name_13); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } @@ -13119,13 +13169,23 @@ var ts; } } else if (!ts.isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = true; + if (!uniqueExports.get(decl.name.text)) { + uniqueExports.set(decl.name.text, true); exportedNames = ts.append(exportedNames, decl.name); } } return exportedNames; } + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } })(ts || (ts = {})); var ts; (function (ts) { @@ -13134,13 +13194,13 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 262) { + if (kind === 263) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } - else if (kind < 141) { + else if (kind < 142) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end); } else { @@ -13176,28 +13236,28 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 141: + case 142: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 143: + case 144: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 259: + case 260: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 260: + case 261: return visitNode(cbNode, node.expression); - case 144: + case 145: + case 148: case 147: - case 146: - case 258: - case 224: - case 174: + case 259: + case 225: + case 175: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -13206,24 +13266,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 158: case 159: - case 153: + case 160: case 154: case 155: + case 156: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 184: - case 226: + case 153: case 185: + case 227: + case 186: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -13234,323 +13294,323 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 157: + case 158: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 156: + case 157: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 160: - return visitNode(cbNode, node.exprName); case 161: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 162: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 163: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 164: + return visitNodes(cbNodes, node.elementTypes); case 165: - return visitNodes(cbNodes, node.types); case 166: - case 168: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); + case 167: case 169: + return visitNode(cbNode, node.type); + case 170: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); - case 170: + case 171: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); - case 171: - return visitNode(cbNode, node.literal); case 172: + return visitNode(cbNode, node.literal); case 173: - return visitNodes(cbNodes, node.elements); - case 175: + case 174: return visitNodes(cbNodes, node.elements); case 176: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 177: + return visitNodes(cbNodes, node.properties); + case 178: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 178: + case 179: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 179: case 180: + case 181: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 181: + case 182: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 182: + case 183: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 183: - return visitNode(cbNode, node.expression); - case 186: + case 184: return visitNode(cbNode, node.expression); case 187: return visitNode(cbNode, node.expression); case 188: return visitNode(cbNode, node.expression); - case 190: - return visitNode(cbNode, node.operand); - case 195: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 189: return visitNode(cbNode, node.expression); case 191: return visitNode(cbNode, node.operand); + case 196: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 190: + return visitNode(cbNode, node.expression); case 192: + return visitNode(cbNode, node.operand); + case 193: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 200: + case 201: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 201: - return visitNode(cbNode, node.expression); case 202: + return visitNode(cbNode, node.expression); + case 203: return visitNode(cbNode, node.name); - case 193: + case 194: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 196: + case 197: return visitNode(cbNode, node.expression); - case 205: - case 232: + case 206: + case 233: return visitNodes(cbNodes, node.statements); - case 262: + case 263: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 206: + case 207: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 225: + case 226: return visitNodes(cbNodes, node.declarations); - case 208: - return visitNode(cbNode, node.expression); case 209: + return visitNode(cbNode, node.expression); + case 210: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 210: + case 211: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 211: + case 212: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 212: + case 213: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 213: + case 214: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214: + case 215: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 215: case 216: - return visitNode(cbNode, node.label); case 217: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.label); case 218: + return visitNode(cbNode, node.expression); + case 219: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 219: + case 220: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 233: + case 234: return visitNodes(cbNodes, node.clauses); - case 254: + case 255: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 255: + case 256: return visitNodes(cbNodes, node.statements); - case 220: + case 221: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 221: - return visitNode(cbNode, node.expression); case 222: + return visitNode(cbNode, node.expression); + case 223: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 257: + case 258: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 145: + case 146: return visitNode(cbNode, node.expression); - case 227: - case 197: + case 228: + case 198: 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 228: + case 229: 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 229: + case 230: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 230: + case 231: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 261: + case 262: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 231: + case 232: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 235: + case 236: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 236: + case 237: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 237: + case 238: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 234: - return visitNode(cbNode, node.name); - case 238: + case 235: return visitNode(cbNode, node.name); case 239: - case 243: + return visitNode(cbNode, node.name); + case 240: + case 244: return visitNodes(cbNodes, node.elements); - case 242: + case 243: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 240: - case 244: + case 241: + case 245: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 241: + case 242: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 194: + case 195: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 203: + case 204: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 142: + case 143: return visitNode(cbNode, node.expression); - case 256: + case 257: return visitNodes(cbNodes, node.types); - case 199: + case 200: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 246: + case 247: return visitNode(cbNode, node.expression); - case 245: + case 246: return visitNodes(cbNodes, node.decorators); - case 247: + case 248: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 248: case 249: + case 250: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 251: + case 252: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 252: - return visitNode(cbNode, node.expression); case 253: + return visitNode(cbNode, node.expression); + case 254: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 250: + case 251: return visitNode(cbNode, node.tagName); - case 263: + case 264: return visitNode(cbNode, node.type); - case 267: - return visitNodes(cbNodes, node.types); case 268: return visitNodes(cbNodes, node.types); - case 266: + case 269: + return visitNodes(cbNodes, node.types); + case 267: return visitNode(cbNode, node.elementType); - case 270: + case 271: return visitNode(cbNode, node.type); - case 269: + case 270: return visitNode(cbNode, node.type); - case 271: + case 272: return visitNode(cbNode, node.literal); - case 273: + case 274: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 274: - return visitNode(cbNode, node.type); case 275: + return visitNode(cbNode, node.type); + case 276: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 276: - return visitNode(cbNode, node.type); case 277: return visitNode(cbNode, node.type); case 278: return visitNode(cbNode, node.type); - case 272: + case 279: + return visitNode(cbNode, node.type); + case 273: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 279: + case 280: return visitNodes(cbNodes, node.tags); - case 282: + case 283: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 283: - return visitNode(cbNode, node.typeExpression); case 284: return visitNode(cbNode, node.typeExpression); - case 281: - return visitNode(cbNode, node.typeExpression); case 285: - return visitNodes(cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 282: + return visitNode(cbNode, node.typeExpression); case 286: + return visitNodes(cbNodes, node.typeParameters); + case 287: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 288: + case 289: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 287: + case 288: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 295: + case 296: return visitNode(cbNode, node.expression); - case 289: + case 290: return visitNode(cbNode, node.literal); } } @@ -13714,7 +13774,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(262, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(263, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -13941,7 +14001,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return kind >= 141 ? new NodeConstructor(kind, pos, pos) : + return kind >= 142 ? new NodeConstructor(kind, pos, pos) : kind === 70 ? new IdentifierConstructor(kind, pos, pos) : new TokenConstructor(kind, pos, pos); } @@ -13978,7 +14038,11 @@ var ts; } function internIdentifier(text) { text = ts.escapeIdentifier(text); - return identifiers[text] || (identifiers[text] = text); + var identifier = identifiers.get(text); + if (identifier === undefined) { + identifiers.set(text, identifier = text); + } + return identifier; } function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; @@ -14023,7 +14087,7 @@ var ts; return token() === 9 || token() === 8 || ts.tokenIsIdentifierOrKeyword(token()); } function parseComputedPropertyName() { - var node = createNode(142); + var node = createNode(143); parseExpected(20); node.expression = allowInAnd(parseExpression); parseExpected(21); @@ -14328,14 +14392,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 150: - case 155: case 151: + case 156: case 152: - case 147: - case 204: + case 153: + case 148: + case 205: return true; - case 149: + case 150: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 70 && methodDeclaration.name.originalKeywordKind === 122; @@ -14347,8 +14411,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 254: case 255: + case 256: return true; } } @@ -14357,65 +14421,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 226: + case 227: + case 207: case 206: - case 205: + case 210: case 209: - case 208: - case 221: + case 222: + case 218: + case 220: case 217: - case 219: case 216: + case 214: case 215: case 213: - case 214: case 212: - case 211: - case 218: - case 207: - case 222: - case 220: - case 210: + case 219: + case 208: case 223: + case 221: + case 211: + case 224: + case 237: case 236: - case 235: + case 243: case 242: - case 241: - case 231: - case 227: + case 232: case 228: - case 230: case 229: + case 231: + case 230: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 261; + return node.kind === 262; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 154: - case 148: case 155: - case 146: - case 153: + case 149: + case 156: + case 147: + case 154: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 224) { + if (node.kind !== 225) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 144) { + if (node.kind !== 145) { return false; } var parameter = node; @@ -14511,7 +14575,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(22)) { - var node = createNode(141, entity.pos); + var node = createNode(142, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -14528,7 +14592,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(194); + var template = createNode(195); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 13, "Template head has wrong token kind"); var templateSpans = createNodeArray(); @@ -14540,7 +14604,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(203); + var span = createNode(204); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17) { @@ -14588,7 +14652,7 @@ var ts; } function parseTypeReference() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - var node = createNode(157, typeName.pos); + var node = createNode(158, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); @@ -14597,24 +14661,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(156, lhs.pos); + var node = createNode(157, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(167); + var node = createNode(168); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(160); + var node = createNode(161); parseExpected(102); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); if (parseOptional(84)) { if (isStartOfType() || !isStartOfExpression()) { @@ -14641,7 +14705,7 @@ var ts; return token() === 23 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 || token() === 98; } function parseParameter() { - var node = createNode(144); + var node = createNode(145); if (token() === 98) { node.name = createIdentifier(true, undefined); node.type = parseParameterType(); @@ -14701,7 +14765,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 154) { + if (kind === 155) { parseExpected(93); } fillSignature(55, false, false, false, node); @@ -14741,7 +14805,7 @@ var ts; return token() === 55 || token() === 25 || token() === 21; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(155, fullStart); + var node = createNode(156, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.parameters = parseBracketedList(16, parseParameter, 20, 21); @@ -14753,7 +14817,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(54); if (token() === 18 || token() === 26) { - var method = createNode(148, fullStart); + var method = createNode(149, fullStart); method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; @@ -14762,7 +14826,7 @@ var ts; return addJSDocComment(finishNode(method)); } else { - var property = createNode(146, fullStart); + var property = createNode(147, fullStart); property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; @@ -14802,10 +14866,10 @@ var ts; } function parseTypeMember() { if (token() === 18 || token() === 26) { - return parseSignatureMember(153); + return parseSignatureMember(154); } if (token() === 93 && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(154); + return parseSignatureMember(155); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -14819,7 +14883,7 @@ var ts; return token() === 18 || token() === 26; } function parseTypeLiteral() { - var node = createNode(161); + var node = createNode(162); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -14842,14 +14906,14 @@ var ts; return token() === 20 && nextTokenIsIdentifier() && nextToken() === 91; } function parseMappedTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); parseExpected(91); node.constraint = parseType(); return finishNode(node); } function parseMappedType() { - var node = createNode(170); + var node = createNode(171); parseExpected(16); node.readonlyToken = parseOptionalToken(130); parseExpected(20); @@ -14862,12 +14926,12 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(163); + var node = createNode(164); node.elementTypes = parseBracketedList(20, parseType, 20, 21); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(166); + var node = createNode(167); parseExpected(18); node.type = parseType(); parseExpected(19); @@ -14875,7 +14939,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 159) { + if (kind === 160) { parseExpected(93); } fillSignature(35, false, false, false, node); @@ -14886,7 +14950,7 @@ var ts; return token() === 22 ? undefined : node; } function parseLiteralTypeNode() { - var node = createNode(171); + var node = createNode(172); node.literal = parseSimpleUnaryExpression(); finishNode(node); return node; @@ -14897,12 +14961,13 @@ var ts; function parseNonArrayType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: - case 137: + case 136: + case 138: case 129: + case 133: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 9: @@ -14939,12 +15004,12 @@ var ts; function isStartOfType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: - case 137: + case 138: case 94: case 98: case 102: @@ -14959,6 +15024,7 @@ var ts; case 8: case 100: case 85: + case 133: return true; case 37: return lookAhead(nextTokenIsNumericLiteral); @@ -14976,14 +15042,14 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(20)) { if (isStartOfType()) { - var node = createNode(169, type.pos); + var node = createNode(170, type.pos); node.objectType = type; node.indexType = parseType(); parseExpected(21); type = finishNode(node); } else { - var node = createNode(162, type.pos); + var node = createNode(163, type.pos); node.elementType = type; parseExpected(21); type = finishNode(node); @@ -14992,7 +15058,7 @@ var ts; return type; } function parseTypeOperator(operator) { - var node = createNode(168); + var node = createNode(169); parseExpected(operator); node.operator = operator; node.type = parseTypeOperatorOrHigher(); @@ -15021,10 +15087,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(165, parseTypeOperatorOrHigher, 47); + return parseUnionOrIntersectionType(166, parseTypeOperatorOrHigher, 47); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(164, parseIntersectionTypeOrHigher, 48); + return parseUnionOrIntersectionType(165, parseIntersectionTypeOrHigher, 48); } function isStartOfFunctionType() { if (token() === 26) { @@ -15070,7 +15136,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(156, typePredicateVariable.pos); + var node = createNode(157, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -15091,10 +15157,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(158); + return parseFunctionOrConstructorType(159); } if (token() === 93) { - return parseFunctionOrConstructorType(159); + return parseFunctionOrConstructorType(160); } return parseUnionTypeOrHigher(); } @@ -15213,7 +15279,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(195); + var node = createNode(196); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token() === 38 || isStartOfExpression())) { @@ -15229,13 +15295,13 @@ var ts; ts.Debug.assert(token() === 35, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(185, asyncModifier.pos); + node = createNode(186, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(185, identifier.pos); + node = createNode(186, identifier.pos); } - var parameter = createNode(144, identifier.pos); + var parameter = createNode(145, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = createNodeArray([parameter], parameter.pos); @@ -15369,7 +15435,7 @@ var ts; return 0; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(185); + var node = createNode(186); node.modifiers = parseModifiersForArrowFunction(); var isAsync = !!(ts.getModifierFlags(node) & 256); fillSignature(55, false, isAsync, !allowAmbiguity, node); @@ -15401,7 +15467,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(193, leftOperand.pos); + var node = createNode(194, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -15414,7 +15480,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 91 || t === 140; + return t === 91 || t === 141; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -15492,39 +15558,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(192, left.pos); + var node = createNode(193, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(200, left.pos); + var node = createNode(201, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(186); + var node = createNode(187); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(187); + var node = createNode(188); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(188); + var node = createNode(189); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -15539,7 +15605,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(189); + var node = createNode(190); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -15555,7 +15621,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token() === 39) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 182) { + if (simpleUnaryExpression.kind === 183) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -15608,7 +15674,7 @@ var ts; } function parseIncrementExpression() { if (token() === 42 || token() === 43) { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -15620,7 +15686,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 42 || token() === 43) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(191, expression.pos); + var node = createNode(192, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -15643,7 +15709,7 @@ var ts; if (token() === 18 || token() === 22 || token() === 20) { return expression; } - var node = createNode(177, expression.pos); + var node = createNode(178, expression.pos); node.expression = expression; parseExpectedToken(22, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -15665,8 +15731,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 249) { - var node = createNode(247, opening.pos); + if (opening.kind === 250) { + var node = createNode(248, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -15676,14 +15742,14 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 248); + ts.Debug.assert(opening.kind === 249); result = opening; } if (inExpressionContext && token() === 26) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(192, result.pos); + var badNode = createNode(193, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -15736,7 +15802,7 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token() === 28) { - node = createNode(249, fullStart); + node = createNode(250, fullStart); scanJsxText(); } else { @@ -15748,7 +15814,7 @@ var ts; parseExpected(28, undefined, false); scanJsxText(); } - node = createNode(248, fullStart); + node = createNode(249, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -15759,7 +15825,7 @@ var ts; var expression = token() === 98 ? parseTokenNode() : parseIdentifierName(); while (parseOptional(22)) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -15767,7 +15833,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(253); + var node = createNode(254); parseExpected(16); if (token() !== 17) { node.dotDotDotToken = parseOptionalToken(23); @@ -15787,7 +15853,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(251); + var node = createNode(252); node.name = parseIdentifierName(); if (token() === 57) { switch (scanJsxAttributeValue()) { @@ -15802,7 +15868,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(252); + var node = createNode(253); parseExpected(16); parseExpected(23); node.expression = parseExpression(); @@ -15810,7 +15876,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(250); + var node = createNode(251); parseExpected(27); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -15823,7 +15889,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(182); + var node = createNode(183); parseExpected(26); node.type = parseType(); parseExpected(28); @@ -15834,7 +15900,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(22); if (dotToken) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -15842,13 +15908,13 @@ var ts; } if (token() === 50 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(201, expression.pos); + var nonNullExpression = createNode(202, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } if (!inDecoratorContext() && parseOptional(20)) { - var indexedAccess = createNode(178, expression.pos); + var indexedAccess = createNode(179, expression.pos); indexedAccess.expression = expression; if (token() !== 21) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -15862,7 +15928,7 @@ var ts; continue; } if (token() === 12 || token() === 13) { - var tagExpression = createNode(181, expression.pos); + var tagExpression = createNode(182, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 12 ? parseLiteralNode() @@ -15881,7 +15947,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -15889,7 +15955,7 @@ var ts; continue; } else if (token() === 18) { - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -15984,28 +16050,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(183); + var node = createNode(184); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); return finishNode(node); } function parseSpreadElement() { - var node = createNode(196); + var node = createNode(197); parseExpected(23); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 23 ? parseSpreadElement() : - token() === 25 ? createNode(198) : + token() === 25 ? createNode(199) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(175); + var node = createNode(176); parseExpected(20); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16016,18 +16082,18 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(124)) { - return parseAccessorDeclaration(151, fullStart, decorators, modifiers); - } - else if (parseContextualModifier(133)) { return parseAccessorDeclaration(152, fullStart, decorators, modifiers); } + else if (parseContextualModifier(134)) { + return parseAccessorDeclaration(153, fullStart, decorators, modifiers); + } return undefined; } function parseObjectLiteralElement() { var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23); if (dotDotDotToken) { - var spreadElement = createNode(260, fullStart); + var spreadElement = createNode(261, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -16046,7 +16112,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(259, fullStart); + var shorthandDeclaration = createNode(260, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57); @@ -16057,7 +16123,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(258, fullStart); + var propertyAssignment = createNode(259, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -16067,7 +16133,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(176); + var node = createNode(177); parseExpected(16); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16081,7 +16147,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(184); + var node = createNode(185); node.modifiers = parseModifiers(); parseExpected(88); node.asteriskToken = parseOptionalToken(38); @@ -16106,12 +16172,12 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(93); if (parseOptional(22)) { - var node_1 = createNode(202, fullStart); + var node_1 = createNode(203, fullStart); node_1.keywordToken = 93; node_1.name = parseIdentifierName(); return finishNode(node_1); } - var node = createNode(180, fullStart); + var node = createNode(181, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18) { @@ -16120,7 +16186,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(205); + var node = createNode(206); if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16151,12 +16217,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(207); + var node = createNode(208); parseExpected(24); return finishNode(node); } function parseIfStatement() { - var node = createNode(209); + var node = createNode(210); parseExpected(89); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16166,7 +16232,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(210); + var node = createNode(211); parseExpected(80); node.statement = parseStatement(); parseExpected(105); @@ -16177,7 +16243,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(211); + var node = createNode(212); parseExpected(105); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16200,21 +16266,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(91)) { - var forInStatement = createNode(213, pos); + var forInStatement = createNode(214, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(19); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(140)) { - var forOfStatement = createNode(214, pos); + else if (parseOptional(141)) { + var forOfStatement = createNode(215, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(212, pos); + var forStatement = createNode(213, pos); forStatement.initializer = initializer; parseExpected(24); if (token() !== 24 && token() !== 19) { @@ -16232,7 +16298,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 216 ? 71 : 76); + parseExpected(kind === 217 ? 71 : 76); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -16240,7 +16306,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(217); + var node = createNode(218); parseExpected(95); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -16249,7 +16315,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(218); + var node = createNode(219); parseExpected(106); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16258,7 +16324,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(254); + var node = createNode(255); parseExpected(72); node.expression = allowInAnd(parseExpression); parseExpected(55); @@ -16266,7 +16332,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(255); + var node = createNode(256); parseExpected(78); parseExpected(55); node.statements = parseList(3, parseStatement); @@ -16276,12 +16342,12 @@ var ts; return token() === 72 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(219); + var node = createNode(220); parseExpected(97); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); - var caseBlock = createNode(233, scanner.getStartPos()); + var caseBlock = createNode(234, scanner.getStartPos()); parseExpected(16); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(17); @@ -16289,14 +16355,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(221); + var node = createNode(222); parseExpected(99); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(222); + var node = createNode(223); parseExpected(101); node.tryBlock = parseBlock(false); node.catchClause = token() === 73 ? parseCatchClause() : undefined; @@ -16307,7 +16373,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(257); + var result = createNode(258); parseExpected(73); if (parseExpected(18)) { result.variableDeclaration = parseVariableDeclaration(); @@ -16317,7 +16383,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(223); + var node = createNode(224); parseExpected(77); parseSemicolon(); return finishNode(node); @@ -16326,13 +16392,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 && parseOptional(55)) { - var labeledStatement = createNode(220, fullStart); + var labeledStatement = createNode(221, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(208, fullStart); + var expressionStatement = createNode(209, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -16361,7 +16427,7 @@ var ts; case 82: return true; case 108: - case 136: + case 137: return nextTokenIsIdentifierOnSameLine(); case 127: case 128: @@ -16378,7 +16444,7 @@ var ts; return false; } continue; - case 139: + case 140: nextToken(); return token() === 16 || token() === 70 || token() === 83; case 90: @@ -16438,8 +16504,8 @@ var ts; case 108: case 127: case 128: - case 136: - case 139: + case 137: + case 140: return true; case 113: case 111: @@ -16484,9 +16550,9 @@ var ts; case 87: return parseForOrForInOrForOfStatement(); case 76: - return parseBreakOrContinueStatement(215); - case 71: return parseBreakOrContinueStatement(216); + case 71: + return parseBreakOrContinueStatement(217); case 95: return parseReturnStatement(); case 106: @@ -16505,7 +16571,7 @@ var ts; return parseDeclaration(); case 119: case 108: - case 136: + case 137: case 127: case 128: case 123: @@ -16519,7 +16585,7 @@ var ts; case 116: case 114: case 130: - case 139: + case 140: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -16542,11 +16608,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 108: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 136: + case 137: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 82: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 139: + case 140: case 127: case 128: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -16565,7 +16631,7 @@ var ts; } default: if (decorators || modifiers) { - var node = createMissingNode(245, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(246, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -16586,16 +16652,16 @@ var ts; } function parseArrayBindingElement() { if (token() === 25) { - return createNode(198); + return createNode(199); } - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -16611,14 +16677,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(172); + var node = createNode(173); parseExpected(16); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(17); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(173); + var node = createNode(174); parseExpected(20); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(21); @@ -16637,7 +16703,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(224); + var node = createNode(225); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -16646,7 +16712,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(225); + var node = createNode(226); switch (token()) { case 103: break; @@ -16660,7 +16726,7 @@ var ts; ts.Debug.fail(); } nextToken(); - if (token() === 140 && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 141 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -16675,7 +16741,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(206, fullStart); + var node = createNode(207, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(false); @@ -16683,7 +16749,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(226, fullStart); + var node = createNode(227, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88); @@ -16696,7 +16762,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(150, pos); + var node = createNode(151, pos); node.decorators = decorators; node.modifiers = modifiers; parseExpected(122); @@ -16705,7 +16771,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(149, fullStart); + var method = createNode(150, fullStart); method.decorators = decorators; method.modifiers = modifiers; method.asteriskToken = asteriskToken; @@ -16718,7 +16784,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(147, fullStart); + var property = createNode(148, fullStart); property.decorators = decorators; property.modifiers = modifiers; property.name = name; @@ -16788,7 +16854,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 133 || idToken === 124) { + if (!ts.isKeyword(idToken) || idToken === 134 || idToken === 124) { return true; } switch (token()) { @@ -16811,7 +16877,7 @@ var ts; if (!parseOptional(56)) { break; } - var decorator = createNode(145, decoratorStart); + var decorator = createNode(146, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); finishNode(decorator); if (!decorators) { @@ -16868,7 +16934,7 @@ var ts; } function parseClassElement() { if (token() === 24) { - var result = createNode(204); + var result = createNode(205); nextToken(); return finishNode(result); } @@ -16893,16 +16959,16 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_14 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_14, undefined); + var name = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 197); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 198); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 227); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 228); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -16937,7 +17003,7 @@ var ts; } function parseHeritageClause() { if (token() === 84 || token() === 107) { - var node = createNode(256); + var node = createNode(257); node.token = token(); nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -16946,7 +17012,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(199); + var node = createNode(200); node.expression = parseLeftHandSideExpressionOrHigher(); if (token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); @@ -16960,7 +17026,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228, fullStart); + var node = createNode(229, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108); @@ -16971,10 +17037,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229, fullStart); + var node = createNode(230, fullStart); node.decorators = decorators; node.modifiers = modifiers; - parseExpected(136); + parseExpected(137); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(57); @@ -16983,13 +17049,13 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(261, scanner.getStartPos()); + var node = createNode(262, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230, fullStart); + var node = createNode(231, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82); @@ -17004,7 +17070,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(232, scanner.getStartPos()); + var node = createNode(233, scanner.getStartPos()); if (parseExpected(16)) { node.statements = parseList(1, parseStatement); parseExpected(17); @@ -17015,7 +17081,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(231, fullStart); + var node = createNode(232, fullStart); var namespaceFlag = flags & 16; node.decorators = decorators; node.modifiers = modifiers; @@ -17027,10 +17093,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(231, fullStart); + var node = createNode(232, fullStart); node.decorators = decorators; node.modifiers = modifiers; - if (token() === 139) { + if (token() === 140) { node.name = parseIdentifier(); node.flags |= 512; } @@ -17047,7 +17113,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = 0; - if (token() === 139) { + if (token() === 140) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } else if (parseOptional(128)) { @@ -17072,7 +17138,7 @@ var ts; return nextToken() === 40; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(234, fullStart); + var exportDeclaration = createNode(235, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117); @@ -17087,8 +17153,8 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 25 && token() !== 138) { - var importEqualsDeclaration = createNode(235, fullStart); + if (token() !== 25 && token() !== 139) { + var importEqualsDeclaration = createNode(236, fullStart); importEqualsDeclaration.decorators = decorators; importEqualsDeclaration.modifiers = modifiers; importEqualsDeclaration.name = identifier; @@ -17098,27 +17164,27 @@ var ts; return addJSDocComment(finishNode(importEqualsDeclaration)); } } - var importDeclaration = createNode(236, fullStart); + var importDeclaration = createNode(237, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; if (identifier || token() === 38 || token() === 16) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(138); + parseExpected(139); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(237, fullStart); + var importClause = createNode(238, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(25)) { - importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(239); + importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(240); } return finishNode(importClause); } @@ -17128,7 +17194,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(246); + var node = createNode(247); parseExpected(131); parseExpected(18); node.expression = parseModuleSpecifier(); @@ -17146,7 +17212,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(238); + var namespaceImport = createNode(239); parseExpected(38); parseExpected(117); namespaceImport.name = parseIdentifier(); @@ -17154,14 +17220,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 239 ? parseImportSpecifier : parseExportSpecifier, 16, 17); + node.elements = parseBracketedList(22, kind === 240 ? parseImportSpecifier : parseExportSpecifier, 16, 17); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(244); + return parseImportOrExportSpecifier(245); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(240); + return parseImportOrExportSpecifier(241); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -17180,23 +17246,23 @@ var ts; else { node.name = identifierName; } - if (kind === 240 && checkIdentifierIsKeyword) { + if (kind === 241 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(242, fullStart); + var node = createNode(243, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38)) { - parseExpected(138); + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(243); - if (token() === 138 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(138); + node.exportClause = parseNamedImportsOrExports(244); + if (token() === 139 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -17204,7 +17270,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(241, fullStart); + var node = createNode(242, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57)) { @@ -17283,10 +17349,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 235 && node.moduleReference.kind === 246 - || node.kind === 236 - || node.kind === 241 + || node.kind === 236 && node.moduleReference.kind === 247 + || node.kind === 237 || node.kind === 242 + || node.kind === 243 ? node : undefined; }); @@ -17322,7 +17388,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression() { - var result = createNode(263, scanner.getTokenPos()); + var result = createNode(264, scanner.getTokenPos()); parseExpected(16); result.type = parseJSDocTopLevelType(); parseExpected(17); @@ -17333,12 +17399,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48) { - var unionType = createNode(267, type.pos); + var unionType = createNode(268, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57) { - var optionalType = createNode(274, type.pos); + var optionalType = createNode(275, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -17349,20 +17415,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20) { - var arrayType = createNode(266, type.pos); + var arrayType = createNode(267, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21); type = finishNode(arrayType); } else if (token() === 54) { - var nullableType = createNode(269, type.pos); + var nullableType = createNode(270, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50) { - var nonNullableType = createNode(270, type.pos); + var nonNullableType = createNode(271, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -17396,14 +17462,15 @@ var ts; case 98: return parseJSDocThisType(); case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: case 94: - case 137: + case 138: case 129: + case 133: return parseTokenNode(); case 9: case 8: @@ -17414,27 +17481,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(278); + var result = createNode(279); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(277); + var result = createNode(278); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(276); + var result = createNode(277); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(275); + var result = createNode(276); nextToken(); parseExpected(18); result.parameters = parseDelimitedList(23, parseJSDocParameter); @@ -17447,7 +17514,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(144); + var parameter = createNode(145); parameter.type = parseJSDocType(); if (parseOptional(57)) { parameter.questionToken = createNode(57); @@ -17455,7 +17522,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(273); + var result = createNode(274); result.name = parseSimplePropertyName(); if (token() === 26) { result.typeArguments = parseTypeArguments(); @@ -17489,24 +17556,24 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(141, left.pos); + var result = createNode(142, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(271); + var result = createNode(272); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(270); + var result = createNode(271); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(268); + var result = createNode(269); nextToken(); result.types = parseDelimitedList(26, parseJSDocType); checkForTrailingComma(result.types); @@ -17520,7 +17587,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(267); + var result = createNode(268); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19); @@ -17536,12 +17603,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(264); + var result = createNode(265); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(289); + var result = createNode(290); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -17554,11 +17621,11 @@ var ts; token() === 28 || token() === 57 || token() === 48) { - var result = createNode(265, pos); + var result = createNode(266, pos); return finishNode(result); } else { - var result = createNode(269, pos); + var result = createNode(270, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -17702,7 +17769,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(279, start); + var result = createNode(280, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -17812,7 +17879,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(280, atToken.pos); + var result = createNode(281, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -17867,7 +17934,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(282, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -17878,20 +17945,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(284, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -17906,7 +17973,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(287, atToken.pos); + var result = createNode(288, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -17915,7 +17982,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(281, atToken.pos); + var result = createNode(282, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -17924,25 +17991,28 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(286, atToken.pos); + var typedefTag = createNode(287, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); if (typedefTag.fullName) { var rightNode = typedefTag.fullName; - while (rightNode.kind !== 70) { + while (true) { + if (rightNode.kind === 70 || !rightNode.body) { + typedefTag.name = rightNode.kind === 70 ? rightNode : rightNode.name; + break; + } rightNode = rightNode.body; } - typedefTag.name = rightNode; } typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 273) { + if (typeExpression.type.kind === 274) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { - var name_15 = jsDocTypeReference.name; - if (name_15.text === "Object") { + var name = jsDocTypeReference.name; + if (name.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -17956,7 +18026,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(288, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(289, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -17997,7 +18067,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22)) { - var jsDocNamespaceNode = createNode(231, pos); + var jsDocNamespaceNode = createNode(232, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -18041,19 +18111,19 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 285; })) { + if (ts.forEach(tags, function (t) { return t.kind === 286; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); while (true) { - var name_16 = parseJSDocIdentifierName(); + var name = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_16) { + if (!name) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143, name_16.pos); - typeParameter.name = name_16; + var typeParameter = createNode(144, name.pos); + typeParameter.name = name; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25) { @@ -18064,7 +18134,7 @@ var ts; break; } } - var result = createNode(285, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -18383,16 +18453,16 @@ var ts; var ts; (function (ts) { function getModuleInstanceState(node) { - if (node.kind === 228 || node.kind === 229) { + if (node.kind === 229 || node.kind === 230) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 236 || node.kind === 235) && !(ts.hasModifier(node, 1))) { + else if ((node.kind === 237 || node.kind === 236) && !(ts.hasModifier(node, 1))) { return 0; } - else if (node.kind === 232) { + else if (node.kind === 233) { var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -18408,7 +18478,7 @@ var ts; }); return state_1; } - else if (node.kind === 231) { + else if (node.kind === 232) { var body = node.body; return body ? getModuleInstanceState(body) : 1; } @@ -18517,7 +18587,7 @@ var ts; if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 231)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 232)) { symbol.valueDeclaration = node; } } @@ -18527,7 +18597,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 142) { + if (node.name.kind === 143) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; @@ -18538,21 +18608,21 @@ var ts; return node.name.text; } switch (node.kind) { - case 150: + case 151: return "__constructor"; - case 158: - case 153: - return "__call"; case 159: case 154: - return "__new"; + return "__call"; + case 160: case 155: + return "__new"; + case 156: return "__index"; - case 242: + case 243: return "__export"; - case 241: + case 242: return node.isExportEquals ? "export=" : "default"; - case 192: + case 193: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2: return "export="; @@ -18564,20 +18634,20 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 226: case 227: + case 228: return ts.hasModifier(node, 512) ? "default" : undefined; - case 275: + case 276: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 144: - ts.Debug.assert(node.parent.kind === 275); + case 145: + ts.Debug.assert(node.parent.kind === 276); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 286: + case 287: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 206) { + if (parentNode && parentNode.kind === 207) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -18600,13 +18670,16 @@ var ts; symbol = createSymbol(0, "__missing"); } else { - symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0, name)); + symbol = symbolTable.get(name); + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(0, name)); + } if (name && (includes & 788448)) { - classifiableNames[name] = name; + classifiableNames.set(name, name); } if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { - symbol = symbolTable[name] = createSymbol(0, name); + symbolTable.set(name, symbol = createSymbol(0, name)); } else { if (node.name) { @@ -18621,7 +18694,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 241 && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 242 && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -18641,7 +18714,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 244 || (node.kind === 235 && hasExportModifier)) { + if (node.kind === 245 || (node.kind === 236 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -18649,7 +18722,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 286 && + var isJSDocTypedefInJSDocNamespace = node.kind === 287 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -18710,7 +18783,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 262) { + if (node.kind === 263) { node.flags |= emitFlags; } if (isIIFE) { @@ -18786,64 +18859,64 @@ var ts; return; } switch (node.kind) { - case 211: + case 212: bindWhileStatement(node); break; - case 210: + case 211: bindDoStatement(node); break; - case 212: + case 213: bindForStatement(node); break; - case 213: case 214: + case 215: bindForInOrForOfStatement(node); break; - case 209: + case 210: bindIfStatement(node); break; - case 217: - case 221: + case 218: + case 222: bindReturnOrThrow(node); break; + case 217: case 216: - case 215: bindBreakOrContinueStatement(node); break; - case 222: + case 223: bindTryStatement(node); break; - case 219: + case 220: bindSwitchStatement(node); break; - case 233: + case 234: bindCaseBlock(node); break; - case 254: + case 255: bindCaseClause(node); break; - case 220: + case 221: bindLabeledStatement(node); break; - case 190: + case 191: bindPrefixUnaryExpressionFlow(node); break; - case 191: + case 192: bindPostfixUnaryExpressionFlow(node); break; - case 192: + case 193: bindBinaryExpressionFlow(node); break; - case 186: + case 187: bindDeleteExpressionFlow(node); break; - case 193: + case 194: bindConditionalExpressionFlow(node); break; - case 224: + case 225: bindVariableDeclarationFlow(node); break; - case 179: + case 180: bindCallExpressionFlow(node); break; default: @@ -18855,15 +18928,15 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 178: return isNarrowableReference(expr); - case 179: + case 180: return hasNarrowableArgument(expr); - case 183: + case 184: return isNarrowingExpression(expr.expression); - case 192: + case 193: return isNarrowingBinaryExpression(expr); - case 190: + case 191: return expr.operator === 50 && isNarrowingExpression(expr.operand); } return false; @@ -18871,7 +18944,7 @@ var ts; function isNarrowableReference(expr) { return expr.kind === 70 || expr.kind === 98 || - expr.kind === 177 && isNarrowableReference(expr.expression); + expr.kind === 178 && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -18882,14 +18955,14 @@ var ts; } } } - if (expr.expression.kind === 177 && + if (expr.expression.kind === 178 && isNarrowableReference(expr.expression.expression)) { return true; } return false; } function isNarrowingTypeofOperands(expr1, expr2) { - return expr1.kind === 187 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; + return expr1.kind === 188 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { @@ -18910,9 +18983,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 183: + case 184: return isNarrowableOperand(expr.expression); - case 192: + case 193: switch (expr.operatorToken.kind) { case 57: return isNarrowableOperand(expr.left); @@ -19006,33 +19079,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 209: - case 211: case 210: - return parent.expression === node; case 212: - case 193: + case 211: + return parent.expression === node; + case 213: + case 194: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 183) { + if (node.kind === 184) { node = node.expression; } - else if (node.kind === 190 && node.operator === 50) { + else if (node.kind === 191 && node.operator === 50) { node = node.operand; } else { - return node.kind === 192 && (node.operatorToken.kind === 52 || + return node.kind === 193 && (node.operatorToken.kind === 52 || node.operatorToken.kind === 53); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 183 || - node.parent.kind === 190 && + while (node.parent.kind === 184 || + node.parent.kind === 191 && node.parent.operator === 50) { node = node.parent; } @@ -19074,7 +19147,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 220 + var enclosingLabeledStatement = node.parent.kind === 221 ? ts.lastOrUndefined(activeLabels) : undefined; var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); @@ -19109,7 +19182,7 @@ var ts; bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 225) { + if (node.initializer.kind !== 226) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -19131,7 +19204,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 217) { + if (node.kind === 218) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -19151,7 +19224,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 216 ? breakTarget : continueTarget; + var flowLabel = node.kind === 217 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -19208,7 +19281,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 255; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 256; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -19273,13 +19346,13 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 210) { + if (!node.statement || node.statement.kind !== 211) { addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 192 && node.operatorToken.kind === 57) { + if (node.kind === 193 && node.operatorToken.kind === 57) { bindAssignmentTargetFlow(node.left); } else { @@ -19290,10 +19363,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 175) { + else if (node.kind === 176) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 196) { + if (e.kind === 197) { bindAssignmentTargetFlow(e.expression); } else { @@ -19301,16 +19374,16 @@ var ts; } } } - else if (node.kind === 176) { + else if (node.kind === 177) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 258) { + if (p.kind === 259) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 259) { + else if (p.kind === 260) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 260) { + else if (p.kind === 261) { bindAssignmentTargetFlow(p.expression); } } @@ -19366,7 +19439,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 57 && node.left.kind === 178) { + if (operator === 57 && node.left.kind === 179) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -19377,7 +19450,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { bindAssignmentTargetFlow(node.expression); } } @@ -19410,16 +19483,16 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 213 || node.parent.parent.kind === 214) { + if (node.initializer || node.parent.parent.kind === 214 || node.parent.parent.kind === 215) { bindInitializedVariableFlow(node); } } function bindCallExpressionFlow(node) { var expr = node.expression; - while (expr.kind === 183) { + while (expr.kind === 184) { expr = expr.expression; } - if (expr.kind === 184 || expr.kind === 185) { + if (expr.kind === 185 || expr.kind === 186) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -19427,7 +19500,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -19436,52 +19509,52 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 197: - case 227: - case 230: - case 176: - case 161: - case 288: - case 271: - return 1; + case 198: case 228: - return 1 | 64; - case 275: case 231: + case 177: + case 162: + case 289: + case 272: + return 1; case 229: - case 170: + return 1 | 64; + case 276: + case 232: + case 230: + case 171: return 1 | 32; - case 262: + case 263: return 1 | 4 | 32; - case 149: + case 150: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 | 4 | 32 | 8 | 128; } - case 150: - case 226: - case 148: case 151: + case 227: + case 149: case 152: case 153: case 154: case 155: - case 158: + case 156: case 159: + case 160: return 1 | 4 | 32 | 8; - case 184: case 185: + case 186: return 1 | 4 | 32 | 8 | 16; - case 232: + case 233: return 4; - case 147: + case 148: return node.initializer ? 4 : 0; - case 257: - case 212: + case 258: case 213: case 214: - case 233: + case 215: + case 234: return 2; - case 205: + case 206: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -19497,37 +19570,37 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 231: + case 232: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 262: + case 263: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 197: - case 227: + case 198: + case 228: return declareClassMember(node, symbolFlags, symbolExcludes); - case 230: + case 231: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 161: - case 176: - case 228: - case 271: - case 288: + case 162: + case 177: + case 229: + case 272: + case 289: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 158: case 159: - case 153: + case 160: case 154: case 155: - case 149: - case 148: + case 156: case 150: + case 149: case 151: case 152: - case 226: - case 184: + case 153: + case 227: case 185: - case 275: - case 229: - case 170: + case 186: + case 276: + case 230: + case 171: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -19542,11 +19615,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 262 ? node : node.body; - if (body && (body.kind === 262 || body.kind === 232)) { + var body = node.kind === 263 ? node : node.body; + if (body && (body.kind === 263 || body.kind === 233)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 242 || stat.kind === 241) { + if (stat.kind === 243 || stat.kind === 242) { return true; } } @@ -19568,7 +19641,7 @@ var ts; errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (ts.isExternalModuleAugmentation(node)) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); + declareModuleSymbol(node); } else { var pattern = void 0; @@ -19588,12 +19661,8 @@ var ts; } } else { - var state = getModuleInstanceState(node); - if (state === 0) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); - } - else { - declareSymbolAndAddToSymbolTable(node, 512, 106639); + var state = declareModuleSymbol(node); + if (state !== 0) { if (node.symbol.flags & (16 | 32 | 256)) { node.symbol.constEnumOnlyModule = false; } @@ -19609,29 +19678,35 @@ var ts; } } } + function declareModuleSymbol(node) { + var state = getModuleInstanceState(node); + var instantiated = state !== 0; + declareSymbolAndAddToSymbolTable(node, instantiated ? 512 : 1024, instantiated ? 106639 : 0); + return state; + } function bindFunctionOrConstructorType(node) { var symbol = createSymbol(131072, getDeclarationName(node)); addDeclarationToSymbol(symbol, node, 131072); var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048); typeLiteralSymbol.members = ts.createMap(); - typeLiteralSymbol.members[symbol.name] = symbol; + typeLiteralSymbol.members.set(symbol.name, symbol); } function bindObjectLiteralExpression(node) { if (inStrictMode) { var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 260 || prop.name.kind !== 70) { + if (prop.kind === 261 || prop.name.kind !== 70) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 258 || prop.kind === 259 || prop.kind === 149 + var currentKind = prop.kind === 259 || prop.kind === 260 || prop.kind === 150 ? 1 : 2; - var existingKind = seen[identifier.text]; + var existingKind = seen.get(identifier.text); if (!existingKind) { - seen[identifier.text] = currentKind; + seen.set(identifier.text, currentKind); continue; } if (currentKind === 1 && existingKind === 1) { @@ -19648,10 +19723,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 231: + case 232: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 262: + case 263: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -19741,8 +19816,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 262 && - blockScopeContainer.kind !== 231 && + if (blockScopeContainer.kind !== 263 && + blockScopeContainer.kind !== 232 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -19785,7 +19860,7 @@ var ts; node.parent = parent; var saveInStrictMode = inStrictMode; bindWorker(node); - if (node.kind > 140) { + if (node.kind > 141) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -19825,23 +19900,23 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 286) { + while (parentNode && parentNode.kind !== 287) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); break; } case 98: - if (currentFlow && (ts.isExpression(node) || parent.kind === 259)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 260)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 177: + case 178: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } break; - case 192: + case 193: if (ts.isInJavaScriptFile(node)) { var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { @@ -19864,48 +19939,48 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 257: + case 258: return checkStrictModeCatchClause(node); - case 186: + case 187: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 191: + case 192: return checkStrictModePostfixUnaryExpression(node); - case 190: + case 191: return checkStrictModePrefixUnaryExpression(node); - case 218: + case 219: return checkStrictModeWithStatement(node); - case 167: + case 168: seenThisKeyword = true; return; - case 156: + case 157: return checkTypePredicate(node); - case 143: - return declareSymbolAndAddToSymbolTable(node, 262144, 530920); case 144: + return declareSymbolAndAddToSymbolTable(node, 262144, 530920); + case 145: return bindParameter(node); - case 224: - case 174: + case 225: + case 175: return bindVariableDeclarationOrBindingElement(node); + case 148: case 147: - case 146: - case 272: + case 273: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 287: + case 288: return bindJSDocProperty(node); - case 258: case 259: + case 260: return bindPropertyOrMethodOrAccessor(node, 4, 0); - case 261: + case 262: return bindPropertyOrMethodOrAccessor(node, 8, 900095); - case 260: - case 252: + case 261: + case 253: var root = container; var hasRest = false; while (root.parent) { - if (root.kind === 176 && - root.parent.kind === 192 && + if (root.kind === 177 && + root.parent.kind === 193 && root.parent.operatorToken.kind === 57 && root.parent.left === root) { hasRest = true; @@ -19914,78 +19989,78 @@ var ts; root = root.parent; } return; - case 153: case 154: case 155: + case 156: return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 150: case 149: - case 148: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); - case 226: + case 227: return bindFunctionDeclaration(node); - case 150: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 151: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 152: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 153: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 158: case 159: - case 275: + case 160: + case 276: return bindFunctionOrConstructorType(node); - case 161: - case 170: - case 288: - case 271: + case 162: + case 171: + case 289: + case 272: return bindAnonymousDeclaration(node, 2048, "__type"); - case 176: + case 177: return bindObjectLiteralExpression(node); - case 184: case 185: + case 186: return bindFunctionExpression(node); - case 179: + case 180: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 197: - case 227: + case 198: + case 228: inStrictMode = true; return bindClassLikeDeclaration(node); - case 228: + case 229: return bindBlockScopedDeclaration(node, 64, 792968); - case 286: + case 287: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } break; - case 229: - return bindBlockScopedDeclaration(node, 524288, 793064); case 230: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 524288, 793064); case 231: + return bindEnumDeclaration(node); + case 232: return bindModuleDeclaration(node); - case 235: - case 238: - case 240: - case 244: + case 236: + case 239: + case 241: + case 245: return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 234: + case 235: return bindNamespaceExportDeclaration(node); - case 237: + case 238: return bindImportClause(node); - case 242: + case 243: return bindExportDeclaration(node); - case 241: + case 242: return bindExportAssignment(node); - case 262: + case 263: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 205: + case 206: if (!ts.isFunctionLike(node.parent)) { return; } - case 232: + case 233: return updateStrictModeStatementList(node.statements); } } @@ -19994,7 +20069,7 @@ var ts; if (parameterName && parameterName.kind === 70) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 167) { + if (parameterName && parameterName.kind === 168) { seenThisKeyword = true; } bind(type); @@ -20013,7 +20088,7 @@ var ts; bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } else { - var flags = node.kind === 241 && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 242 && ts.exportAssignmentIsAlias(node) ? 8388608 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16); @@ -20023,17 +20098,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 262) { + if (node.parent.kind !== 263) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_5 = node.parent; - if (!ts.isExternalModule(parent_5)) { + var parent_1 = node.parent; + if (!ts.isExternalModule(parent_1)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_5.isDeclarationFile) { + if (!parent_1.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -20072,11 +20147,11 @@ var ts; } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); - if (container.kind === 226 || container.kind === 184) { + if (container.kind === 227 || container.kind === 185) { container.symbol.members = container.symbol.members || ts.createMap(); declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); } - else if (container.kind === 150) { + else if (container.kind === 151) { var saveContainer = container; container = container.parent; var symbol = bindPropertyOrMethodOrAccessor(node, 4, 0); @@ -20093,7 +20168,7 @@ var ts; leftSideOfAssignment.parent = node; constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - var funcSymbol = container.locals[constructorFunction.text]; + var funcSymbol = container.locals.get(constructorFunction.text); if (!funcSymbol || !(funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) { return; } @@ -20108,25 +20183,26 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 227) { + if (node.kind === 228) { bindBlockScopedDeclaration(node, 32, 899519); } else { var bindingName = node.name ? node.name.text : "__class"; bindAnonymousDeclaration(node, 32, bindingName); if (node.name) { - classifiableNames[node.name.text] = node.name.text; + classifiableNames.set(node.name.text, node.name.text); } } var symbol = node.symbol; var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); - if (symbol.exports[prototypeSymbol.name]) { + var symbolExport = symbol.exports.get(prototypeSymbol.name); + if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; + symbol.exports.set(prototypeSymbol.name, prototypeSymbol); prototypeSymbol.parent = symbol; } function bindEnumDeclaration(node) { @@ -20218,15 +20294,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 207) || - node.kind === 227 || - (node.kind === 231 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 230 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 208) || + node.kind === 228 || + (node.kind === 232 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 231 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 206 || + (node.kind !== 207 || ts.getCombinedNodeFlags(node.declarationList) & 3 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -20240,56 +20316,56 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 179: - return computeCallExpression(node, subtreeFlags); case 180: + return computeCallExpression(node, subtreeFlags); + case 181: return computeNewExpression(node, subtreeFlags); - case 231: + case 232: return computeModuleDeclaration(node, subtreeFlags); - case 183: + case 184: return computeParenthesizedExpression(node, subtreeFlags); - case 192: + case 193: return computeBinaryExpression(node, subtreeFlags); - case 208: + case 209: return computeExpressionStatement(node, subtreeFlags); - case 144: + case 145: return computeParameter(node, subtreeFlags); - case 185: + case 186: return computeArrowFunction(node, subtreeFlags); - case 184: + case 185: return computeFunctionExpression(node, subtreeFlags); - case 226: + case 227: return computeFunctionDeclaration(node, subtreeFlags); - case 224: - return computeVariableDeclaration(node, subtreeFlags); case 225: + return computeVariableDeclaration(node, subtreeFlags); + case 226: return computeVariableDeclarationList(node, subtreeFlags); - case 206: + case 207: return computeVariableStatement(node, subtreeFlags); - case 220: + case 221: return computeLabeledStatement(node, subtreeFlags); - case 227: + case 228: return computeClassDeclaration(node, subtreeFlags); - case 197: + case 198: return computeClassExpression(node, subtreeFlags); - case 256: - return computeHeritageClause(node, subtreeFlags); case 257: + return computeHeritageClause(node, subtreeFlags); + case 258: return computeCatchClause(node, subtreeFlags); - case 199: + case 200: return computeExpressionWithTypeArguments(node, subtreeFlags); - case 150: + case 151: return computeConstructor(node, subtreeFlags); - case 147: + case 148: return computePropertyDeclaration(node, subtreeFlags); - case 149: + case 150: return computeMethod(node, subtreeFlags); - case 151: case 152: + case 153: return computeAccessor(node, subtreeFlags); - case 235: + case 236: return computeImportEquals(node, subtreeFlags); - case 177: + case 178: return computePropertyAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -20314,8 +20390,8 @@ var ts; switch (kind) { case 96: return true; - case 177: case 178: + case 179: var expression = node.expression; var expressionKind = expression.kind; return expressionKind === 96; @@ -20337,10 +20413,10 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 57 && leftKind === 176) { + if (operatorTokenKind === 57 && leftKind === 177) { transformFlags |= 8 | 192 | 3072; } - else if (operatorTokenKind === 57 && leftKind === 175) { + else if (operatorTokenKind === 57 && leftKind === 176) { transformFlags |= 192 | 3072; } else if (operatorTokenKind === 39 @@ -20379,8 +20455,8 @@ var ts; var expression = node.expression; var expressionKind = expression.kind; var expressionTransformFlags = expression.transformFlags; - if (expressionKind === 200 - || expressionKind === 182) { + if (expressionKind === 201 + || expressionKind === 183) { transformFlags |= 3; } if (expressionTransformFlags & 1024) { @@ -20666,7 +20742,7 @@ var ts; var excludeFlags = 536872257; switch (kind) { case 119: - case 189: + case 190: transformFlags |= 16; break; case 113: @@ -20675,51 +20751,51 @@ var ts; case 116: case 123: case 75: - case 230: - case 261: - case 182: - case 200: + case 231: + case 262: + case 183: case 201: + case 202: case 130: transformFlags |= 3; break; - case 247: case 248: case 249: - case 10: case 250: + case 10: case 251: case 252: case 253: + case 254: transformFlags |= 4; break; - case 214: + case 215: transformFlags |= 8; case 12: case 13: case 14: case 15: - case 194: - case 181: - case 259: + case 195: + case 182: + case 260: case 114: - case 202: + case 203: transformFlags |= 192; break; - case 195: + case 196: transformFlags |= 192 | 16777216; break; case 118: case 132: case 129: - case 134: - case 121: + case 133: case 135: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: case 156: @@ -20733,26 +20809,27 @@ var ts; case 164: case 165: case 166: - case 228: - case 229: case 167: + case 229: + case 230: case 168: case 169: case 170: case 171: + case 172: transformFlags = 3; excludeFlags = -3; break; - case 142: + case 143: transformFlags |= 2097152; if (subtreeFlags & 16384) { transformFlags |= 65536; } break; - case 196: + case 197: transformFlags |= 192 | 524288; break; - case 260: + case 261: transformFlags |= 8 | 1048576; break; case 96: @@ -20761,27 +20838,27 @@ var ts; case 98: transformFlags |= 16384; break; - case 172: + case 173: transformFlags |= 192 | 8388608; if (subtreeFlags & 524288) { transformFlags |= 8 | 1048576; } excludeFlags = 537396545; break; - case 173: + case 174: transformFlags |= 192 | 8388608; excludeFlags = 537396545; break; - case 174: + case 175: transformFlags |= 192; if (node.dotDotDotToken) { transformFlags |= 524288; } break; - case 145: + case 146: transformFlags |= 3 | 4096; break; - case 176: + case 177: excludeFlags = 540087617; if (subtreeFlags & 2097152) { transformFlags |= 192; @@ -20793,29 +20870,29 @@ var ts; transformFlags |= 8; } break; - case 175: - case 180: + case 176: + case 181: excludeFlags = 537396545; if (subtreeFlags & 524288) { transformFlags |= 192; } break; - case 210: case 211: case 212: case 213: + case 214: if (subtreeFlags & 4194304) { transformFlags |= 192; } break; - case 262: + case 263: if (subtreeFlags & 32768) { transformFlags |= 192; } break; - case 217: - case 215: + case 218: case 216: + case 217: transformFlags |= 33554432; break; } @@ -20823,56 +20900,57 @@ var ts; return transformFlags & ~excludeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 156 && kind <= 171) { + if (kind >= 157 && kind <= 172) { return -3; } switch (kind) { - case 179: case 180: - case 175: + case 181: + case 176: return 537396545; - case 231: + case 232: return 574674241; - case 144: + case 145: return 536872257; - case 185: + case 186: return 601249089; - case 184: - case 226: + case 185: + case 227: return 601281857; - case 225: + case 226: return 546309441; - case 227: - case 197: + case 228: + case 198: return 539358529; - case 150: - return 601015617; - case 149: case 151: + return 601015617; + case 150: case 152: + case 153: return 601015617; case 118: case 132: case 129: - case 134: - case 121: case 135: + case 133: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: - case 228: + case 156: case 229: + case 230: return -3; - case 176: + case 177: return 540087617; - case 257: + case 258: return 537920833; - case 172: case 173: + case 174: return 537396545; default: return 536872257; @@ -20944,6 +21022,7 @@ var ts; getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, getTypeFromTypeNode: getTypeFromTypeNode, + getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, @@ -20968,6 +21047,7 @@ var ts; getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule, getAmbientModules: getAmbientModules, getJsxElementAttributesType: getJsxElementAttributesType, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, @@ -21003,6 +21083,7 @@ var ts; var voidType = createIntrinsicType(1024, "void"); var neverType = createIntrinsicType(8192, "never"); var silentNeverType = createIntrinsicType(8192, "never"); + var nonPrimitiveType = createIntrinsicType(16777216, "object"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); @@ -21012,6 +21093,7 @@ var ts; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); @@ -21073,7 +21155,7 @@ var ts; var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); - var typeofEQFacts = ts.createMap({ + var typeofEQFacts = ts.createMapFromTemplate({ "string": 1, "number": 2, "boolean": 4, @@ -21082,7 +21164,7 @@ var ts; "object": 16, "function": 32 }); - var typeofNEFacts = ts.createMap({ + var typeofNEFacts = ts.createMapFromTemplate({ "string": 128, "number": 256, "boolean": 512, @@ -21091,7 +21173,7 @@ var ts; "object": 2048, "function": 4096 }); - var typeofTypesByName = ts.createMap({ + var typeofTypesByName = ts.createMapFromTemplate({ "string": stringType, "number": numberType, "boolean": booleanType, @@ -21118,7 +21200,7 @@ var ts; var enumRelation = ts.createMap(); var _displayBuilder; var builtinGlobals = ts.createMap(); - builtinGlobals[undefinedSymbol.name] = undefinedSymbol; + builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); initializeTypeChecker(); return checker; function getJsxNamespace() { @@ -21216,7 +21298,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 231 && source.valueDeclaration.kind !== 231))) { + (target.valueDeclaration.kind === 232 && source.valueDeclaration.kind !== 232))) { target.valueDeclaration = source.valueDeclaration; } ts.addRange(target.declarations, source.declarations); @@ -21232,6 +21314,9 @@ var ts; } recordMergedSymbol(target, source); } + else if (target.flags & 1024) { + error(source.valueDeclaration.name, ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } else { var message_2 = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; @@ -21244,18 +21329,19 @@ var ts; } } function mergeSymbolTable(target, source) { - for (var id in source) { - var targetSymbol = target[id]; + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); if (!targetSymbol) { - target[id] = source[id]; + target.set(id, sourceSymbol); } else { if (!(targetSymbol.flags & 33554432)) { - target[id] = targetSymbol = cloneSymbol(targetSymbol); + targetSymbol = cloneSymbol(targetSymbol); + target.set(id, targetSymbol); } - mergeSymbol(targetSymbol, source[id]); + mergeSymbol(targetSymbol, sourceSymbol); } - } + }); } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; @@ -21285,14 +21371,15 @@ var ts; } } function addToSymbolTable(target, source, message) { - for (var id in source) { - if (target[id]) { - ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); + if (targetSymbol) { + ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); } else { - target[id] = source[id]; + target.set(id, sourceSymbol); } - } + }); function addDeclarationDiagnostic(id, message) { return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; } @@ -21311,11 +21398,11 @@ var ts; return type.flags & 32768 ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 262 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 263 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { - var symbol = symbols[name]; + var symbol = symbols.get(name); if (symbol) { ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { @@ -21355,15 +21442,15 @@ var ts; return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - if (declaration.kind === 174) { - var errorBindingElement = ts.getAncestor(usage, 174); + if (declaration.kind === 175) { + var errorBindingElement = ts.getAncestor(usage, 175); if (errorBindingElement) { return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || declaration.pos < errorBindingElement.pos; } - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 224), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 225), usage); } - else if (declaration.kind === 224) { + else if (declaration.kind === 225) { return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } return true; @@ -21373,17 +21460,17 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 206: - case 212: - case 214: + case 207: + case 213: + case 215: if (isSameScopeDescendentOf(usage, declaration, container)) { return true; } break; } switch (declaration.parent.parent.kind) { - case 213: case 214: + case 215: if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; } @@ -21400,7 +21487,7 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 147 && + current.parent.kind === 148 && (ts.getModifierFlags(current.parent) & 32) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { @@ -21432,18 +21519,18 @@ var ts; if (result = getSymbol(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 279) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 280) { useResult = result.flags & 262144 ? lastLocation === location.type || - lastLocation.kind === 144 || - lastLocation.kind === 143 + lastLocation.kind === 145 || + lastLocation.kind === 144 : false; } if (meaning & 107455 && result.flags & 1) { useResult = - lastLocation.kind === 144 || + lastLocation.kind === 145 || (lastLocation === location.type && - result.valueDeclaration.kind === 144); + result.valueDeclaration.kind === 145); } } if (useResult) { @@ -21455,23 +21542,24 @@ var ts; } } switch (location.kind) { - case 262: + case 263: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 231: + case 232: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 262 || ts.isAmbientModule(location)) { - if (result = moduleExports["default"]) { + if (location.kind === 263 || ts.isAmbientModule(location)) { + if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; } - if (moduleExports[name] && - moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 244)) { + var moduleExport = moduleExports.get(name); + if (moduleExport && + moduleExport.flags === 8388608 && + ts.getDeclarationOfKind(moduleExport, 245)) { break; } } @@ -21479,13 +21567,13 @@ var ts; break loop; } break; - case 230: + case 231: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 148: case 147: - case 146: if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -21495,9 +21583,9 @@ var ts; } } break; - case 227: - case 197: case 228: + case 198: + case 229: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) { if (lastLocation && ts.getModifierFlags(lastLocation) & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -21505,7 +21593,7 @@ var ts; } break loop; } - if (location.kind === 197 && meaning & 32) { + if (location.kind === 198 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -21513,28 +21601,28 @@ var ts; } } break; - case 142: + case 143: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 228) { + if (ts.isClassLike(grandparent) || grandparent.kind === 229) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 226: - case 185: + case 153: + case 227: + case 186: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 184: + case 185: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -21547,8 +21635,8 @@ var ts; } } break; - case 145: - if (location.parent && location.parent.kind === 144) { + case 146: + if (location.parent && location.parent.kind === 145) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -21591,7 +21679,7 @@ var ts; } if (result && isInExternalModule && (meaning & 107455) === 107455) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 234) { + if (decls && decls.length === 1 && decls[0].kind === 235) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } @@ -21638,9 +21726,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 70: - case 177: + case 178: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 199: + case 200: ts.Debug.assert(ts.isEntityNameExpression(node.expression)); return node.expression; default: @@ -21688,10 +21776,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 235) { + if (node.kind === 236) { return node; } - while (node && node.kind !== 236) { + while (node && node.kind !== 237) { node = node.parent; } return node; @@ -21701,7 +21789,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 246) { + if (node.moduleReference.kind === 247) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); @@ -21709,11 +21797,16 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ? - moduleSymbol : - moduleSymbol.exports["export="] ? - getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : - resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = void 0; + if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } + else { + var exportValue = moduleSymbol.exports.get("export="); + exportDefaultSymbol = exportValue + ? getPropertyOfType(getTypeOfSymbol(exportValue), "default") + : resolveSymbol(moduleSymbol.exports.get("default")); + } if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } @@ -21744,7 +21837,7 @@ var ts; } function getExportOfModule(symbol, name) { if (symbol.flags & 1536) { - var exportedSymbol = getExportsOfSymbol(symbol)[name]; + var exportedSymbol = getExportsOfSymbol(symbol).get(name); if (exportedSymbol) { return resolveSymbol(exportedSymbol); } @@ -21762,28 +21855,28 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_17 = specifier.propertyName || specifier.name; - if (name_17.text) { + var name = specifier.propertyName || specifier.name; + if (name.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; - if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_17.text); + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_17.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); } symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_17.text); - if (!symbolFromModule && allowSyntheticDefaultImports && name_17.text === "default") { + var symbolFromModule = getExportOfModule(targetSymbol, name.text); + if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_17, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_17)); + error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); } return symbol; } @@ -21805,19 +21898,19 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 235: + case 236: return getTargetOfImportEqualsDeclaration(node); - case 237: - return getTargetOfImportClause(node); case 238: + return getTargetOfImportClause(node); + case 239: return getTargetOfNamespaceImport(node); - case 240: + case 241: return getTargetOfImportSpecifier(node); - case 244: + case 245: return getTargetOfExportSpecifier(node); - case 241: + case 242: return getTargetOfExportAssignment(node); - case 234: + case 235: return getTargetOfNamespaceExportDeclaration(node); } } @@ -21861,10 +21954,10 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 241) { + if (node.kind === 242) { checkExpressionCached(node.expression); } - else if (node.kind === 244) { + else if (node.kind === 245) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -21876,11 +21969,11 @@ var ts; if (entityName.kind === 70 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 70 || entityName.parent.kind === 141) { + if (entityName.kind === 70 || entityName.parent.kind === 142) { return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 235); + ts.Debug.assert(entityName.parent.kind === 236); return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias); } } @@ -21899,9 +21992,9 @@ var ts; return undefined; } } - else if (name.kind === 141 || name.kind === 177) { - var left = name.kind === 141 ? name.left : name.expression; - var right = name.kind === 141 ? name.right : name.name; + else if (name.kind === 142 || name.kind === 178) { + var left = name.kind === 142 ? name.left : name.expression; + var right = name.kind === 142 ? name.right : name.name; var namespace = resolveEntityName(left, 1920, ignoreErrors, false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -21991,7 +22084,7 @@ var ts; return undefined; } function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="))) || moduleSymbol; } function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { var symbol = resolveExternalModuleSymbol(moduleSymbol); @@ -22002,15 +22095,23 @@ var ts; return symbol; } function hasExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="] !== undefined; + return moduleSymbol.exports.get("export=") !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function getExportsAndPropertiesOfModule(moduleSymbol) { + var exports = getExportsOfModuleAsArray(moduleSymbol); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + ts.addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))); + } + return exports; + } function tryGetMemberInModuleExports(memberName, moduleSymbol) { var symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { - return symbolTable[memberName]; + return symbolTable.get(memberName); } } function getExportsOfSymbol(symbol) { @@ -22021,24 +22122,28 @@ var ts; return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } function extendExportSymbols(target, source, lookupTable, exportNode) { - for (var id in source) { - if (id !== "default" && !target[id]) { - target[id] = source[id]; + source && source.forEach(function (sourceSymbol, id) { + if (id === "default") + return; + var targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); if (lookupTable && exportNode) { - lookupTable[id] = { + lookupTable.set(id, { specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) - }; + }); } } - else if (lookupTable && exportNode && id !== "default" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { - if (!lookupTable[id].exportsWithDuplicate) { - lookupTable[id].exportsWithDuplicate = [exportNode]; + else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + var collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; } else { - lookupTable[id].exportsWithDuplicate.push(exportNode); + collisionTracker.exportsWithDuplicate.push(exportNode); } } - } + }); } function getExportsForModule(moduleSymbol) { var visitedSymbols = []; @@ -22050,26 +22155,26 @@ var ts; } visitedSymbols.push(symbol); var symbols = ts.cloneMap(symbol.exports); - var exportStars = symbol.exports["__export"]; + var exportStars = symbol.exports.get("__export"); if (exportStars) { var nestedSymbols = ts.createMap(); - var lookupTable = ts.createMap(); + var lookupTable_1 = ts.createMap(); for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); var exportedSymbols = visit(resolvedModule); - extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node); } - for (var id in lookupTable) { - var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; - if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) { - continue; + lookupTable_1.forEach(function (_a, id) { + var exportsWithDuplicate = _a.exportsWithDuplicate; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; } - for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { - var node = exportsWithDuplicate_1[_b]; - diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { + var node = exportsWithDuplicate_1[_i]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, id)); } - } + }); extendExportSymbols(symbols, nestedSymbols); } return symbols; @@ -22106,7 +22211,7 @@ var ts; var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 150 && ts.nodeIsPresent(member.body)) { + if (member.kind === 151 && ts.nodeIsPresent(member.body)) { return member; } } @@ -22142,16 +22247,15 @@ var ts; } function getNamedMembers(members) { var result; - for (var id in members) { + members.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { if (!result) result = []; - var symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } } - } + }); return result || emptyArray; } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { @@ -22170,19 +22274,19 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { - if (location_1.locals && !isGlobalSourceFile(location_1)) { - if (result = callback(location_1.locals)) { + for (var location = enclosingDeclaration; location; location = location.parent) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { return result; } } - switch (location_1.kind) { - case 262: - if (!ts.isExternalOrCommonJsModule(location_1)) { + switch (location.kind) { + case 263: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 231: - if (result = callback(getSymbolOfNode(location_1).exports)) { + case 232: + if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; @@ -22219,13 +22323,13 @@ var ts; } } function trySymbolTable(symbols) { - if (isAccessible(symbols[symbol.name])) { + if (isAccessible(symbols.get(symbol.name))) { return [symbol]; } - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { + return ts.forEachEntry(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -22250,14 +22354,14 @@ var ts; function needsQualification(symbol, enclosingDeclaration, meaning) { var qualify = false; forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { - var symbolFromSymbolTable = symbolTable[symbol.name]; + var symbolFromSymbolTable = symbolTable.get(symbol.name); if (!symbolFromSymbolTable) { return false; } if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -22271,10 +22375,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 147: - case 149: - case 151: + case 148: + case 150: case 152: + case 153: continue; default: return false; @@ -22330,7 +22434,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 262 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 263 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -22364,11 +22468,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 160 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === 161 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning = 107455 | 1048576; } - else if (entityName.kind === 141 || entityName.kind === 177 || - entityName.parent.kind === 235) { + else if (entityName.kind === 142 || entityName.kind === 178 || + entityName.parent.kind === 236) { meaning = 1920; } else { @@ -22460,10 +22564,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 166) { + while (node.kind === 167) { node = node.parent; } - if (node.kind === 229) { + if (node.kind === 230) { return getSymbolOfNode(node); } } @@ -22471,29 +22575,29 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 232 && + node.parent.kind === 233 && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { return type.flags & 32 ? "\"" + ts.escapeString(type.text) + "\"" : type.text; } - function getSymbolDisplayBuilder() { - function getNameOfSymbol(symbol) { - if (symbol.declarations && symbol.declarations.length) { - var declaration = symbol.declarations[0]; - if (declaration.name) { - return ts.declarationNameToString(declaration.name); - } - switch (declaration.kind) { - case 197: - return "(Anonymous class)"; - case 184: - case 185: - return "(Anonymous function)"; - } + function getNameOfSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + switch (declaration.kind) { + case 198: + return "(Anonymous class)"; + case 185: + case 186: + return "(Anonymous function)"; } - return symbol.name; } + return symbol.name; + } + function getSymbolDisplayBuilder() { function appendSymbolNameOnly(symbol, writer) { writer.writeSymbol(getNameOfSymbol(symbol), symbol); } @@ -22540,9 +22644,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_6) { - walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false); + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + walkSymbol(parent, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -22572,7 +22676,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { var nextFlags = flags & ~512; - if (type.flags & 16015) { + if (type.flags & 16793231) { writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type) ? "any" : type.intrinsicName); @@ -22675,12 +22779,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); + writeSymbolTypeReference(parent, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -22706,7 +22810,8 @@ var ts; function writeAnonymousType(type, flags) { var symbol = type.symbol; if (symbol) { - if (symbol.flags & (32 | 384 | 512)) { + if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 | 512)) { writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -22739,7 +22844,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 262 || declaration.parent.kind === 232; + return declaration.parent.kind === 263 || declaration.parent.kind === 233; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -22921,12 +23026,12 @@ var ts; buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { writePunctuation(writer, 16); buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 17); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { writePunctuation(writer, 20); var elements = bindingPattern.elements; buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); @@ -22940,7 +23045,7 @@ var ts; if (ts.isOmittedExpression(bindingElement)) { return; } - ts.Debug.assert(bindingElement.kind === 174); + ts.Debug.assert(bindingElement.kind === 175); if (bindingElement.propertyName) { writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55); @@ -23062,7 +23167,7 @@ var ts; writeKeyword(writer, 132); break; case 0: - writeKeyword(writer, 134); + writeKeyword(writer, 135); break; } writePunctuation(writer, 21); @@ -23098,63 +23203,63 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174: + case 175: return isDeclarationVisible(node.parent.parent); - case 224: + case 225: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 231: - case 227: + case 232: case 228: case 229: - case 226: case 230: - case 235: + case 227: + case 231: + case 236: if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_8 = getDeclarationContainer(node); + var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 235 && parent_8.kind !== 262 && ts.isInAmbientContext(parent_8))) { - return isGlobalSourceFile(parent_8); + !(node.kind !== 236 && parent.kind !== 263 && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent); } - return isDeclarationVisible(parent_8); + return isDeclarationVisible(parent); + case 148: case 147: - case 146: - case 151: case 152: + case 153: + case 150: case 149: - case 148: if (ts.getModifierFlags(node) & (8 | 16)) { return false; } - case 150: - case 154: - case 153: + case 151: case 155: - case 144: - case 232: - case 158: + case 154: + case 156: + case 145: + case 233: case 159: - case 161: - case 157: + case 160: case 162: + case 158: case 163: case 164: case 165: case 166: + case 167: return isDeclarationVisible(node.parent); - case 237: case 238: - case 240: + case 239: + case 241: return false; - case 143: - case 262: - case 234: + case 144: + case 263: + case 235: return true; - case 241: + case 242: return false; default: return false; @@ -23163,10 +23268,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 241) { + if (node.parent && node.parent.kind === 242) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 244) { + else if (node.parent.kind === 245) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -23244,12 +23349,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 224: case 225: + case 226: + case 241: case 240: case 239: case 238: - case 237: node = node.parent; break; default: @@ -23273,7 +23378,7 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); } function isComputedNonLiteralName(name) { - return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression); + return name.kind === 143 && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { source = filterType(source, function (t) { return !(t.flags & 6144); }); @@ -23286,17 +23391,16 @@ var ts; var members = ts.createMap(); var names = ts.createMap(); for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_18 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_18)] = true; + var name = properties_2[_i]; + names.set(ts.getTextOfPropertyName(name), true); } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; - var inNamesToRemove = prop.name in names; + var inNamesToRemove = names.has(prop.name); var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16); - var isMethod = prop.flags & 8192; var isSetOnlyAccessor = prop.flags & 65536 && !(prop.flags & 32768); - if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { - members[prop.name] = prop; + if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { + members.set(prop.name, prop); } } var stringIndexInfo = getIndexInfoOfType(source, 0); @@ -23316,7 +23420,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 172) { + if (pattern.kind === 173) { if (declaration.dotDotDotToken) { if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); @@ -23332,19 +23436,19 @@ var ts; type = getRestType(parentType, literalMembers, declaration.symbol); } else { - var name_19 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_19)) { + var name = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name)) { return anyType; } if (declaration.initializer) { getContextualType(declaration.initializer); } - var text = ts.getTextOfPropertyName(name_19); + var text = ts.getTextOfPropertyName(name); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name_19, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_19)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } @@ -23390,7 +23494,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 175 && expr.elements.length === 0; + return expr.kind === 176 && expr.elements.length === 0; } function addOptionality(type, optional) { return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type; @@ -23402,11 +23506,11 @@ var ts; return type; } } - if (declaration.parent.parent.kind === 213) { + if (declaration.parent.parent.kind === 214) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 | 262144) ? indexType : stringType; } - if (declaration.parent.parent.kind === 214) { + if (declaration.parent.parent.kind === 215) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -23416,7 +23520,7 @@ var ts; return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); } if ((compilerOptions.noImplicitAny || declaration.flags & 65536) && - declaration.kind === 224 && !ts.isBindingPattern(declaration.name) && + declaration.kind === 225 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -23425,10 +23529,10 @@ var ts; return autoArrayType; } } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var func = declaration.parent; - if (func.kind === 152 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151); + if (func.kind === 153 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 152); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -23454,7 +23558,7 @@ var ts; var type = checkDeclarationInitializer(declaration); return addOptionality(type, declaration.questionToken && includeOptionality); } - if (declaration.kind === 259) { + if (declaration.kind === 260) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -23493,7 +23597,7 @@ var ts; var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members[symbol.name] = symbol; + members.set(symbol.name, symbol); }); var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { @@ -23519,7 +23623,7 @@ var ts; return result; } function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 172 + return pattern.kind === 173 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -23529,7 +23633,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 258) { + if (declaration.kind === 259) { return type; } return getWidenedType(type); @@ -23544,7 +23648,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 144 ? root.parent : root; + var memberDeclaration = root.kind === 145 ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol) { @@ -23557,25 +23661,25 @@ var ts; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } - if (declaration.kind === 241) { + if (declaration.kind === 242) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 65536 && declaration.kind === 287 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 288 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { return unknownType; } var type = void 0; - if (declaration.kind === 192 || - declaration.kind === 177 && declaration.parent.kind === 192) { + if (declaration.kind === 193 || + declaration.kind === 178 && declaration.parent.kind === 193) { if (declaration.flags & 65536) { var jsdocType = ts.getJSDocType(declaration.parent); if (jsdocType) { return links.type = getTypeFromTypeNode(jsdocType); } } - var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ? + var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 193 ? checkExpressionCached(decl.right) : checkExpressionCached(decl.parent.right); }); type = getUnionType(declaredTypes, true); @@ -23592,7 +23696,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 151) { + if (accessor.kind === 152) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -23612,8 +23716,8 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - var getter = ts.getDeclarationOfKind(symbol, 151); - var setter = ts.getDeclarationOfKind(symbol, 152); + var getter = ts.getDeclarationOfKind(symbol, 152); + var setter = ts.getDeclarationOfKind(symbol, 153); if (getter && getter.flags & 65536) { var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); if (jsDocType) { @@ -23654,7 +23758,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 151); + var getter_1 = ts.getDeclarationOfKind(symbol, 152); 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)); } } @@ -23662,6 +23766,10 @@ var ts; } return links.type; } + function getBaseTypeVariableOfClass(symbol) { + var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); + return baseConstructorType.flags & 540672 ? baseConstructorType : undefined; + } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -23670,8 +23778,13 @@ var ts; } else { var type = createObjectType(16, symbol); - links.type = strictNullChecks && symbol.flags & 536870912 ? - includeFalsyTypes(type, 2048) : type; + if (symbol.flags & 32) { + var baseTypeVariable = getBaseTypeVariableOfClass(symbol); + links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; + } + else { + links.type = strictNullChecks && symbol.flags & 536870912 ? includeFalsyTypes(type, 2048) : type; + } } } return links.type; @@ -23744,8 +23857,13 @@ var ts; function hasBaseType(type, checkBase) { return check(type); function check(type) { - var target = getTargetType(type); - return target === checkBase || ts.forEach(getBaseTypes(target), check); + if (getObjectFlags(type) & (3 | 4)) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(getBaseTypes(target), check); + } + else if (type.flags & 131072) { + return ts.forEach(type.types, check); + } } } function appendTypeParameters(typeParameters, declarations) { @@ -23767,9 +23885,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 227 || node.kind === 197 || - node.kind === 226 || node.kind === 184 || - node.kind === 149 || node.kind === 185) { + if (node.kind === 228 || node.kind === 198 || + node.kind === 227 || node.kind === 185 || + node.kind === 150 || node.kind === 186) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -23778,15 +23896,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 228); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 229); 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 === 228 || node.kind === 227 || - node.kind === 197 || node.kind === 229) { + if (node.kind === 229 || node.kind === 228 || + node.kind === 198 || node.kind === 230) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -23798,8 +23916,23 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); } + function isMixinConstructorType(type) { + var signatures = getSignaturesOfType(type, 1); + if (signatures.length === 1) { + var s = signatures[0]; + return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType; + } + return false; + } function isConstructorType(type) { - return type.flags & 32768 && getSignaturesOfType(type, 1).length > 0; + if (isValidBaseType(type) && getSignaturesOfType(type, 1).length > 0) { + return true; + } + if (type.flags & 540672) { + var constraint = getBaseConstraintOfType(type); + return isValidBaseType(constraint) && isMixinConstructorType(constraint); + } + return false; } function getBaseTypeNodeOfClass(type) { return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); @@ -23826,7 +23959,7 @@ var ts; return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072)) { resolveStructuredTypeMembers(baseConstructorType); } if (!popTypeResolution()) { @@ -23862,8 +23995,8 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseConstructorType = getBaseConstructorTypeOfClass(type); - if (!(baseConstructorType.flags & 32768)) { + var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); + if (!(baseConstructorType.flags & (32768 | 131072))) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -23891,7 +24024,7 @@ var ts; if (baseType === unknownType) { return; } - if (!(getObjectFlags(getTargetType(baseType)) & 3)) { + if (!isValidBaseType(baseType)) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); return; } @@ -23915,16 +24048,20 @@ var ts; } return true; } + function isValidBaseType(type) { + return type.flags & 32768 && !isGenericMappedType(type) || + type.flags & 131072 && !ts.forEach(type.types, function (t) { return !isValidBaseType(t); }); + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 228 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 229 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { - if (getObjectFlags(getTargetType(baseType)) & 3) { + if (isValidBaseType(baseType)) { if (type !== baseType && !hasBaseType(baseType, type)) { if (type.resolvedBaseTypes === emptyArray) { type.resolvedBaseTypes = [baseType]; @@ -23948,7 +24085,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 228) { + if (declaration.kind === 229) { if (declaration.flags & 64) { return false; } @@ -23981,7 +24118,7 @@ var ts; type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -23998,7 +24135,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 286); + var declaration = ts.getDeclarationOfKind(symbol, 287); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -24009,7 +24146,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 229); + declaration = ts.getDeclarationOfKind(symbol, 230); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -24017,7 +24154,7 @@ var ts; if (typeParameters) { links.typeParameters = typeParameters; links.instantiations = ts.createMap(); - links.instantiations[getTypeListId(typeParameters)] = type; + links.instantiations.set(getTypeListId(typeParameters), type); } } else { @@ -24034,14 +24171,14 @@ var ts; return !ts.isInAmbientContext(member); } return expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8 || - expr.kind === 70 && !!symbol.exports[expr.text]; + expr.kind === 70 && !!symbol.exports.get(expr.text); } function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 230) { + if (declaration.kind === 231) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -24066,10 +24203,10 @@ var ts; enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { var memberTypeList = []; - var memberTypes = ts.createMap(); + var memberTypes = []; for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 230) { + if (declaration.kind === 231) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -24086,7 +24223,7 @@ var ts; if (memberTypeList.length > 1) { enumType.flags |= 65536; enumType.types = memberTypeList; - unionTypes[getTypeListId(memberTypeList)] = enumType; + unionTypes.set(getTypeListId(memberTypeList), enumType); } } } @@ -24107,9 +24244,6 @@ var ts; if (!links.declaredType) { var type = createType(16384); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 143).constraint) { - type.constraint = noConstraintType; - } links.declaredType = type; } return links.declaredType; @@ -24122,7 +24256,6 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 16777216) === 0); if (symbol.flags & (32 | 64)) { return getDeclaredTypeOfClassOrInterface(symbol); } @@ -24157,19 +24290,20 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: + case 133: case 104: - case 137: + case 138: case 94: case 129: - case 171: + case 172: return true; - case 162: + case 163: return isIndependentType(node.elementType); - case 157: + case 158: return isIndependentTypeReference(node); } return false; @@ -24178,7 +24312,7 @@ var ts; return node.type && isIndependentType(node.type) || !node.type && !node.initializer; } function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 150 && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 151 && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -24194,12 +24328,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { + case 148: case 147: - case 146: return isIndependentVariableLikeDeclaration(declaration); - case 149: - case 148: case 150: + case 149: + case 151: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -24210,7 +24344,7 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; - result[symbol.name] = symbol; + result.set(symbol.name, symbol); } return result; } @@ -24218,15 +24352,15 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; - result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; - if (!symbols[s.name]) { - symbols[s.name] = s; + if (!symbols.has(s.name)) { + symbols.set(s.name, s); } } } @@ -24234,8 +24368,8 @@ var ts; if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get("__call")); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get("__new")); type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0); type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1); } @@ -24243,7 +24377,14 @@ var ts; } function getTypeWithThisArgument(type, thisArgument) { if (getObjectFlags(type) & 4) { - return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + var target = type.target; + var typeArguments = type.typeArguments; + if (ts.length(target.typeParameters) === ts.length(typeArguments)) { + return createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType])); + } + } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument); })); } return type; } @@ -24279,7 +24420,7 @@ var ts; for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0); @@ -24424,17 +24565,44 @@ var ts; function unionSpreadIndexInfos(info1, info2) { return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly); } + function includeMixinType(type, types, index) { + var mixedTypes = []; + for (var i = 0; i < types.length; i++) { + if (i === index) { + mixedTypes.push(type); + } + else if (isMixinConstructorType(types[i])) { + mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1)[0])); + } + } + return getIntersectionType(mixedTypes); + } function resolveIntersectionTypeMembers(type) { var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexInfo = undefined; - var numberIndexInfo = undefined; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; + var stringIndexInfo; + var numberIndexInfo; + var types = type.types; + var mixinCount = ts.countWhere(types, isMixinConstructorType); + var _loop_3 = function (i) { + var t = type.types[i]; + if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) { + var signatures = getSignaturesOfType(t, 1); + if (signatures.length && mixinCount > 0) { + signatures = ts.map(signatures, function (s) { + var clone = cloneSignature(s); + clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i); + return clone; + }); + } + constructSignatures = ts.concatenate(constructSignatures, signatures); + } callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1)); stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0)); numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1)); + }; + for (var i = 0; i < types.length; i++) { + _loop_3(i); } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } @@ -24450,8 +24618,8 @@ var ts; } else if (symbol.flags & 2048) { var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var callSignatures = getSignaturesOfSymbol(members.get("__call")); + var constructSignatures = getSignaturesOfSymbol(members.get("__new")); var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0); var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); @@ -24464,14 +24632,14 @@ var ts; } if (symbol.flags & 32) { var classType = getDeclaredTypeOfClassOrInterface(symbol); - constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); } var baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072 | 540672)) { members = createSymbolTable(getNamedMembers(members)); - addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); + addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); } } var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined; @@ -24491,8 +24659,11 @@ var ts; var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); var templateReadonly = !!type.declaration.readonlyToken; var templateOptional = !!type.declaration.questionToken; - if (type.declaration.typeParameter.constraint.kind === 168) { - forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + if (type.declaration.typeParameter.constraint.kind === 169) { + for (var _i = 0, _a = getPropertiesOfType(modifiersType); _i < _a.length; _i++) { + var propertySymbol = _a[_i]; + addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); + } if (getIndexInfoOfType(modifiersType, 0)) { addMemberForKeyType(stringType); } @@ -24503,8 +24674,8 @@ var ts; forEachType(iterationType, addMemberForKeyType); } setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); - function addMemberForKeyType(t) { - var iterationMapper = createUnaryTypeMapper(typeParameter, t); + function addMemberForKeyType(t, propertySymbol) { + var iterationMapper = createTypeMapper([typeParameter], [t]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); if (t.flags & 32) { @@ -24514,7 +24685,10 @@ var ts; var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName); prop.type = propType; prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); - members[propName] = prop; + if (propertySymbol) { + prop.mappedTypeOrigin = propertySymbol; + } + members.set(propName, prop); } else if (t.flags & 2) { stringIndexInfo = createIndexInfo(propType, templateReadonly); @@ -24538,7 +24712,7 @@ var ts; function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { var constraintDeclaration = type.declaration.typeParameter.constraint; - if (constraintDeclaration.kind === 168) { + if (constraintDeclaration.kind === 169) { type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); } else { @@ -24550,9 +24724,6 @@ var ts; } return type.modifiersType; } - function getErasedTemplateTypeFromMappedType(type) { - return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); - } function isGenericMappedType(type) { if (getObjectFlags(type) & 32) { var constraintType = getConstraintTypeFromMappedType(type); @@ -24594,35 +24765,33 @@ var ts; function getPropertyOfObjectType(type, name) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } } } function getPropertiesOfUnionOrIntersectionType(type) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var current = _a[_i]; - for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { - var prop = _c[_b]; - getUnionOrIntersectionProperty(type, prop.name); - } - if (type.flags & 65536) { - break; - } - } - var props = type.resolvedProperties; - if (props) { - var result = []; - for (var key in props) { - var prop = props[key]; - if (!(prop.flags & 268435456 && prop.isPartial)) { - result.push(prop); + if (!type.resolvedProperties) { + var members = ts.createMap(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.name)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.name); + if (combinedProp) { + members.set(prop.name, combinedProp); + } + } + } + if (type.flags & 65536) { + break; } } - return result; + type.resolvedProperties = getNamedMembers(members); } - return emptyArray; + return type.resolvedProperties; } function getPropertiesOfType(type) { type = getApparentType(type); @@ -24630,36 +24799,96 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } - function getApparentTypeOfTypeVariable(type) { - if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeVariable(type); - while (constraintType && constraintType.flags & 16384) { - constraintType = getConstraintOfTypeVariable(constraintType); + function getConstraintOfType(type) { + return type.flags & 16384 ? getConstraintOfTypeParameter(type) : getBaseConstraintOfType(type); + } + function getConstraintOfTypeParameter(typeParameter) { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; + } + function getBaseConstraintOfType(type) { + var constraint = getResolvedBaseConstraint(type); + return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined; + } + function hasNonCircularBaseConstraint(type) { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } + function getResolvedBaseConstraint(type) { + var typeStack; + var circular; + if (!type.resolvedBaseConstraint) { + typeStack = []; + var constraint = getBaseConstraint(type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + } + return type.resolvedBaseConstraint; + function getBaseConstraint(t) { + if (ts.contains(typeStack, t)) { + circular = true; + return undefined; + } + typeStack.push(t); + var result = computeBaseConstraint(t); + typeStack.pop(); + return result; + } + function computeBaseConstraint(t) { + if (t.flags & 16384) { + var constraint = getConstraintFromTypeParameter(t); + return t.isThisType ? constraint : + constraint ? getBaseConstraint(constraint) : undefined; + } + if (t.flags & 196608) { + var types = t.types; + var baseTypes = []; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var type_1 = types_2[_i]; + var baseType = getBaseConstraint(type_1); + if (baseType) { + baseTypes.push(baseType); + } + } + return t.flags & 65536 && baseTypes.length === types.length ? getUnionType(baseTypes) : + t.flags & 131072 && baseTypes.length ? getIntersectionType(baseTypes) : + undefined; + } + if (t.flags & 262144) { + return stringType; } - type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + if (t.flags & 524288) { + var baseObjectType = getBaseConstraint(t.objectType); + var baseIndexType = getBaseConstraint(t.indexType); + var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; + return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; + } + return t; } - return type.resolvedApparentType; + } + function getApparentTypeOfIntersectionType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type)); } function getApparentType(type) { - var t = type.flags & 540672 ? getApparentTypeOfTypeVariable(type) : type; - return t.flags & 262178 ? globalStringType : - t.flags & 340 ? globalNumberType : - t.flags & 136 ? globalBooleanType : - t.flags & 512 ? getGlobalESSymbolType() : - t; + var t = type.flags & 540672 ? getBaseConstraintOfType(type) || emptyObjectType : type; + return t.flags & 131072 ? getApparentTypeOfIntersectionType(t) : + t.flags & 262178 ? globalStringType : + t.flags & 340 ? globalNumberType : + t.flags & 136 ? globalBooleanType : + t.flags & 512 ? getGlobalESSymbolType() : + t.flags & 16777216 ? globalObjectType : + t; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; + var excludeModifiers = containingType.flags & 65536 ? 8 | 16 : 0; var props; var commonFlags = (containingType.flags & 131072) ? 536870912 : 0; var isReadonly = false; var isPartial = false; - for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { - var current = types_2[_i]; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var current = types_3[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16))) { + if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & excludeModifiers)) { commonFlags &= prop.flags; if (!props) { props = [prop]; @@ -24710,12 +24939,12 @@ var ts; return result; } function getUnionOrIntersectionProperty(type, name) { - var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap()); - var property = properties[name]; + var properties = type.propertyCache || (type.propertyCache = ts.createMap()); + var property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); if (property) { - properties[name] = property; + properties.set(name, property); } } return property; @@ -24728,7 +24957,7 @@ var ts; type = getApparentType(type); if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -24807,16 +25036,16 @@ var ts; } function symbolsToArray(symbols) { var result = []; - for (var id in symbols) { + symbols.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { - result.push(symbols[id]); + result.push(symbol); } - } + }); return result; } function isJSDocOptionalParameter(node) { if (node.flags & 65536) { - if (node.type && node.type.kind === 274) { + if (node.type && node.type.kind === 275) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -24827,7 +25056,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 274; + return paramTag.typeExpression.type.kind === 275; } } } @@ -24875,9 +25104,10 @@ var ts; if (!links.resolvedSignature) { var parameters = []; var hasLiteralTypes = false; - var minArgumentCount = -1; + var minArgumentCount = 0; var thisParameter = undefined; var hasThisParameter = void 0; + var iife = ts.getImmediatelyInvokedFunctionExpression(declaration); var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; @@ -24893,41 +25123,33 @@ var ts; else { parameters.push(paramSymbol); } - if (param.type && param.type.kind === 171) { + if (param.type && param.type.kind === 172) { hasLiteralTypes = true; } - if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { - if (minArgumentCount < 0) { - minArgumentCount = i - (hasThisParameter ? 1 : 0); - } - } - else { - minArgumentCount = -1; + var isOptionalParameter_1 = param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !param.type || + isJSDocOptionalParameter(param); + if (!isOptionalParameter_1) { + minArgumentCount = parameters.length; } } - if ((declaration.kind === 151 || declaration.kind === 152) && + if ((declaration.kind === 152 || declaration.kind === 153) && !ts.hasDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 151 ? 152 : 151; + var otherKind = declaration.kind === 152 ? 153 : 152; var other = ts.getDeclarationOfKind(declaration.symbol, otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); - } - if (isJSConstructSignature) { - minArgumentCount--; - } - var classType = declaration.kind === 150 ? + var classType = declaration.kind === 151 ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : getTypeParametersFromJSDocTemplate(declaration); var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType); - var typePredicate = declaration.type && declaration.type.kind === 156 ? + var typePredicate = declaration.type && declaration.type.kind === 157 ? createTypePredicateFromTypePredicateNode(declaration.type) : undefined; links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes); @@ -24950,8 +25172,8 @@ var ts; return type; } } - if (declaration.kind === 151 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 152); + if (declaration.kind === 152 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 153); return getAnnotatedAccessorType(setter); } if (ts.nodeIsMissing(declaration.body)) { @@ -24965,20 +25187,20 @@ var ts; for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 158: case 159: - case 226: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 275: + case 186: + case 276: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -25048,7 +25270,11 @@ var ts; function getSignatureInstantiation(signature, typeArguments) { var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()); var id = getTypeListId(typeArguments); - return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + var instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; } function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); @@ -25063,7 +25289,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 150 || signature.declaration.kind === 154; + var isConstructor = signature.declaration.kind === 151 || signature.declaration.kind === 155; var type = createObjectType(16); type.members = emptySymbols; type.properties = emptyArray; @@ -25074,10 +25300,10 @@ var ts; return signature.isolatedSignatureType; } function getIndexSymbol(symbol) { - return symbol.members["__index"]; + return symbol.members.get("__index"); } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 132 : 134; + var syntaxKind = kind === 1 ? 132 : 135; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -25104,21 +25330,9 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 143).constraint; - } - function hasConstraintReferenceTo(type, target) { - var checked; - while (type && type.flags & 16384 && !(type.isThisType) && !ts.contains(checked, type)) { - if (type === target) { - return true; - } - (checked || (checked = [])).push(type); - var constraintDeclaration = getConstraintDeclaration(type); - type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); - } - return false; + return ts.getDeclarationOfKind(type.symbol, 144).constraint; } - function getConstraintOfTypeParameter(typeParameter) { + function getConstraintFromTypeParameter(typeParameter) { if (!typeParameter.constraint) { if (typeParameter.target) { var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); @@ -25126,23 +25340,13 @@ var ts; } else { var constraintDeclaration = getConstraintDeclaration(typeParameter); - var constraint = getTypeFromTypeNode(constraintDeclaration); - if (hasConstraintReferenceTo(constraint, typeParameter)) { - error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); - constraint = unknownType; - } - typeParameter.constraint = constraint; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } - function getConstraintOfTypeVariable(type) { - return type.flags & 16384 ? getConstraintOfTypeParameter(type) : - type.flags & 524288 ? type.constraint : - undefined; - } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 144).parent); } function getTypeListId(types) { var result = ""; @@ -25169,8 +25373,8 @@ var ts; } function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; - for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { - var type = types_3[_i]; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var type = types_4[_i]; if (!(type.flags & excludeKinds)) { result |= type.flags; } @@ -25179,9 +25383,10 @@ var ts; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); - var type = target.instantiations[id]; + var type = target.instantiations.get(id); if (!type) { - type = target.instantiations[id] = createObjectType(4, target.symbol); + type = createObjectType(4, target.symbol); + target.instantiations.set(id, type); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -25220,7 +25425,11 @@ var ts; var links = getSymbolLinks(symbol); var typeParameters = links.typeParameters; var id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + var instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + } + return instantiation; } function getTypeFromTypeAliasReference(node, symbol) { var type = getDeclaredTypeOfSymbol(symbol); @@ -25248,11 +25457,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 157: + case 158: return node.typeName; - case 273: + case 274: return node.name; - case 199: + case 200: var expr = node.expression; if (ts.isEntityNameExpression(expr)) { return expr; @@ -25276,7 +25485,7 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 && node.kind === 273) { + if (symbol.flags & 107455 && node.kind === 274) { return getTypeOfSymbol(symbol); } return getTypeFromNonGenericTypeReference(node, symbol); @@ -25286,13 +25495,13 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 273) { + if (node.kind === 274) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(typeReferenceName); type = getTypeReferenceType(node, symbol); } else { - var typeNameOrExpression = node.kind === 157 + var typeNameOrExpression = node.kind === 158 ? node.typeName : ts.isEntityNameExpression(node.expression) ? node.expression @@ -25321,9 +25530,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 227: case 228: - case 230: + case 229: + case 231: return declaration; } } @@ -25400,7 +25609,7 @@ var ts; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -25482,14 +25691,14 @@ var ts; } } function addTypesToUnion(typeSet, types) { - for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { - var type = types_4[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; addTypeToUnion(typeSet, type); } } function containsIdenticalType(types, type) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var t = types_5[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -25497,8 +25706,8 @@ var ts; return false; } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var type = types_7[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } @@ -25577,10 +25786,11 @@ var ts; return types[0]; } var id = getTypeListId(types); - var type = unionTypes[id]; + var type = unionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, 6144); - type = unionTypes[id] = createType(65536 | propagatedFlags); + type = createType(65536 | propagatedFlags); + unionTypes.set(id, type); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -25609,8 +25819,8 @@ var ts; } } function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var type = types_8[_i]; addTypeToIntersection(typeSet, type); } } @@ -25632,10 +25842,11 @@ var ts; return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), false, aliasSymbol, aliasTypeArguments); } var id = getTypeListId(typeSet); - var type = intersectionTypes[id]; + var type = intersectionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 6144); - type = intersectionTypes[id] = createType(131072 | propagatedFlags); + type = createType(131072 | propagatedFlags); + intersectionTypes.set(id, type); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -25685,21 +25896,10 @@ var ts; var type = createType(524288); type.objectType = objectType; type.indexType = indexType; - if (type.objectType.flags & 229376) { - type.constraint = getIndexTypeOfType(type.objectType, 0); - } - else if (type.objectType.flags & 540672) { - var apparentType = getApparentTypeOfTypeVariable(type.objectType); - if (apparentType !== emptyObjectType) { - type.constraint = isTypeOfKind(type.indexType, 262178) ? - getIndexedAccessType(apparentType, type.indexType) : - getIndexTypeOfType(apparentType, 0); - } - } return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; var propName = indexType.flags & (32 | 64 | 256) ? indexType.text : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ? @@ -25747,7 +25947,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 178 ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 179 ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 | 64)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType)); } @@ -25761,33 +25961,31 @@ var ts; return unknownType; } function getIndexedAccessForMappedType(type, indexType, accessNode) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); return unknownType; } - var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } function getIndexedAccessType(objectType, indexType, accessNode) { if (maybeTypeOfKind(indexType, 540672 | 262144) || - maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 178) || + maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 179) || isGenericMappedType(objectType)) { if (objectType.flags & 1) { return objectType; } - if (accessNode) { - if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } - } if (isGenericMappedType(objectType)) { return getIndexedAccessForMappedType(objectType, indexType, accessNode); } var id = objectType.id + "," + indexType.id; - return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + var type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); + } + return type; } var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 && !(indexType.flags & 8190)) { @@ -25827,7 +26025,7 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { var aliasSymbol = getAliasSymbolForTypeNode(node); - if (ts.isEmpty(node.symbol.members) && !aliasSymbol) { + if (node.symbol.members.size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -25840,13 +26038,13 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 229 ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 230 ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; } - function getSpreadType(left, right, isFromObjectLiteral) { + function getSpreadType(left, right) { if (left.flags & 1 || right.flags & 1) { return anyType; } @@ -25859,10 +26057,13 @@ var ts; return left; } if (left.flags & 65536) { - return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); }); + return mapType(left, function (t) { return getSpreadType(t, right); }); } if (right.flags & 65536) { - return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); }); + return mapType(right, function (t) { return getSpreadType(left, t); }); + } + if (right.flags & 16777216) { + return emptyObjectType; } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); @@ -25878,23 +26079,23 @@ var ts; } for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { var rightProp = _a[_i]; - var isOwnProperty = !(rightProp.flags & 8192) || isFromObjectLiteral; var isSetterWithoutGetter = rightProp.flags & 65536 && !(rightProp.flags & 32768); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 | 16)) { - skippedPrivateMembers[rightProp.name] = true; + skippedPrivateMembers.set(rightProp.name, true); } - else if (isOwnProperty && !isSetterWithoutGetter) { - members[rightProp.name] = rightProp; + else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { + members.set(rightProp.name, rightProp); } } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (leftProp.flags & 65536 && !(leftProp.flags & 32768) - || leftProp.name in skippedPrivateMembers) { + || skippedPrivateMembers.has(leftProp.name) + || isClassMethod(leftProp)) { continue; } - if (leftProp.name in members) { - var rightProp = members[leftProp.name]; + if (members.has(leftProp.name)) { + var rightProp = members.get(leftProp.name); var rightType = getTypeOfSymbol(rightProp); if (maybeTypeOfKind(rightType, 2048) || rightProp.flags & 536870912) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); @@ -25905,15 +26106,18 @@ var ts; result.rightSpread = rightProp; result.declarations = declarations; result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); - members[leftProp.name] = result; + members.set(leftProp.name, result); } } else { - members[leftProp.name] = leftProp; + members.set(leftProp.name, leftProp); } } return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } + function isClassMethod(prop) { + return prop.flags & 8192 && ts.find(prop.declarations, function (decl) { return ts.isClassLike(decl.parent); }); + } function createLiteralType(flags, text) { var type = createType(flags); type.text = text; @@ -25935,7 +26139,11 @@ var ts; } function getLiteralTypeForText(flags, text) { var map = flags & 32 ? stringLiteralTypes : numericLiteralTypes; - return map[text] || (map[text] = createLiteralType(flags, text)); + var type = map.get(text); + if (!type) { + map.set(text, type = createLiteralType(flags, text)); + } + return type; } function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); @@ -25963,9 +26171,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 228)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 229)) { if (!(ts.getModifierFlags(container) & 32) && - (container.kind !== 150 || ts.isNodeDescendantOf(node, container.body))) { + (container.kind !== 151 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -25982,85 +26190,87 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118: - case 264: case 265: + case 266: return anyType; - case 134: + case 135: return stringType; case 132: return numberType; case 121: return booleanType; - case 135: + case 136: return esSymbolType; case 104: return voidType; - case 137: + case 138: return undefinedType; case 94: return nullType; case 129: return neverType; - case 290: - return nullType; + case 133: + return nonPrimitiveType; case 291: - return undefinedType; + return nullType; case 292: + return undefinedType; + case 293: return neverType; - case 167: + case 168: case 98: return getTypeFromThisTypeNode(node); - case 171: + case 172: return getTypeFromLiteralTypeNode(node); - case 289: + case 290: return getTypeFromLiteralTypeNode(node.literal); - case 157: - case 273: + case 158: + case 274: return getTypeFromTypeReference(node); - case 156: + case 157: return booleanType; - case 199: + case 200: return getTypeFromTypeReference(node); - case 160: + case 161: return getTypeFromTypeQueryNode(node); - case 162: - case 266: - return getTypeFromArrayTypeNode(node); case 163: - return getTypeFromTupleTypeNode(node); - case 164: case 267: - return getTypeFromUnionTypeNode(node); + return getTypeFromArrayTypeNode(node); + case 164: + return getTypeFromTupleTypeNode(node); case 165: - return getTypeFromIntersectionTypeNode(node); + case 268: + return getTypeFromUnionTypeNode(node); case 166: - case 269: + return getTypeFromIntersectionTypeNode(node); + case 167: case 270: - case 277: + case 271: case 278: - case 274: + case 279: + case 275: return getTypeFromTypeNode(node.type); - case 271: + case 272: return getTypeFromTypeNode(node.literal); - case 158: case 159: - case 161: - case 288: - case 275: + case 160: + case 162: + case 289: + case 276: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 168: - return getTypeFromTypeOperatorNode(node); case 169: - return getTypeFromIndexedAccessTypeNode(node); + return getTypeFromTypeOperatorNode(node); case 170: + return getTypeFromIndexedAccessTypeNode(node); + case 171: return getTypeFromMappedTypeNode(node); case 70: - case 141: + case 142: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 268: + case 269: return getTypeFromJSDocTupleType(node); - case 276: + case 277: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -26087,13 +26297,13 @@ var ts; var instantiations = mapper.instantiations || (mapper.instantiations = []); return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); } - function createUnaryTypeMapper(source, target) { + function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } - function createBinaryTypeMapper(source1, target1, source2, target2) { + function makeBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createArrayTypeMapper(sources, targets) { + function makeArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { @@ -26104,10 +26314,9 @@ var ts; }; } function createTypeMapper(sources, targets) { - var count = sources.length; - var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : - count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : - createArrayTypeMapper(sources, targets); + var mapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + makeArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; return mapper; } @@ -26137,7 +26346,12 @@ var ts; } function combineTypeMappers(mapper1, mapper2) { var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; - mapper.mappedTypes = mapper1.mappedTypes; + mapper.mappedTypes = ts.concatenate(mapper1.mappedTypes, mapper2.mappedTypes); + return mapper; + } + function createReplacementMapper(source, target, baseMapper) { + var mapper = function (t) { return t === source ? target : baseMapper(t); }; + mapper.mappedTypes = baseMapper.mappedTypes; return mapper; } function cloneTypeParameter(typeParameter) { @@ -26214,10 +26428,7 @@ var ts; if (typeVariable_1 !== mappedTypeVariable) { return mapType(mappedTypeVariable, function (t) { if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); + return instantiateMappedObjectType(type, createReplacementMapper(typeVariable_1, t, mapper)); } return t; }); @@ -26245,23 +26456,23 @@ var ts; var node = symbol.declarations[0]; while (node) { switch (node.kind) { - case 158: case 159: - case 226: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 227: - case 197: + case 186: case 228: + case 198: case 229: + case 230: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -26271,14 +26482,19 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 228) { + if (ts.isClassLike(node) || node.kind === 229) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 275: + case 171: + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)))) { + return true; + } + break; + case 276: var func = node; for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { var p = _c[_b]; @@ -26287,8 +26503,8 @@ var ts; } } break; - case 231: - case 262: + case 232: + case 263: return false; } node = node.parent; @@ -26298,7 +26514,7 @@ var ts; function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 262 || parentKind === 232; + return parentKind === 263 || parentKind === 233; } return false; } @@ -26350,27 +26566,27 @@ var ts; return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 184: case 185: + case 186: return isContextSensitiveFunctionLikeDeclaration(node); - case 176: + case 177: return ts.forEach(node.properties, isContextSensitive); - case 175: + case 176: return ts.forEach(node.elements, isContextSensitive); - case 193: + case 194: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 192: + case 193: return node.operatorToken.kind === 53 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 258: + case 259: return isContextSensitive(node.initializer); + case 150: case 149: - case 148: return isContextSensitiveFunctionLikeDeclaration(node); - case 183: + case 184: return isContextSensitive(node.expression); } return false; @@ -26382,7 +26598,7 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !p.type; })) { return true; } - if (node.kind === 185) { + if (node.kind === 186) { return false; } var parameter = ts.firstOrUndefined(node.parameters); @@ -26400,9 +26616,12 @@ var ts; result.properties = resolved.properties; result.callSignatures = emptyArray; result.constructSignatures = emptyArray; - type = result; + return result; } } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures)); + } return type; } function isTypeIdenticalTo(source, target) { @@ -26569,13 +26788,15 @@ var ts; return true; } var id = source.id + "," + target.id; - if (enumRelation[id] !== undefined) { - return enumRelation[id]; + var relation = enumRelation.get(id); + if (relation !== undefined) { + return relation; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256) || !(target.symbol.flags & 256) || (source.flags & 65536) !== (target.flags & 65536)) { - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } var targetEnumType = getTypeOfSymbol(target.symbol); for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { @@ -26586,11 +26807,13 @@ var ts; if (errorReporter) { errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); } - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } } } - return enumRelation[id] = true; + enumRelation.set(id, true); + return true; } function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { if (target.flags & 8192) @@ -26611,6 +26834,8 @@ var ts; return true; if (source.flags & 4096 && (!strictNullChecks || target.flags & 4096)) return true; + if (source.flags & 32768 && target.flags & 16777216) + return true; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & 1) return true; @@ -26642,12 +26867,12 @@ var ts; } if (source.flags & 32768 && target.flags & 32768) { var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { return related === 1; } } - if (source.flags & 507904 || target.flags & 507904) { + if (source.flags & 1032192 || target.flags & 1032192) { return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); } return false; @@ -26786,14 +27011,6 @@ var ts; } } } - else { - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; - } - } - } } else if (target.flags & 262144) { if (source.flags & 262144) { @@ -26801,12 +27018,10 @@ var ts; return result; } } - if (target.type.flags & 540672) { - var constraint = getConstraintOfTypeVariable(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; - } + var constraint = getConstraintOfType(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; } } } @@ -26816,8 +27031,9 @@ var ts; return result; } } - if (target.constraint) { - if (result = isRelatedTo(source, target.constraint, reportErrors)) { + var constraint = getBaseConstraintOfType(target); + if (constraint) { + if (result = isRelatedTo(source, constraint, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -26834,20 +27050,23 @@ var ts; } else { var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1) { - constraint = emptyObjectType; - } - constraint = getTypeWithThisArgument(constraint, source); - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; - return result; + if (constraint || !(target.flags & 16777216)) { + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; + } + constraint = getTypeWithThisArgument(constraint, source); + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } } } } else if (source.flags & 524288) { - if (source.constraint) { - if (result = isRelatedTo(source.constraint, target, reportErrors)) { + var constraint = getBaseConstraintOfType(source); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -26902,7 +27121,7 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) || + if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyResolvedType(resolved)) || resolved.stringIndexInfo || (resolved.numberIndexInfo && isNumericLiteralName(name)) || getPropertyOfType(type, name)) { @@ -26919,13 +27138,16 @@ var ts; } return false; } - function isEmptyObjectType(t) { + function isEmptyResolvedType(t) { return t.properties.length === 0 && t.callSignatures.length === 0 && t.constructSignatures.length === 0 && !t.stringIndexInfo && !t.numberIndexInfo; } + function isEmptyObjectType(type) { + return type.flags & 32768 && isEmptyResolvedType(resolveStructuredTypeMembers(type)); + } function hasExcessProperties(source, target, reportErrors) { if (maybeTypeOfKind(target, 32768) && !(getObjectFlags(target) & 512)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { @@ -27031,10 +27253,10 @@ var ts; return 0; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { if (reportErrors && related === 2) { - relation[id] = 3; + relation.set(id, 3); } else { return related === 1 ? -1 : 0; @@ -27042,7 +27264,7 @@ var ts; } if (depth > 0) { for (var i = 0; i < depth; i++) { - if (maybeStack[i][id]) { + if (maybeStack[i].get(id)) { return 1; } } @@ -27060,7 +27282,7 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = ts.createMap(); - maybeStack[depth][id] = 1; + maybeStack[depth].set(id, 1); depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) @@ -27094,38 +27316,38 @@ var ts; if (result) { var maybeCache = maybeStack[depth]; var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; - ts.copyProperties(maybeCache, destinationCache); + ts.copyEntries(maybeCache, destinationCache); } else { - relation[id] = reportErrors ? 3 : 2; + relation.set(id, reportErrors ? 3 : 2); } return result; } function mappedTypeRelatedTo(source, target, reportErrors) { if (isGenericMappedType(target)) { if (isGenericMappedType(source)) { - var result_2; - if (relation === identityRelation) { - var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; - var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else { - if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); - } + var sourceReadonly = !!source.declaration.readonlyToken; + var sourceOptional = !!source.declaration.questionToken; + var targetReadonly = !!target.declaration.readonlyToken; + var targetOptional = !!target.declaration.questionToken; + var modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + var result_2; + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); } } } + else if (target.declaration.questionToken && isEmptyObjectType(source)) { + return -1; + } } else if (relation !== identityRelation) { var resolved = resolveStructuredTypeMembers(target); - if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { + if (isEmptyResolvedType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { return -1; } } @@ -27487,8 +27709,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var t = types_9[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -27496,8 +27718,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -27588,8 +27810,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; result |= getFalsyFlags(t); } return result; @@ -27650,7 +27872,7 @@ var ts; var property = _a[_i]; var original = getTypeOfSymbol(property); var updated = f(original); - members[property.name] = updated === original ? property : createTransientSymbol(property, updated); + members.set(property.name, updated === original ? property : createTransientSymbol(property, updated)); } ; return members; @@ -27736,25 +27958,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 148: case 147: - case 146: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 144: + case 145: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 174: + case 175: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 226: + case 227: + case 150: case 149: - case 148: - case 151: case 152: - case 184: + case 153: case 185: + case 186: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -27851,7 +28073,7 @@ var ts; inferredProp.declarations = prop.declarations; inferredProp.type = inferredPropType; inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); - members[prop.name] = inferredProp; + members.set(prop.name, inferredProp); } if (indexInfo) { var inferredIndexType = inferTargetType(indexInfo.type); @@ -27994,10 +28216,10 @@ var ts; return; } var key = source.id + "," + target.id; - if (visited[key]) { + if (visited.get(key)) { return; } - visited[key] = true; + visited.set(key, true); if (depth === 0) { sourceStack = []; targetStack = []; @@ -28089,8 +28311,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -28166,10 +28388,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 160: + case 161: return true; case 70: - case 141: + case 142: node = node.parent; continue; default: @@ -28186,7 +28408,7 @@ var ts; if (node.kind === 98) { return "0"; } - if (node.kind === 177) { + if (node.kind === 178) { var key = getFlowCacheKey(node.expression); return key && key + "." + node.name.text; } @@ -28197,7 +28419,7 @@ var ts; case 70: case 98: return node; - case 177: + case 178: return getLeftmostIdentifierOrThis(node.expression); } return undefined; @@ -28206,19 +28428,19 @@ var ts; switch (source.kind) { case 70: return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 224 || target.kind === 174) && + (target.kind === 225 || target.kind === 175) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98: return target.kind === 98; - case 177: - return target.kind === 177 && + case 178: + return target.kind === 178 && source.name.text === target.name.text && isMatchingReference(source.expression, target.expression); } return false; } function containsMatchingReference(source, target) { - while (source.kind === 177) { + while (source.kind === 178) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -28227,7 +28449,7 @@ var ts; return false; } function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 177 && + return target.kind === 178 && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); } @@ -28235,7 +28457,7 @@ var ts; if (expr.kind === 70) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 177) { + if (expr.kind === 178) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.text); } @@ -28265,7 +28487,7 @@ var ts; } } } - if (callExpression.expression.kind === 177 && + if (callExpression.expression.kind === 178 && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -28304,8 +28526,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; result |= getTypeFacts(t); } return result; @@ -28313,7 +28535,7 @@ var ts; function isFunctionObjectType(type) { var resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || - resolved.members["bind"] && isTypeSubtypeOf(type, globalFunctionType)); + resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type) { var flags = type.flags; @@ -28356,6 +28578,9 @@ var ts; if (flags & 512) { return strictNullChecks ? 1981320 : 4193160; } + if (flags & 16777216) { + return strictNullChecks ? 6166480 : 8378320; + } if (flags & 16384) { var constraint = getConstraintOfTypeParameter(type); return getTypeFacts(constraint || emptyObjectType); @@ -28391,7 +28616,7 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 || node.parent.kind === 258 ? + return node.parent.kind === 176 || node.parent.kind === 259 ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } @@ -28410,21 +28635,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 213: - return stringType; case 214: + return stringType; + case 215: return checkRightHandSideOfForOf(parent.expression) || unknownType; - case 192: + case 193: return getAssignedTypeOfBinaryExpression(parent); - case 186: + case 187: return undefinedType; - case 175: + case 176: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 196: + case 197: return getAssignedTypeOfSpreadExpression(parent); - case 258: - return getAssignedTypeOfPropertyAssignment(parent); case 259: + return getAssignedTypeOfPropertyAssignment(parent); + case 260: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -28432,7 +28657,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 172 ? + var type = pattern.kind === 173 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : @@ -28447,35 +28672,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 213) { + if (node.parent.parent.kind === 214) { return stringType; } - if (node.parent.parent.kind === 214) { + if (node.parent.parent.kind === 215) { return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 224 ? + return node.kind === 225 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 224 || node.kind === 174 ? + return node.kind === 225 || node.kind === 175 ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 224 && node.initializer && + return node.kind === 225 && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 174 && node.parent.kind === 192 && + node.kind !== 175 && node.parent.kind === 193 && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 183: + case 184: return getReferenceCandidate(node.expression); - case 192: + case 193: switch (node.operatorToken.kind) { case 57: return getReferenceCandidate(node.left); @@ -28487,13 +28712,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 183 || - parent.kind === 192 && parent.operatorToken.kind === 57 && parent.left === node || - parent.kind === 192 && parent.operatorToken.kind === 25 && parent.right === node ? + return parent.kind === 184 || + parent.kind === 193 && parent.operatorToken.kind === 57 && parent.left === node || + parent.kind === 193 && parent.operatorToken.kind === 25 && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 254) { + if (clause.kind === 255) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -28595,8 +28820,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var t = types_13[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var t = types_14[_i]; if (!(t.flags & 8192)) { if (!(getObjectFlags(t) & 256)) { return false; @@ -28614,11 +28839,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 177 && (parent.name.text === "length" || - parent.parent.kind === 179 && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 178 && + var isLengthPushOrUnshift = parent.kind === 178 && (parent.name.text === "length" || + parent.parent.kind === 180 && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 179 && parent.expression === root && - parent.parent.kind === 192 && + parent.parent.kind === 193 && parent.parent.operatorToken.kind === 57 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -28647,7 +28872,7 @@ var ts; } function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) { var key; - if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215)) { + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 17810431)) { return declaredType; } var initialType = assumeInitialized ? declaredType : @@ -28657,7 +28882,7 @@ var ts; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); visitedFlowCount = visitedFlowStart; var resultType = getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent.kind === 201 && getTypeWithFacts(resultType, 524288).flags & 8192) { + if (reference.parent.kind === 202 && getTypeWithFacts(resultType, 524288).flags & 8192) { return declaredType; } return resultType; @@ -28702,7 +28927,7 @@ var ts; } else if (flow.flags & 2) { var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 177) { + if (container && container !== flowContainer && reference.kind !== 178) { flow = container.flowNode; continue; } @@ -28745,7 +28970,7 @@ var ts; } function getTypeAtFlowArrayMutation(flow) { var node = flow.node; - var expr = node.kind === 179 ? + var expr = node.kind === 180 ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -28753,7 +28978,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256) { var evolvedType_1 = type; - if (node.kind === 179) { + if (node.kind === 180) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -28828,8 +29053,9 @@ var ts; if (!key) { key = getFlowCacheKey(reference); } - if (cache[key]) { - return cache[key]; + var cached = cache.get(key); + if (cached) { + return cached; } for (var i = flowLoopStart; i < flowLoopCount; i++) { if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) { @@ -28851,8 +29077,9 @@ var ts; firstAntecedentType = flowType; } var type = getTypeFromFlowType(flowType); - if (cache[key]) { - return cache[key]; + var cached_1 = cache.get(key); + if (cached_1) { + return cached_1; } if (!ts.contains(antecedentTypes, type)) { antecedentTypes.push(type); @@ -28868,10 +29095,11 @@ var ts; if (isIncomplete(firstAntecedentType)) { return createFlowType(result, true); } - return cache[key] = result; + cache.set(key, result); + return result; } function isMatchingReferenceDiscriminant(expr) { - return expr.kind === 177 && + return expr.kind === 178 && declaredType.flags & 65536 && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(declaredType, expr.name.text); @@ -28905,10 +29133,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 187 && right_1.kind === 9) { + if (left_1.kind === 188 && right_1.kind === 9) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 187 && left_1.kind === 9) { + if (right_1.kind === 188 && left_1.kind === 9) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -28954,7 +29182,7 @@ var ts; assumeTrue ? 16384 : 131072; return getTypeWithFacts(type, facts); } - if (type.flags & 33281) { + if (type.flags & 16810497) { return type; } if (assumeTrue) { @@ -28979,14 +29207,14 @@ var ts; assumeTrue = !assumeTrue; } if (assumeTrue && !(type.flags & 65536)) { - var targetType = typeofTypesByName[literal.text]; + var targetType = typeofTypesByName.get(literal.text); if (targetType && isTypeSubtypeOf(targetType, type)) { return targetType; } } var facts = assumeTrue ? - typeofEQFacts[literal.text] || 64 : - typeofNEFacts[literal.text] || 8192; + typeofEQFacts.get(literal.text) || 64 : + typeofNEFacts.get(literal.text) || 8192; return getTypeWithFacts(type, facts); } function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { @@ -29086,7 +29314,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 178 || invokedExpression.kind === 177) { + if (invokedExpression.kind === 179 || invokedExpression.kind === 178) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -29103,15 +29331,15 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 178: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 179: + case 180: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 183: + case 184: return narrowType(type, expr.expression, assumeTrue); - case 192: + case 193: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 190: + case 191: if (expr.operator === 50) { return narrowType(type, expr.operand, !assumeTrue); } @@ -29138,9 +29366,9 @@ var ts; while (true) { node = node.parent; if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 232 || - node.kind === 262 || - node.kind === 147) { + node.kind === 233 || + node.kind === 263 || + node.kind === 148) { return node; } } @@ -29171,7 +29399,7 @@ var ts; if (node.kind === 70) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 145) { symbol.isAssigned = true; } } @@ -29191,7 +29419,7 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2) { - if (container.kind === 185) { + if (container.kind === 186) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (ts.hasModifier(container, 256)) { @@ -29209,7 +29437,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (declaration_1.kind === 227 + if (declaration_1.kind === 228 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -29221,11 +29449,11 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration_1.kind === 197) { + else if (declaration_1.kind === 198) { var container = ts.getThisContainer(node, false); while (container !== undefined) { if (container.parent === declaration_1) { - if (container.kind === 147 && ts.hasModifier(container, 32)) { + if (container.kind === 148 && ts.hasModifier(container, 32)) { getNodeLinks(declaration_1).flags |= 8388608; getNodeLinks(node).flags |= 16777216; } @@ -29255,12 +29483,12 @@ var ts; if (!(localOrExportSymbol.flags & 3) || assignmentKind === 1 || !declaration) { return type; } - var isParameter = ts.getRootDeclaration(declaration).kind === 144; + var isParameter = ts.getRootDeclaration(declaration).kind === 145; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; - while (flowContainer !== declarationContainer && (flowContainer.kind === 184 || - flowContainer.kind === 185 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 185 || + flowContainer.kind === 186 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -29296,7 +29524,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 257) { + symbol.valueDeclaration.parent.kind === 258) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -29314,8 +29542,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 212 && - ts.getAncestor(symbol.valueDeclaration, 225).parent === container && + if (container.kind === 213 && + ts.getAncestor(symbol.valueDeclaration, 226).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -29327,14 +29555,14 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 183) { + while (current.parent.kind === 184) { current = current.parent; } var isAssigned = false; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 190 || current.parent.kind === 191)) { + else if ((current.parent.kind === 191 || current.parent.kind === 192)) { var expr = current.parent; isAssigned = expr.operator === 42 || expr.operator === 43; } @@ -29353,7 +29581,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 147 || container.kind === 150) { + if (container.kind === 148 || container.kind === 151) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -29397,32 +29625,32 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 150) { + if (container.kind === 151) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } - if (container.kind === 185) { + if (container.kind === 186) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 231: + case 232: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 230: + case 231: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 150: + case 151: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 148: case 147: - case 146: if (ts.getModifierFlags(container) & 32) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 142: + case 143: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -29431,7 +29659,7 @@ var ts; } if (ts.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { - if (container.kind === 184 && + if (container.kind === 185 && ts.isInJavaScriptFile(container.parent) && ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { var className = container.parent @@ -29466,27 +29694,27 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 275) { + if (jsdocType && jsdocType.kind === 276) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 278) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 279) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 144) { + if (n.kind === 145) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 179 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 180 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 185) { + while (container && container.kind === 186) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -29495,16 +29723,16 @@ var ts; var nodeCheckFlag = 0; if (!canUseSuperExpression) { var current = node; - while (current && current !== container && current.kind !== 142) { + while (current && current !== container && current.kind !== 143) { current = current.parent; } - if (current && current.kind === 142) { + if (current && current.kind === 143) { 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 if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 177)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -29512,7 +29740,7 @@ var ts; } return unknownType; } - if (!isCallExpression && container.kind === 150) { + if (!isCallExpression && container.kind === 151) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if ((ts.getModifierFlags(container) & 32) || isCallExpression) { @@ -29522,7 +29750,7 @@ var ts; nodeCheckFlag = 256; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 149 && ts.getModifierFlags(container) & 256) { + if (container.kind === 150 && ts.getModifierFlags(container) & 256) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096; } @@ -29533,7 +29761,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 176) { + if (container.parent.kind === 177) { if (languageVersion < 2) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -29551,7 +29779,7 @@ var ts; } return unknownType; } - if (container.kind === 150 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 151 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -29563,24 +29791,24 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 150; + return container.kind === 151; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 176) { + if (ts.isClassLike(container.parent) || container.parent.kind === 177) { if (ts.getModifierFlags(container) & 32) { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || - container.kind === 152; + return container.kind === 150 || + container.kind === 149 || + container.kind === 152 || + container.kind === 153; } else { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || + return container.kind === 150 || + container.kind === 149 || container.kind === 152 || + container.kind === 153 || + container.kind === 148 || container.kind === 147 || - container.kind === 146 || - container.kind === 150; + container.kind === 151; } } } @@ -29588,7 +29816,7 @@ var ts; } } function getContextualThisParameterType(func) { - if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185) { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 186) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { var thisParameter = contextualSignature.thisParameter; @@ -29603,23 +29831,23 @@ var ts; var func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var iife = ts.getImmediatelyInvokedFunctionExpression(func); - if (iife) { + if (iife && iife.arguments) { var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (iife.arguments && indexOfParameter < iife.arguments.length) { - if (parameter.dotDotDotToken) { - var restTypes = []; - for (var i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); - } - return createArrayType(getUnionType(restTypes)); - } - var links = getNodeLinks(iife); - var cached = links.resolvedSignature; - links.resolvedSignature = anySignature; - var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); - links.resolvedSignature = cached; - return type; - } + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); + } + return restTypes.length ? createArrayType(getUnionType(restTypes)) : undefined; + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = indexOfParameter < iife.arguments.length ? + getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : + parameter.initializer ? undefined : undefinedWideningType; + links.resolvedSignature = cached; + return type; } var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -29644,7 +29872,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -29655,11 +29883,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_20 = declaration.propertyName || declaration.name; + var name = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_20)) { - var text = ts.getTextOfPropertyName(name_20); + !ts.isBindingPattern(name)) { + var text = ts.getTextOfPropertyName(name); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -29696,7 +29924,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 144 && node.parent.initializer === node) { + if (node.parent.kind === 145 && node.parent.initializer === node) { return true; } node = node.parent; @@ -29705,8 +29933,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 150 || - functionDecl.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152))) { + functionDecl.kind === 151 || + functionDecl.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 153))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -29725,7 +29953,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 181) { + if (template.parent.kind === 182) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -29762,8 +29990,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -29833,13 +30061,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 251) { + if (attribute.kind === 252) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 252) { + else if (attribute.kind === 253) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -29857,41 +30085,41 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 224: - case 144: + case 225: + case 145: + case 148: case 147: - case 146: - case 174: + case 175: return getContextualTypeForInitializerExpression(node); - case 185: - case 217: + case 186: + case 218: return getContextualTypeForReturnExpression(node); - case 195: + case 196: return getContextualTypeForYieldOperand(parent); - case 179: case 180: + case 181: return getContextualTypeForArgument(parent, node); - case 182: - case 200: + case 183: + case 201: return getTypeFromTypeNode(parent.type); - case 192: + case 193: return getContextualTypeForBinaryOperand(node); - case 258: case 259: + case 260: return getContextualTypeForObjectLiteralElement(parent); - case 175: + case 176: return getContextualTypeForElementExpression(node); - case 193: + case 194: return getContextualTypeForConditionalOperand(node); - case 203: - ts.Debug.assert(parent.parent.kind === 194); + case 204: + ts.Debug.assert(parent.parent.kind === 195); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 183: + case 184: return getContextualType(parent); - case 253: + case 254: return getContextualType(parent); - case 251: case 252: + case 253: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -29920,7 +30148,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 184 || node.kind === 185; + return node.kind === 185 || node.kind === 186; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -29933,7 +30161,7 @@ var ts; getApparentTypeOfContextualType(node); } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; @@ -29943,8 +30171,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var current = types_15[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var current = types_16[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -29974,8 +30202,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { - return (node.kind === 174 && !!node.initializer) || - (node.kind === 192 && node.operatorToken.kind === 57); + return (node.kind === 175 && !!node.initializer) || + (node.kind === 193 && node.operatorToken.kind === 57); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -29984,7 +30212,7 @@ var ts; var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 196) { + if (inDestructuringPattern && e.kind === 197) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -29996,7 +30224,7 @@ var ts; var type = checkExpressionForMutableLocation(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 196; + hasSpreadElement = hasSpreadElement || e.kind === 197; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -30007,7 +30235,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 173 || pattern.kind === 175)) { + if (pattern && (pattern.kind === 174 || pattern.kind === 176)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -30015,7 +30243,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 198) { + if (patternElement.kind !== 199) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -30032,7 +30260,7 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 142 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 143 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 340); @@ -30078,7 +30306,7 @@ var ts; var propagatedFlags = 0; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 172 || contextualType.pattern.kind === 176); + (contextualType.pattern.kind === 173 || contextualType.pattern.kind === 177); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -30087,25 +30315,25 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 258 || - memberDecl.kind === 259 || + if (memberDecl.kind === 259 || + memberDecl.kind === 260 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 258) { + if (memberDecl.kind === 259) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 149) { + else if (memberDecl.kind === 150) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 259); + ts.Debug.assert(memberDecl.kind === 260); type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 258 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 259 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 259 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 260 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912; } @@ -30131,12 +30359,12 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 260) { - if (languageVersion < 5) { + else if (memberDecl.kind === 261) { + if (languageVersion < 2) { checkExternalEmitHelpers(memberDecl, 2); } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; propertiesTable = ts.createMap(); hasComputedStringProperty = false; @@ -30148,12 +30376,12 @@ var ts; error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } - spread = getSpreadType(spread, type, false); + spread = getSpreadType(spread, type); offset = i + 1; continue; } else { - ts.Debug.assert(memberDecl.kind === 151 || memberDecl.kind === 152); + ts.Debug.assert(memberDecl.kind === 152 || memberDecl.kind === 153); checkAccessorDeclaration(memberDecl); } if (ts.hasDynamicName(memberDecl)) { @@ -30165,25 +30393,25 @@ var ts; } } else { - propertiesTable[member.name] = member; + propertiesTable.set(member.name, member); } propertiesArray.push(member); } if (contextualTypeHasPattern) { for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; - if (!propertiesTable[prop.name]) { + if (!propertiesTable.get(prop.name)) { if (!(prop.flags & 536870912)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable[prop.name] = prop; + propertiesTable.set(prop.name, prop); propertiesArray.push(prop); } } } if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); } if (spread.flags & 32768) { spread.flags |= propagatedFlags; @@ -30212,7 +30440,7 @@ var ts; } } function isValidSpreadType(type) { - return !!(type.flags & (1 | 4096 | 2048) || + return !!(type.flags & (1 | 4096 | 2048 | 16777216) || type.flags & 32768 && !isGenericMappedType(type) || type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); } @@ -30231,13 +30459,13 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 253: + case 254: checkJsxExpression(child); break; - case 247: + case 248: checkJsxElement(child); break; - case 248: + case 249: checkJsxSelfClosingElement(child); break; } @@ -30248,7 +30476,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 177 || tagName.kind === 98) { + if (tagName.kind === 178 || tagName.kind === 98) { return false; } else { @@ -30257,6 +30485,13 @@ var ts; } function checkJsxAttribute(node, elementAttributesType, nameTable) { var correspondingPropType = undefined; + var exprType; + if (node.initializer) { + exprType = checkExpression(node.initializer); + } + else { + exprType = booleanType; + } if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) { error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); } @@ -30276,17 +30511,10 @@ var ts; } } } - var exprType; - if (node.initializer) { - exprType = checkExpression(node.initializer); - } - else { - exprType = booleanType; - } if (correspondingPropType) { checkTypeAssignableTo(exprType, correspondingPropType, node); } - nameTable[node.name.text] = true; + nameTable.set(node.name.text, true); return exprType; } function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { @@ -30297,22 +30525,23 @@ var ts; var props = getPropertiesOfType(type); for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { var prop = props_2[_i]; - if (!nameTable[prop.name]) { + if (!nameTable.get(prop.name)) { var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); if (targetPropSym) { var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); } - nameTable[prop.name] = true; + nameTable.set(prop.name, true); } } return type; } function getJsxType(name) { - if (jsxTypes[name] === undefined) { - return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + var jsxType = jsxTypes.get(name); + if (jsxType === undefined) { + jsxTypes.set(name, jsxType = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } - return jsxTypes[name]; + return jsxType; } function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); @@ -30532,11 +30761,11 @@ var ts; var nameTable = ts.createMap(); var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 251) { + if (node.attributes[i].kind === 252) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 252); + ts.Debug.assert(node.attributes[i].kind === 253); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -30545,10 +30774,10 @@ var ts; } if (targetAttributesType && !sawSpreadedAny) { var targetProperties = getPropertiesOfType(targetAttributesType); - for (var i = 0; i < targetProperties.length; i++) { - if (!(targetProperties[i].flags & 536870912) && - !nameTable[targetProperties[i].name]) { - error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); + for (var _i = 0, targetProperties_1 = targetProperties; _i < targetProperties_1.length; _i++) { + var targetProperty = targetProperties_1[_i]; + if (!(targetProperty.flags & 536870912) && !nameTable.get(targetProperty.name)) { + error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperty.name, typeToString(targetAttributesType)); } } } @@ -30566,7 +30795,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 147; + return s.valueDeclaration ? s.valueDeclaration.kind : 148; } function getDeclarationModifierFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0; @@ -30577,13 +30806,16 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 || node.kind === 224 ? + var errorNode = node.kind === 178 || node.kind === 225 ? node.name : node.right; if (left.kind === 96) { - if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 149) { - error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); - return false; + if (languageVersion < 2) { + var propKind = getDeclarationKindFromSymbol(prop); + if (propKind !== 150 && propKind !== 149) { + error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + return false; + } } if (flags & 128) { error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass)); @@ -30625,16 +30857,17 @@ var ts; return true; } function checkNonNullExpression(node) { - var type = checkExpression(node); - if (strictNullChecks) { - var kind = getFalsyFlags(type) & 6144; - if (kind) { - error(node, kind & 2048 ? kind & 4096 ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); - } - return getNonNullableType(type); + return checkNonNullType(checkExpression(node), node); + } + function checkNonNullType(type, errorNode) { + var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 6144; + if (kind) { + error(errorNode, kind & 2048 ? kind & 4096 ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + var t = getNonNullableType(type); + return t.flags & (6144 | 8192) ? unknownType : t; } return type; } @@ -30682,6 +30915,10 @@ var ts; } var prop = getPropertyOfType(apparentType, right.text); if (!prop) { + var stringIndexType = getIndexTypeOfType(apparentType, 0); + if (stringIndexType) { + return stringIndexType; + } if (right.text && !checkAndReportErrorForExtendingInterface(node)) { reportNonexistentProperty(right, type.flags & 16384 && type.isThisType ? apparentType : type); } @@ -30700,7 +30937,7 @@ var ts; return unknownType; } } - if (node.kind !== 177 || assignmentKind === 1 || + if (node.kind !== 178 || assignmentKind === 1 || !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 65536)) { return propType; @@ -30709,7 +30946,7 @@ var ts; return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 177 + var left = node.kind === 178 ? node.expression : node.left; var type = checkExpression(left); @@ -30723,7 +30960,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 225) { + if (initializer.kind === 226) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -30745,7 +30982,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 213 && + if (node.kind === 214 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -30763,7 +31000,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 180 && node.parent.expression === node) { + if (node.parent.kind === 181 && 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); @@ -30783,7 +31020,7 @@ var ts; error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } - return getIndexedAccessType(objectType, indexType, node); + return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node); } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) { @@ -30816,10 +31053,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 181) { + if (node.kind === 182) { checkExpression(node.template); } - else if (node.kind !== 145) { + else if (node.kind !== 146) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -30841,19 +31078,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_9 = signature.declaration && signature.declaration.parent; + var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_9 === lastParent) { + if (lastParent && parent === lastParent) { index++; } else { - lastParent = parent_9; + lastParent = parent; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_9; + lastParent = parent; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -30870,7 +31107,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 196) { + if (arg && arg.kind === 197) { return i; } } @@ -30883,11 +31120,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 181) { + if (node.kind === 182) { var tagExpression = node; argCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 194) { + if (tagExpression.template.kind === 195) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -30899,7 +31136,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 145) { + else if (node.kind === 146) { isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, undefined, signature); @@ -30907,7 +31144,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 180); + ts.Debug.assert(callExpression.kind === 181); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -30966,7 +31203,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 !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { @@ -31013,7 +31250,7 @@ var ts; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 180) { + if (thisType && thisType !== voidType && node.kind !== 181) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; @@ -31026,7 +31263,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 !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { @@ -31041,28 +31278,28 @@ var ts; return true; } function getThisArgumentOfCall(node) { - if (node.kind === 179) { + if (node.kind === 180) { var callee = node.expression; - if (callee.kind === 177) { + if (callee.kind === 178) { return callee.expression; } - else if (callee.kind === 178) { + else if (callee.kind === 179) { return callee.expression; } } } function getEffectiveCallArguments(node) { var args; - if (node.kind === 181) { + if (node.kind === 182) { var template = node.template; args = [undefined]; - if (template.kind === 194) { + if (template.kind === 195) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 145) { + else if (node.kind === 146) { return undefined; } else { @@ -31071,21 +31308,21 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 145) { + if (node.kind === 146) { switch (node.parent.kind) { - case 227: - case 197: + case 228: + case 198: return 1; - case 147: + case 148: return 2; - case 149: - case 151: + case 150: case 152: + case 153: if (languageVersion === 0) { return 2; } return signature.parameters.length >= 3 ? 3 : 2; - case 144: + case 145: return 3; } } @@ -31094,48 +31331,48 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 227) { + if (node.kind === 228) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { return getParentTypeOfClassElement(node); } ts.Debug.fail("Unsupported decorator target."); return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 227) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { return anyType; } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var element = node; switch (element.name.kind) { case 70: case 8: case 9: return getLiteralTypeForText(32, element.name.text); - case 142: + case 143: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 512)) { return nameType; @@ -31152,20 +31389,20 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 227) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { return numberType; } - if (node.kind === 147) { + if (node.kind === 148) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); } @@ -31186,26 +31423,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex) { - if (node.kind === 145) { + if (node.kind === 146) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 145 || - (argIndex === 0 && node.kind === 181)) { + if (node.kind === 146 || + (argIndex === 0 && node.kind === 182)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 145) { + if (node.kind === 146) { return node.expression; } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return node.template; } else { @@ -31213,8 +31450,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 181; - var isDecorator = node.kind === 145; + var isTaggedTemplate = node.kind === 182; + var isDecorator = node.kind === 146; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -31244,7 +31481,7 @@ var ts; var candidateForTypeArgumentError; var resultOfFailedInference; var result; - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 180 && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma); } @@ -31513,16 +31750,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 227: - case 197: + case 228: + case 198: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 144: + case 145: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 147: + case 148: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 149: - case 151: + case 150: case 152: + case 153: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -31549,13 +31786,13 @@ var ts; } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 179: - return resolveCallExpression(node, candidatesOutArray); case 180: - return resolveNewExpression(node, candidatesOutArray); + return resolveCallExpression(node, candidatesOutArray); case 181: + return resolveNewExpression(node, candidatesOutArray); + case 182: return resolveTaggedTemplateExpression(node, candidatesOutArray); - case 145: + case 146: return resolveDecorator(node, candidatesOutArray); } ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); @@ -31587,12 +31824,12 @@ var ts; if (node.expression.kind === 96) { return voidType; } - if (node.kind === 180) { + if (node.kind === 181) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 150 && - declaration.kind !== 154 && - declaration.kind !== 159 && + declaration.kind !== 151 && + declaration.kind !== 155 && + declaration.kind !== 160 && !ts.isJSDocConstructSignature(declaration)) { var funcSymbol = node.expression.kind === 70 ? getResolvedSymbol(node.expression) : @@ -31623,9 +31860,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 226 + ? 227 : resolvedRequire.flags & 3 - ? 224 + ? 225 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -31659,7 +31896,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return unknownType; } - else if (container.kind === 150) { + else if (container.kind === 151) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -31735,8 +31972,8 @@ var ts; if (!links.type) { links.type = instantiateType(contextualType, mapper); if (links.type === emptyObjectType && - (parameter.valueDeclaration.name.kind === 172 || - parameter.valueDeclaration.name.kind === 173)) { + (parameter.valueDeclaration.name.kind === 173 || + parameter.valueDeclaration.name.kind === 174)) { links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); } assignBindingElementTypes(parameter.valueDeclaration); @@ -31775,7 +32012,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 205) { + if (func.body.kind !== 206) { 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); @@ -31854,7 +32091,7 @@ var ts; return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 219 && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 220 && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; @@ -31883,7 +32120,7 @@ var ts; } }); if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || - func.kind === 184 || func.kind === 185)) { + func.kind === 185 || func.kind === 186)) { return undefined; } if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) { @@ -31900,7 +32137,7 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 205 || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 206 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256; @@ -31927,9 +32164,9 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 184) { + if (!hasGrammarError && node.kind === 185) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -31963,7 +32200,7 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 149) { + if (produceDiagnostics && node.kind !== 150) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithCapturedNewTargetVariable(node, node.name); @@ -31971,7 +32208,7 @@ var ts; return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); if (!node.asteriskToken) { @@ -31981,7 +32218,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 205) { + if (node.body.kind === 206) { checkSourceElement(node.body); } else { @@ -32016,10 +32253,10 @@ var ts; function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { if (symbol.flags & 4 && - (expr.kind === 177 || expr.kind === 178) && + (expr.kind === 178 || expr.kind === 179) && expr.expression.kind === 98) { var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 150)) + if (!(func && func.kind === 151)) return true; return !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent); } @@ -32028,13 +32265,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 177 || expr.kind === 178) { + if (expr.kind === 178 || expr.kind === 179) { var node = ts.skipParentheses(expr.expression); if (node.kind === 70) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 238; + return declaration && declaration.kind === 239; } } } @@ -32042,7 +32279,7 @@ var ts; } function checkReferenceExpression(expr, invalidReferenceMessage) { var node = ts.skipParentheses(expr); - if (node.kind !== 70 && node.kind !== 177 && node.kind !== 178) { + if (node.kind !== 70 && node.kind !== 178 && node.kind !== 179) { error(expr, invalidReferenceMessage); return false; } @@ -32051,7 +32288,7 @@ var ts; function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); - if (expr.kind !== 177 && expr.kind !== 178) { + if (expr.kind !== 178 && expr.kind !== 179) { error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } @@ -32094,6 +32331,7 @@ var ts; case 36: case 37: case 51: + checkNonNullType(operandType, node.operand); if (maybeTypeOfKind(operandType, 512)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } @@ -32105,7 +32343,7 @@ var ts; booleanType; case 42: case 43: - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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_or_a_property_access); } @@ -32118,7 +32356,7 @@ var ts; if (operandType === silentNeverType) { return silentNeverType; } - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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_or_a_property_access); } @@ -32130,8 +32368,8 @@ var ts; } if (type.flags & 196608) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var t = types_17[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -32145,8 +32383,8 @@ var ts; } if (type.flags & 65536) { var types = type.types; - for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { - var t = types_17[_i]; + for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { + var t = types_18[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -32155,8 +32393,8 @@ var ts; } if (type.flags & 131072) { var types = type.types; - for (var _a = 0, types_18 = types; _a < types_18.length; _a++) { - var t = types_18[_a]; + for (var _a = 0, types_19 = types; _a < types_19.length; _a++) { + var t = types_19[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -32177,7 +32415,10 @@ var ts; if (isTypeOfKind(leftType, 8190)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } - if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(isTypeAny(rightType) || + getSignaturesOfType(rightType, 0).length || + getSignaturesOfType(rightType, 1).length || + isTypeSubtypeOf(rightType, globalFunctionType))) { error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; @@ -32186,6 +32427,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } @@ -32203,22 +32446,22 @@ var ts; return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 258 || property.kind === 259) { - var name_21 = property.name; - if (name_21.kind === 142) { - checkComputedPropertyName(name_21); + if (property.kind === 259 || property.kind === 260) { + var name = property.name; + if (name.kind === 143) { + checkComputedPropertyName(name); } - if (isComputedNonLiteralName(name_21)) { + if (isComputedNonLiteralName(name)) { return undefined; } - var text = ts.getTextOfPropertyName(name_21); + var text = ts.getTextOfPropertyName(name); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 259) { + if (property.kind === 260) { return checkDestructuringAssignment(property, type); } else { @@ -32226,10 +32469,10 @@ var ts; } } else { - error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_21)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 260) { + else if (property.kind === 261) { if (languageVersion < 5) { checkExternalEmitHelpers(property, 4); } @@ -32257,8 +32500,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 198) { - if (element.kind !== 196) { + if (element.kind !== 199) { + if (element.kind !== 197) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -32284,7 +32527,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 192 && restExpression.operatorToken.kind === 57) { + if (restExpression.kind === 193 && restExpression.operatorToken.kind === 57) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -32297,7 +32540,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 259) { + if (exprOrAssignment.kind === 260) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -32311,21 +32554,21 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 192 && target.operatorToken.kind === 57) { + if (target.kind === 193 && target.operatorToken.kind === 57) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 176) { + if (target.kind === 177) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 175) { + if (target.kind === 176) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 260 ? + var error = target.parent.kind === 261 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -32339,35 +32582,35 @@ var ts; case 70: case 9: case 11: - case 181: - case 194: + case 182: + case 195: case 12: case 8: case 100: case 85: case 94: - case 137: - case 184: - case 197: + case 138: case 185: - case 175: + case 198: + case 186: case 176: - case 187: - case 201: + case 177: + case 188: + case 202: + case 249: case 248: - case 247: return true; - case 193: + case 194: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 192: + case 193: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 190: case 191: + case 192: switch (node.operator) { case 50: case 36: @@ -32376,9 +32619,9 @@ var ts; return true; } return false; - case 188: - case 182: - case 200: + case 189: + case 183: + case 201: default: return false; } @@ -32398,7 +32641,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 57 && (left.kind === 176 || left.kind === 175)) { + if (operator === 57 && (left.kind === 177 || left.kind === 176)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -32429,12 +32672,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); var suggestedOperator = void 0; if ((leftType.flags & 136) && (rightType.flags & 136) && @@ -32454,12 +32693,10 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + if (!isTypeOfKind(leftType, 1 | 262178) && !isTypeOfKind(rightType, 1 | 262178)) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } var resultType = void 0; if (isTypeOfKind(leftType, 340) && isTypeOfKind(rightType, 340)) { resultType = numberType; @@ -32488,8 +32725,8 @@ var ts; case 29: case 30: if (checkForDisallowedESSymbolOperand(operator)) { - leftType = getBaseTypeOfLiteralType(leftType); - rightType = getBaseTypeOfLiteralType(rightType); + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -32658,7 +32895,7 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 182 || node.kind === 200; + return node.kind === 183 || node.kind === 201; } function checkDeclarationInitializer(declaration) { var type = checkExpressionCached(declaration.initializer); @@ -32669,11 +32906,11 @@ var ts; function isLiteralContextualType(contextualType) { if (contextualType) { if (contextualType.flags & 540672) { - var apparentType = getApparentTypeOfTypeVariable(contextualType); - if (apparentType.flags & (2 | 4 | 8 | 16)) { + var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; + if (constraint.flags & (2 | 4 | 8 | 16)) { return true; } - contextualType = apparentType; + contextualType = constraint; } return maybeTypeOfKind(contextualType, (480 | 262144)); } @@ -32684,14 +32921,14 @@ var ts; return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type); } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -32713,7 +32950,7 @@ var ts; return type; } function getTypeOfExpression(node) { - if (node.kind === 179 && node.expression.kind !== 96) { + if (node.kind === 180 && node.expression.kind !== 96) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -32724,7 +32961,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 141) { + if (node.kind === 142) { type = checkQualifiedName(node); } else { @@ -32732,9 +32969,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 177 && node.parent.expression === node) || - (node.parent.kind === 178 && node.parent.expression === node) || - ((node.kind === 70 || node.kind === 141) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 178 && node.parent.expression === node) || + (node.parent.kind === 179 && node.parent.expression === node) || + ((node.kind === 70 || node.kind === 142) && 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); } @@ -32756,68 +32993,68 @@ var ts; case 100: case 85: return checkLiteralExpression(node); - case 194: + case 195: return checkTemplateExpression(node); case 12: return stringType; case 11: return globalRegExpType; - case 175: - return checkArrayLiteral(node, contextualMapper); case 176: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, contextualMapper); case 177: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, contextualMapper); case 178: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 179: + return checkIndexedAccess(node); case 180: - return checkCallExpression(node); case 181: + return checkCallExpression(node); + case 182: return checkTaggedTemplateExpression(node); - case 183: + case 184: return checkExpression(node.expression, contextualMapper); - case 197: + case 198: return checkClassExpression(node); - case 184: case 185: + case 186: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 187: + case 188: return checkTypeOfExpression(node); - case 182: - case 200: - return checkAssertion(node); + case 183: case 201: - return checkNonNullAssertion(node); + return checkAssertion(node); case 202: + return checkNonNullAssertion(node); + case 203: return checkMetaProperty(node); - case 186: + case 187: return checkDeleteExpression(node); - case 188: - return checkVoidExpression(node); case 189: - return checkAwaitExpression(node); + return checkVoidExpression(node); case 190: - return checkPrefixUnaryExpression(node); + return checkAwaitExpression(node); case 191: - return checkPostfixUnaryExpression(node); + return checkPrefixUnaryExpression(node); case 192: - return checkBinaryExpression(node, contextualMapper); + return checkPostfixUnaryExpression(node); case 193: + return checkBinaryExpression(node, contextualMapper); + case 194: return checkConditionalExpression(node, contextualMapper); - case 196: + case 197: return checkSpreadExpression(node, contextualMapper); - case 198: + case 199: return undefinedWideningType; - case 195: + case 196: return checkYieldExpression(node); - case 253: + case 254: return checkJsxExpression(node); - case 247: - return checkJsxElement(node); case 248: - return checkJsxSelfClosingElement(node); + return checkJsxElement(node); case 249: + return checkJsxSelfClosingElement(node); + case 250: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -32827,6 +33064,10 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!hasNonCircularBaseConstraint(typeParameter)) { + error(node.constraint, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + } getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); if (produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); @@ -32838,7 +33079,7 @@ var ts; var func = ts.getContainingFunction(node); if (ts.getModifierFlags(node) & 92) { func = ts.getContainingFunction(node); - if (!(func.kind === 150 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 151 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -32849,7 +33090,7 @@ var ts; if (ts.indexOf(func.parameters, node) !== 0) { error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); } - if (func.kind === 150 || func.kind === 154 || func.kind === 159) { + if (func.kind === 151 || func.kind === 155 || func.kind === 160) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } } @@ -32861,9 +33102,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 149 || - node.kind === 226 || - node.kind === 184; + return node.kind === 150 || + node.kind === 227 || + node.kind === 185; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -32904,9 +33145,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_22 = _a[_i].name; - if (ts.isBindingPattern(name_22) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, parameterName, typePredicate.parameterName)) { + var name = _a[_i].name; + if (ts.isBindingPattern(name) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -32919,16 +33160,16 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { + case 186: + case 154: + case 227: case 185: - case 153: - case 226: - case 184: - case 158: + case 159: + case 150: case 149: - case 148: - var parent_10 = node.parent; - if (node === parent_10.type) { - return parent_10; + var parent = node.parent; + if (node === parent.type) { + return parent; } } } @@ -32938,27 +33179,27 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_23 = element.name; - if (name_23.kind === 70 && - name_23.text === predicateVariableName) { + var name = element.name; + if (name.kind === 70 && + name.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_23.kind === 173 || - name_23.kind === 172) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, predicateVariableNode, predicateVariableName)) { + else if (name.kind === 174 || + name.kind === 173) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } } } } function checkSignatureDeclaration(node) { - if (node.kind === 155) { + if (node.kind === 156) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 || node.kind === 226 || node.kind === 159 || - node.kind === 153 || node.kind === 150 || - node.kind === 154) { + else if (node.kind === 159 || node.kind === 227 || node.kind === 160 || + node.kind === 154 || node.kind === 151 || + node.kind === 155) { checkGrammarFunctionLikeDeclaration(node); } if (ts.isAsyncFunctionLike(node) && languageVersion < 4) { @@ -32976,10 +33217,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 154: + case 155: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 153: + case 154: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -33010,7 +33251,7 @@ var ts; var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150) { + if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param)) { @@ -33019,18 +33260,18 @@ var ts; } } else { - var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114; }); + var isStatic = ts.getModifierFlags(member) & 32; var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { switch (member.kind) { - case 151: + case 152: addName(names, member.name, memberName, 1); break; - case 152: + case 153: addName(names, member.name, memberName, 2); break; - case 147: + case 148: addName(names, member.name, memberName, 3); break; } @@ -33038,17 +33279,38 @@ var ts; } } function addName(names, location, name, meaning) { - var prev = names[name]; + var prev = names.get(name); if (prev) { if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { - names[name] = prev | meaning; + names.set(name, prev | meaning); } } else { - names[name] = meaning; + names.set(name, meaning); + } + } + } + function checkClassForStaticPropertyNameConflicts(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var memberNameNode = member.name; + var isStatic = ts.getModifierFlags(member) & 32; + if (isStatic && memberNameNode) { + var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); + switch (memberName) { + case "name": + case "length": + case "caller": + case "arguments": + case "prototype": + var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; + var className = getNameOfSymbol(getSymbolOfNode(node)); + error(memberNameNode, message, memberName, className); + break; + } } } } @@ -33056,7 +33318,7 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind == 146) { + if (member.kind == 147) { var memberName = void 0; switch (member.name.kind) { case 9: @@ -33067,18 +33329,18 @@ var ts; default: continue; } - if (names[memberName]) { + if (names.get(memberName)) { error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName); error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName); } else { - names[memberName] = true; + names.set(memberName, true); } } } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 228) { + if (node.kind === 229) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -33093,7 +33355,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 134: + case 135: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -33160,12 +33422,12 @@ var ts; if (n.kind === 98) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 && n.kind !== 226) { + else if (n.kind !== 185 && n.kind !== 227) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 147 && + return n.kind === 148 && !(ts.getModifierFlags(n) & 32) && !!n.initializer; } @@ -33185,7 +33447,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -33208,18 +33470,18 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 151) { + if (node.kind === 152) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128)) { if (!(node.flags & 256)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); } } } - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 151 ? 152 : 151; + var otherKind = node.kind === 152 ? 153 : 152; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if ((ts.getModifierFlags(node) & 28) !== (ts.getModifierFlags(otherAccessor) & 28)) { @@ -33233,11 +33495,11 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 151) { + if (node.kind === 152) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } - if (node.parent.kind !== 176) { + if (node.parent.kind !== 177) { checkSourceElement(node.body); registerForUnusedIdentifiersCheck(node); } @@ -33318,25 +33580,42 @@ var ts; function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement); } + function checkIndexedAccessIndexType(type, accessNode) { + if (!(type.flags & 524288)) { + return type; + } + var objectType = type.objectType; + var indexType = type.indexType; + if (isTypeAssignableTo(indexType, getIndexType(objectType))) { + return type; + } + if (maybeTypeOfKind(objectType, 540672) && isTypeOfKind(indexType, 340)) { + var constraint = getBaseConstraintOfType(objectType); + if (constraint && getIndexInfoOfType(constraint, 1)) { + return type; + } + } + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return type; + } function checkIndexedAccessType(node) { - getTypeFromIndexedAccessTypeNode(node); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node) { checkSourceElement(node.typeParameter); checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 540672 ? getApparentTypeOfTypeVariable(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 228 && - n.parent.kind !== 227 && - n.parent.kind !== 197 && + if (n.parent.kind !== 229 && + n.parent.kind !== 228 && + n.parent.kind !== 198 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; @@ -33413,7 +33692,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) { - var reportError = (node.kind === 149 || node.kind === 148) && + var reportError = (node.kind === 150 || node.kind === 149) && (ts.getModifierFlags(node) & 32) !== (ts.getModifierFlags(subsequentNode) & 32); if (reportError) { var diagnostic = ts.getModifierFlags(node) & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; @@ -33446,11 +33725,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 228 || node.parent.kind === 161 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 229 || node.parent.kind === 162 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 226 || node.kind === 149 || node.kind === 148 || node.kind === 150) { + if (node.kind === 227 || node.kind === 150 || node.kind === 149 || node.kind === 151) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -33561,16 +33840,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 228: + case 229: return 2097152; - case 231: + case 232: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 227: - case 230: + case 228: + case 231: return 2097152 | 1048576; - case 235: + case 236: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -33718,22 +33997,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 227: + case 228: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 144: + case 145: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 147: + case 148: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 149: - case 151: + case 150: case 152: + case 153: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -33767,13 +34046,13 @@ var ts; } var firstDecorator = node.decorators[0]; checkExternalEmitHelpers(firstDecorator, 8); - if (node.kind === 144) { + if (node.kind === 145) { checkExternalEmitHelpers(firstDecorator, 32); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 227: + case 228: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -33782,19 +34061,19 @@ var ts; } } break; - case 149: - case 151: + case 150: case 152: + case 153: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; - case 147: + case 148: markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); break; - case 144: + case 145: markTypeNodeAsReferenced(node.type); break; } @@ -33815,7 +34094,7 @@ var ts; checkDecorators(node); checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); - if (node.name && node.name.kind === 142) { + if (node.name && node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -33857,43 +34136,43 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 262: - case 231: + case 263: + case 232: checkUnusedModuleMembers(node); break; - case 227: - case 197: + case 228: + case 198: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 228: + case 229: checkUnusedTypeParameters(node); break; - case 205: - case 233: - case 212: + case 206: + case 234: case 213: case 214: + case 215: checkUnusedLocalsAndParameters(node); break; - case 150: - case 184: - case 226: - case 185: - case 149: case 151: + case 185: + case 227: + case 186: + case 150: case 152: + case 153: if (node.body) { checkUnusedLocalsAndParameters(node); } checkUnusedTypeParameters(node); break; - case 148: - case 153: + case 149: case 154: case 155: - case 158: + case 156: case 159: + case 160: checkUnusedTypeParameters(node); break; } @@ -33902,11 +34181,10 @@ var ts; } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 228 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_2 = function (key) { - var local = node.locals[key]; + if (node.parent.kind !== 229 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + node.locals.forEach(function (local) { if (!local.isReferenced) { - if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144) { + if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 145) { var parameter = ts.getRootDeclaration(local.valueDeclaration); if (compilerOptions.noUnusedParameters && !ts.isParameterPropertyDeclaration(parameter) && @@ -33919,10 +34197,7 @@ var ts; ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); }); } } - }; - for (var key in node.locals) { - _loop_2(key); - } + }); } } function isRemovedPropertyFromObjectSpread(node) { @@ -33935,9 +34210,9 @@ var ts; function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 224 && - (declaration.parent.parent.kind === 213 || - declaration.parent.parent.kind === 214)) { + if (declaration.kind === 225 && + (declaration.parent.parent.kind === 214 || + declaration.parent.parent.kind === 215)) { return; } } @@ -33956,12 +34231,12 @@ var ts; if (node.members) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 149 || member.kind === 147) { + if (member.kind === 150 || member.kind === 148) { if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8) { error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); } } - else if (member.kind === 150) { + else if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8) { @@ -33992,8 +34267,7 @@ var ts; } function checkUnusedModuleMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { - for (var key in node.locals) { - var local = node.locals[key]; + node.locals.forEach(function (local) { if (!local.isReferenced && !local.exportSymbol) { for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; @@ -34002,11 +34276,11 @@ var ts; } } } - } + }); } } function checkBlock(node) { - if (node.kind === 205) { + if (node.kind === 206) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -34028,19 +34302,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 147 || - node.kind === 146 || + if (node.kind === 148 || + node.kind === 147 || + node.kind === 150 || node.kind === 149 || - node.kind === 148 || - node.kind === 151 || - node.kind === 152) { + node.kind === 152 || + node.kind === 153) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 144 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 145 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -34112,11 +34386,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 263 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -34124,11 +34398,11 @@ var ts; if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { + if (parent.kind === 263 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -34136,7 +34410,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 224 && !node.initializer) { + if (node.kind === 225 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -34146,25 +34420,25 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 225); - var container = varDeclList.parent.kind === 206 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 226); + var container = varDeclList.parent.kind === 207 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 205 && ts.isFunctionLike(container.parent) || + (container.kind === 206 && ts.isFunctionLike(container.parent) || + container.kind === 233 || container.kind === 232 || - container.kind === 231 || - container.kind === 262); + container.kind === 263); if (!namesShareScope) { - var name_24 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_24, name_24); + var name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 144) { + if (ts.getRootDeclaration(node).kind !== 145) { return; } var func = ts.getContainingFunction(node); @@ -34173,7 +34447,7 @@ var ts; if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { return; } - if (n.kind === 177) { + if (n.kind === 178) { return visit(n.expression); } else if (n.kind === 70) { @@ -34187,8 +34461,8 @@ var ts; } var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144 || - symbol.valueDeclaration.kind === 174) { + if (symbol.valueDeclaration.kind === 145 || + symbol.valueDeclaration.kind === 175) { if (symbol.valueDeclaration.pos < node.pos) { return; } @@ -34197,7 +34471,7 @@ var ts; if (ts.isFunctionLike(current.parent)) { return; } - if (current.parent.kind === 147 && + if (current.parent.kind === 148 && !(ts.hasModifier(current.parent, 32)) && ts.isClassLike(current.parent.parent)) { return; @@ -34219,37 +34493,37 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 174) { - if (node.parent.kind === 172 && languageVersion < 5 && !ts.isInAmbientContext(node)) { + if (node.kind === 175) { + if (node.parent.kind === 173 && languageVersion < 5 && !ts.isInAmbientContext(node)) { checkExternalEmitHelpers(node, 4); } - if (node.propertyName && node.propertyName.kind === 142) { + if (node.propertyName && node.propertyName.kind === 143) { checkComputedPropertyName(node.propertyName); } - var parent_11 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_11); - var name_25 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_25)); + var parent = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent); + var name = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name)); markPropertyAsReferenced(property); - if (parent_11.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + if (parent.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent, parent.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 144 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 145 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 213) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -34258,7 +34532,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol)); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 213) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -34276,9 +34550,9 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 147 && node.kind !== 146) { + if (node.kind !== 148 && node.kind !== 147) { checkExportsOnMergedDeclarations(node); - if (node.kind === 224 || node.kind === 174) { + if (node.kind === 225 || node.kind === 175) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -34289,8 +34563,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 && right.kind === 224) || - (left.kind === 224 && right.kind === 144)) { + if ((left.kind === 145 && right.kind === 225) || + (left.kind === 225 && right.kind === 145)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -34317,7 +34591,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 176) { + if (node.modifiers && node.parent.kind === 177) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -34336,7 +34610,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 207) { + if (node.thenStatement.kind === 208) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -34353,12 +34627,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 225) { + if (node.initializer && node.initializer.kind === 226) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 225) { + if (node.initializer.kind === 226) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -34376,13 +34650,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 225) { + if (node.initializer.kind === 226) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 175 || varExpr.kind === 176) { + if (varExpr.kind === 176 || varExpr.kind === 177) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -34401,7 +34675,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); - if (node.initializer.kind === 225) { + if (node.initializer.kind === 226) { 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); @@ -34411,7 +34685,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 175 || varExpr.kind === 176) { + if (varExpr.kind === 176 || varExpr.kind === 177) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -34587,7 +34861,7 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152))); + return !!(node.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 153))); } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; @@ -34609,30 +34883,30 @@ var ts; if (func.asteriskToken) { return; } - if (func.kind === 152) { + if (func.kind === 153) { if (node.expression) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 150) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { - error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + else if (func.kind === 151) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { - checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + checkTypeAssignableTo(awaitedType, promisedType, node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression || node); + checkTypeAssignableTo(exprType, returnType, node); } } } - else if (func.kind !== 150 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + else if (func.kind !== 151 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } } @@ -34658,7 +34932,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 255 && !hasDuplicateDefaultClause) { + if (clause.kind === 256 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -34670,7 +34944,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 254) { + if (produceDiagnostics && clause.kind === 255) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); var caseIsLiteral = isLiteralType(caseType); @@ -34696,7 +34970,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 220 && current.label.text === node.label.text) { + if (current.kind === 221 && 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; @@ -34729,14 +35003,14 @@ var ts; grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var blockLocals = catchClause.block.locals; - if (blockLocals) { - for (var caughtName in catchClause.locals) { - var blockLocal = blockLocals[caughtName]; + var blockLocals_1 = catchClause.block.locals; + if (blockLocals_1) { + ts.forEachKey(catchClause.locals, function (caughtName) { + var blockLocal = blockLocals_1.get(caughtName); if (blockLocal && (blockLocal.flags & 2) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); } - } + }); } } } @@ -34784,12 +35058,13 @@ var ts; if (!indexType) { return; } - if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { + var propDeclaration = prop.valueDeclaration; + if (indexKind === 1 && !(propDeclaration ? isNumericName(propDeclaration.name) : isNumericLiteralName(prop.name))) { return; } var errorNode; - if (prop.valueDeclaration.name.kind === 142 || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + if (propDeclaration && (propDeclaration.name.kind === 143 || prop.parent === containingType.symbol)) { + errorNode = propDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; @@ -34814,6 +35089,7 @@ var ts; case "string": case "symbol": case "void": + case "object": error(name, message, name.text); } } @@ -34839,7 +35115,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 || declaration.kind === 228) { + if (declaration.kind === 228 || declaration.kind === 229) { if (!firstDecl) { firstDecl = declaration; } @@ -34884,6 +35160,9 @@ var ts; var staticType = getTypeOfSymbol(symbol); checkTypeParameterListsIdentical(node, symbol); checkClassForDuplicateDeclarations(node); + if (!ts.isInAmbientContext(node)) { + checkClassForStaticPropertyNameConflicts(node); + } var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { if (languageVersion < 2 && !ts.isInAmbientContext(node)) { @@ -34892,7 +35171,8 @@ var ts; var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; - var staticBaseType = getBaseConstructorTypeOfClass(type); + var baseConstructorType = getBaseConstructorTypeOfClass(type); + var staticBaseType = getApparentType(baseConstructorType); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { @@ -34906,14 +35186,17 @@ var ts; } checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType_1.symbol.valueDeclaration && + if (baseConstructorType.flags & 540672 && !isMixinConstructorType(staticType)) { + error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); + } + if (baseType_1.symbol && baseType_1.symbol.valueDeclaration && !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 227) { + baseType_1.symbol.valueDeclaration.kind === 228) { if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); } } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 540672)) { var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); @@ -34933,8 +35216,7 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { - var declaredType = getObjectFlags(t) & 4 ? t.target : t; - if (getObjectFlags(declaredType) & 3) { + if (isValidBaseType(t)) { checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -34968,7 +35250,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { - var baseProperties = getPropertiesOfObjectType(baseType); + var baseProperties = getPropertiesOfType(baseType); for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); @@ -34982,7 +35264,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128))) { - if (derivedClassDecl.kind === 197) { + if (derivedClassDecl.kind === 198) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -35026,7 +35308,7 @@ var ts; } } function isAccessor(kind) { - return kind === 151 || kind === 152; + return kind === 152 || kind === 153; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -35059,16 +35341,16 @@ var ts; return true; } var seen = ts.createMap(); - ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.name, { prop: p, containingType: type }); }); var ok = true; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); + var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { var prop = properties_7[_a]; - var existing = seen[prop.name]; + var existing = seen.get(prop.name); if (!existing) { - seen[prop.name] = { prop: prop, containingType: base }; + seen.set(prop.name, { prop: prop, containingType: base }); } else { var isInheritedProperty = existing.containingType !== type; @@ -35093,7 +35375,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 228); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 229); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -35189,7 +35471,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 190: + case 191: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -35200,7 +35482,7 @@ var ts; case 51: return ~value_1; } return undefined; - case 192: + case 193: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -35226,11 +35508,11 @@ var ts; case 8: checkGrammarNumericLiteral(e); return +e.text; - case 183: + case 184: return evalConstant(e.expression); case 70: + case 179: case 178: - case 177: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -35241,7 +35523,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 178) { + if (e.kind === 179) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -35258,7 +35540,7 @@ var ts; if (current.kind === 70) { break; } - else if (current.kind === 177) { + else if (current.kind === 178) { current = current.expression; } else { @@ -35319,7 +35601,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 230) { + if (declaration.kind !== 231) { return false; } var enumDeclaration = declaration; @@ -35342,8 +35624,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 227 || - (declaration.kind === 226 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 228 || + (declaration.kind === 227 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -35402,7 +35684,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, 227); + var mergedClass = ts.getDeclarationOfKind(symbol, 228); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -35445,36 +35727,36 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 206: + case 207: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 241: case 242: + case 243: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 235: case 236: + case 237: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 174: - case 224: - var name_26 = node.name; - if (ts.isBindingPattern(name_26)) { - for (var _b = 0, _c = name_26.elements; _b < _c.length; _b++) { + case 175: + case 225: + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } - case 227: - case 230: - case 226: case 228: case 231: + case 227: case 229: + case 232: + case 230: if (isGlobalAugmentation) { return; } @@ -35492,12 +35774,12 @@ var ts; switch (node.kind) { case 70: return node; - case 141: + case 142: do { node = node.left; } while (node.kind !== 70); return node; - case 177: + case 178: do { node = node.expression; } while (node.kind !== 70); @@ -35510,9 +35792,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 262 && !inAmbientExternalModule) { - error(moduleName, node.kind === 242 ? + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 263 && !inAmbientExternalModule) { + error(moduleName, node.kind === 243 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -35533,7 +35815,7 @@ var ts; (symbol.flags & 793064 ? 793064 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 244 ? + var message = node.kind === 245 ? 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)); @@ -35560,7 +35842,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 238) { + if (importClause.namedBindings.kind === 239) { checkImportBinding(importClause.namedBindings); } else { @@ -35611,8 +35893,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 262 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 263 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -35625,7 +35907,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 262 || node.parent.kind === 232 || node.parent.kind === 231; + var isInAppropriateContext = node.parent.kind === 263 || node.parent.kind === 233 || node.parent.kind === 232; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -35648,8 +35930,8 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 262 ? node.parent : node.parent.parent; - if (container.kind === 231 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 263 ? node.parent : node.parent.parent; + if (container.kind === 232 && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -35678,18 +35960,13 @@ var ts; } } function hasExportedMembers(moduleSymbol) { - for (var id in moduleSymbol.exports) { - if (id !== "export=") { - return true; - } - } - return false; + return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; }); } function checkExternalModuleExports(node) { var moduleSymbol = getSymbolOfNode(node); var links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - var exportEqualsSymbol = moduleSymbol.exports["export="]; + var exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (!isTopLevelInExternalModuleAugmentation(declaration)) { @@ -35697,17 +35974,17 @@ var ts; } } var exports_1 = getExportsOfModule(moduleSymbol); - for (var id in exports_1) { + exports_1 && exports_1.forEach(function (_a, id) { + var declarations = _a.declarations, flags = _a.flags; if (id === "__export") { - continue; + return; } - var _a = exports_1[id], declarations = _a.declarations, flags = _a.flags; if (flags & (1920 | 64 | 384)) { - continue; + return; } var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); if (flags & 524288 && exportedDeclarationsCount <= 2) { - continue; + return; } if (exportedDeclarationsCount > 1) { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -35717,11 +35994,11 @@ var ts; } } } - } + }); links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 226 && declaration.kind !== 149) || + return (declaration.kind !== 227 && declaration.kind !== 150) || !!declaration.body; } } @@ -35732,123 +36009,123 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 231: - case 227: + case 232: case 228: - case 226: + case 229: + case 227: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 143: - return checkTypeParameter(node); case 144: + return checkTypeParameter(node); + case 145: return checkParameter(node); + case 148: case 147: - case 146: return checkPropertyDeclaration(node); - case 158: case 159: - case 153: + case 160: case 154: - return checkSignatureDeclaration(node); case 155: return checkSignatureDeclaration(node); + case 156: + return checkSignatureDeclaration(node); + case 150: case 149: - case 148: return checkMethodDeclaration(node); - case 150: - return checkConstructorDeclaration(node); case 151: + return checkConstructorDeclaration(node); case 152: + case 153: return checkAccessorDeclaration(node); - case 157: + case 158: return checkTypeReferenceNode(node); - case 156: + case 157: return checkTypePredicate(node); - case 160: - return checkTypeQuery(node); case 161: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 162: - return checkArrayType(node); + return checkTypeLiteral(node); case 163: - return checkTupleType(node); + return checkArrayType(node); case 164: + return checkTupleType(node); case 165: - return checkUnionOrIntersectionType(node); case 166: - case 168: - return checkSourceElement(node.type); + return checkUnionOrIntersectionType(node); + case 167: case 169: - return checkIndexedAccessType(node); + return checkSourceElement(node.type); case 170: + return checkIndexedAccessType(node); + case 171: return checkMappedType(node); - case 226: + case 227: return checkFunctionDeclaration(node); - case 205: - case 232: - return checkBlock(node); case 206: + case 233: + return checkBlock(node); + case 207: return checkVariableStatement(node); - case 208: - return checkExpressionStatement(node); case 209: - return checkIfStatement(node); + return checkExpressionStatement(node); case 210: - return checkDoStatement(node); + return checkIfStatement(node); case 211: - return checkWhileStatement(node); + return checkDoStatement(node); case 212: - return checkForStatement(node); + return checkWhileStatement(node); case 213: - return checkForInStatement(node); + return checkForStatement(node); case 214: - return checkForOfStatement(node); + return checkForInStatement(node); case 215: + return checkForOfStatement(node); case 216: - return checkBreakOrContinueStatement(node); case 217: - return checkReturnStatement(node); + return checkBreakOrContinueStatement(node); case 218: - return checkWithStatement(node); + return checkReturnStatement(node); case 219: - return checkSwitchStatement(node); + return checkWithStatement(node); case 220: - return checkLabeledStatement(node); + return checkSwitchStatement(node); case 221: - return checkThrowStatement(node); + return checkLabeledStatement(node); case 222: + return checkThrowStatement(node); + case 223: return checkTryStatement(node); - case 224: + case 225: return checkVariableDeclaration(node); - case 174: + case 175: return checkBindingElement(node); - case 227: - return checkClassDeclaration(node); case 228: - return checkInterfaceDeclaration(node); + return checkClassDeclaration(node); case 229: - return checkTypeAliasDeclaration(node); + return checkInterfaceDeclaration(node); case 230: - return checkEnumDeclaration(node); + return checkTypeAliasDeclaration(node); case 231: + return checkEnumDeclaration(node); + case 232: return checkModuleDeclaration(node); - case 236: + case 237: return checkImportDeclaration(node); - case 235: + case 236: return checkImportEqualsDeclaration(node); - case 242: + case 243: return checkExportDeclaration(node); - case 241: + case 242: return checkExportAssignment(node); - case 207: + case 208: checkGrammarStatementInAmbientContext(node); return; - case 223: + case 224: checkGrammarStatementInAmbientContext(node); return; - case 245: + case 246: return checkMissingDeclaration(node); } } @@ -35861,17 +36138,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 184: case 185: + case 186: + case 150: case 149: - case 148: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 151: case 152: + case 153: checkAccessorDeferred(node); break; - case 197: + case 198: checkClassExpressionDeferred(node); break; } @@ -35959,7 +36236,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 218 && node.parent.statement === node) { + if (node.parent.kind === 219 && node.parent.statement === node) { return true; } node = node.parent; @@ -35981,28 +36258,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 262: + case 263: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 231: + case 232: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 230: + case 231: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 197: + case 198: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 227: case 228: + case 229: if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793064); } break; - case 184: + case 185: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -36020,17 +36297,16 @@ var ts; function copySymbol(symbol, meaning) { if (symbol.flags & meaning) { var id = symbol.name; - if (!symbols[id]) { - symbols[id] = symbol; + if (!symbols.has(id)) { + symbols.set(id, symbol); } } } function copySymbols(source, meaning) { if (meaning) { - for (var id in source) { - var symbol = source[id]; + source.forEach(function (symbol) { copySymbol(symbol, meaning); - } + }); } } } @@ -36041,27 +36317,27 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 143: - case 227: + case 144: case 228: case 229: case 230: + case 231: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 141) { + while (node.parent && node.parent.kind === 142) { node = node.parent; } - return node.parent && (node.parent.kind === 157 || node.parent.kind === 273); + return node.parent && (node.parent.kind === 158 || node.parent.kind === 274); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 177) { + while (node.parent && node.parent.kind === 178) { node = node.parent; } - return node.parent && node.parent.kind === 199; + return node.parent && node.parent.kind === 200; } function forEachEnclosingClass(node, callback) { var result; @@ -36078,13 +36354,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 141) { + while (nodeOnRightSide.parent.kind === 142) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 235) { + if (nodeOnRightSide.parent.kind === 236) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 241) { + if (nodeOnRightSide.parent.kind === 242) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -36096,7 +36372,7 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 178) { var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); switch (specialPropertyAssignmentKind) { case 1: @@ -36108,11 +36384,11 @@ var ts; default: } } - if (entityName.parent.kind === 241 && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 242 && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608); } - if (entityName.kind !== 177 && isInRightSideOfImportOrExportAssignment(entityName)) { - var importEqualsDeclaration = ts.getAncestor(entityName, 235); + if (entityName.kind !== 178 && isInRightSideOfImportOrExportAssignment(entityName)) { + var importEqualsDeclaration = ts.getAncestor(entityName, 236); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true); } @@ -36121,7 +36397,7 @@ var ts; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 199) { + if (entityName.parent.kind === 200) { meaning = 793064; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 107455; @@ -36143,14 +36419,14 @@ var ts; } return resolveEntityName(entityName, 107455, false, true); } - else if (entityName.kind === 177) { + else if (entityName.kind === 178) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 141) { + else if (entityName.kind === 142) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -36159,19 +36435,19 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 273) ? 793064 : 1920; + var meaning = (entityName.parent.kind === 158 || entityName.parent.kind === 274) ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 251) { + else if (entityName.parent.kind === 252) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 156) { + if (entityName.parent.kind === 157) { return resolveEntityName(entityName, 1); } return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 262) { + if (node.kind === 263) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -36187,8 +36463,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 174 && - node.parent.parent.kind === 172 && + else if (node.parent.kind === 175 && + node.parent.parent.kind === 173 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -36199,8 +36475,8 @@ var ts; } switch (node.kind) { case 70: - case 177: - case 141: + case 178: + case 142: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 98: var container = ts.getThisContainer(node, false); @@ -36213,18 +36489,18 @@ var ts; case 96: var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 167: + case 168: return getTypeFromTypeNode(node).symbol; case 122: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 150) { + if (constructorDeclaration && constructorDeclaration.kind === 151) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 236 || node.parent.kind === 242) && + ((node.parent.kind === 237 || node.parent.kind === 243) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -36232,7 +36508,7 @@ var ts; return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 178 && node.parent.argumentExpression === node) { + if (node.parent.kind === 179 && node.parent.argumentExpression === node) { var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -36246,7 +36522,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 259) { + if (location && location.kind === 260) { return resolveEntityName(location.name, 107455 | 8388608); } return undefined; @@ -36296,20 +36572,20 @@ var ts; return unknownType; } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 176 || expr.kind === 175); - if (expr.parent.kind === 214) { + ts.Debug.assert(expr.kind === 177 || expr.kind === 176); + if (expr.parent.kind === 215) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 192) { + if (expr.parent.kind === 193) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 258) { + if (expr.parent.kind === 259) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } - ts.Debug.assert(expr.parent.kind === 175); + ts.Debug.assert(expr.parent.kind === 176); var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); @@ -36335,8 +36611,8 @@ var ts; var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { - if (!propsByName[p.name]) { - propsByName[p.name] = p; + if (!propsByName.has(p.name)) { + propsByName.set(p.name, p); } }); } @@ -36345,9 +36621,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols_3 = []; - var name_27 = symbol.name; + var name_2 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_27); + var symbol = getPropertyOfType(t, name_2); if (symbol) { symbols_3.push(symbol); } @@ -36359,6 +36635,9 @@ var ts; var links = symbol; return [links.leftSpread, links.rightSpread]; } + if (symbol.mappedTypeOrigin) { + return getRootSymbols(symbol.mappedTypeOrigin); + } var target = void 0; var next = symbol; while (next = getSymbolLinks(next).target) { @@ -36374,7 +36653,8 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - return getReferencedValueSymbol(node) === argumentsSymbol; + var isPropertyName_1 = node.parent.kind === 178 && node.parent.name === node; + return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } return false; @@ -36390,7 +36670,7 @@ var ts; if (symbolLinks.exportsSomeValue === undefined) { symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 107455) - : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue); + : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; function isValue(s) { @@ -36416,7 +36696,7 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 262) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 263) { var symbolFile = parentSymbol.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -36454,7 +36734,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 205 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 206 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -36494,16 +36774,16 @@ var ts; return true; } switch (node.kind) { - case 235: - case 237: + case 236: case 238: - case 240: - case 244: + case 239: + case 241: + case 245: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 242: + case 243: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 241: + case 242: return node.expression && node.expression.kind === 70 ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -36513,7 +36793,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 262 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 263 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -36564,7 +36844,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 261) { + if (node.kind === 262) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -36580,15 +36860,17 @@ var ts; } function getTypeReferenceSerializationKind(typeName, location) { var valueSymbol = resolveEntityName(typeName, 107455, true, false, location); - var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); - if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { - return ts.TypeReferenceSerializationKind.Promise; - } - var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; - if (constructorType && isConstructorType(constructorType)) { - return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; - } var typeSymbol = resolveEntityName(typeName, 793064, true, false, location); + if (valueSymbol && valueSymbol === typeSymbol) { + var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return ts.TypeReferenceSerializationKind.Promise; + } + var constructorType = getTypeOfSymbol(valueSymbol); + if (constructorType && isConstructorType(constructorType)) { + return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + } if (!typeSymbol) { return ts.TypeReferenceSerializationKind.ObjectType; } @@ -36649,7 +36931,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); } function hasGlobalName(name) { - return !!globals[name]; + return globals.has(name); } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; @@ -36658,9 +36940,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_12 = reference.parent; - if (ts.isDeclaration(parent_12) && reference === parent_12.name) { - location = getDeclarationContainer(parent_12); + var parent = reference.parent; + if (ts.isDeclaration(parent) && reference === parent.name) { + location = getDeclarationContainer(parent); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -36693,14 +36975,13 @@ var ts; var fileToDirective; if (resolvedTypeReferenceDirectives) { fileToDirective = ts.createFileMap(); - for (var key in resolvedTypeReferenceDirectives) { - var resolvedDirective = resolvedTypeReferenceDirectives[key]; + resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (!resolvedDirective) { - continue; + return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key); - } + }); } return { getReferencedExportContainer: getReferencedExportContainer, @@ -36738,7 +37019,7 @@ var ts; if (!fileToDirective) { return undefined; } - var meaning = (node.kind === 177) || (node.kind === 70 && isInTypeQuery(node)) + var meaning = (node.kind === 178) || (node.kind === 70 && isInTypeQuery(node)) ? 107455 | 1048576 : 793064 | 1920; var symbol = resolveEntityName(node, meaning, true); @@ -36773,15 +37054,15 @@ var ts; } var current = symbol; while (true) { - var parent_13 = getParentOfSymbol(current); - if (parent_13) { - current = parent_13; + var parent = getParentOfSymbol(current); + if (parent) { + current = parent; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 262 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 263 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -36800,7 +37081,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 262); + return ts.getDeclarationOfKind(moduleSymbol, 263); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -36821,11 +37102,11 @@ var ts; } if (file.symbol && file.symbol.globalExports) { var source = file.symbol.globalExports; - for (var id in source) { - if (!(id in globals)) { - globals[id] = source[id]; + source.forEach(function (sourceSymbol, id) { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); } - } + }); } } if (augmentations) { @@ -36891,10 +37172,10 @@ var ts; var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; for (var helper = 1; helper <= 128; helper <<= 1) { if (uncheckedHelpers & helper) { - var name_28 = getHelperName(helper); - var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_28), 107455); + var name = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name), 107455); if (!symbol) { - error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_28); + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); } } } @@ -36943,14 +37224,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 149 && !ts.nodeIsPresent(node.body)) { + if (node.kind === 150 && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 151 || node.kind === 152) { + else if (node.kind === 152 || node.kind === 153) { 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); @@ -36968,16 +37249,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 130) { - if (node.kind === 146 || node.kind === 148) { + if (node.kind === 147 || node.kind === 149) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 155) { + if (node.kind === 156) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 75: - if (node.kind !== 230 && node.parent.kind === 227) { + if (node.kind !== 231 && node.parent.kind === 228) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75)); } break; @@ -37003,7 +37284,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 232 || node.parent.kind === 262) { + else if (node.parent.kind === 233 || node.parent.kind === 263) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -37026,10 +37307,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 232 || node.parent.kind === 262) { + else if (node.parent.kind === 233 || node.parent.kind === 263) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128) { @@ -37042,7 +37323,7 @@ var ts; if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 147 && node.kind !== 146 && node.kind !== 155 && node.kind !== 144) { + else if (node.kind !== 148 && node.kind !== 147 && node.kind !== 156 && node.kind !== 145) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64; @@ -37061,10 +37342,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -37076,13 +37357,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 232) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 233) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -37092,14 +37373,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 227) { - if (node.kind !== 149 && - node.kind !== 147 && - node.kind !== 151 && - node.kind !== 152) { + if (node.kind !== 228) { + if (node.kind !== 150 && + node.kind !== 148 && + node.kind !== 152 && + node.kind !== 153) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 227 && ts.getModifierFlags(node.parent) & 128)) { + if (!(node.parent.kind === 228 && ts.getModifierFlags(node.parent) & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -37118,7 +37399,7 @@ var ts; 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 === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256; @@ -37126,7 +37407,7 @@ var ts; break; } } - if (node.kind === 150) { + if (node.kind === 151) { if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -37141,13 +37422,13 @@ var ts; } return; } - else if ((node.kind === 236 || node.kind === 235) && flags & 2) { + else if ((node.kind === 237 || node.kind === 236) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 144 && (flags & 92) && ts.isBindingPattern(node.name)) { + else if (node.kind === 145 && (flags & 92) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 144 && (flags & 92) && node.dotDotDotToken) { + else if (node.kind === 145 && (flags & 92) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256) { @@ -37163,37 +37444,37 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 151: case 152: - case 150: + case 153: + case 151: + case 148: case 147: - case 146: + case 150: case 149: - case 148: - case 155: - case 231: + case 156: + case 232: + case 237: case 236: - case 235: + case 243: case 242: - case 241: - case 184: case 185: - case 144: + case 186: + case 145: return false; default: - if (node.parent.kind === 232 || node.parent.kind === 262) { + if (node.parent.kind === 233 || node.parent.kind === 263) { return false; } switch (node.kind) { - case 226: - return nodeHasAnyModifiersExcept(node, 119); case 227: - return nodeHasAnyModifiersExcept(node, 116); + return nodeHasAnyModifiersExcept(node, 119); case 228: - case 206: + return nodeHasAnyModifiersExcept(node, 116); case 229: - return true; + case 207: case 230: + return true; + case 231: return nodeHasAnyModifiersExcept(node, 75); default: ts.Debug.fail(); @@ -37206,10 +37487,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 149: - case 226: - case 184: + case 150: + case 227: case 185: + case 186: if (!node.asteriskToken) { return false; } @@ -37271,7 +37552,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 185) { + if (node.kind === 186) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -37306,7 +37587,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 !== 134 && parameter.type.kind !== 132) { + if (parameter.type.kind !== 135 && parameter.type.kind !== 132) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -37333,7 +37614,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { var arg = args_4[_i]; - if (arg.kind === 198) { + if (arg.kind === 199) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -37403,19 +37684,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 142) { + if (node.kind !== 143) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 192 && computedPropertyName.expression.operatorToken.kind === 25) { + if (computedPropertyName.expression.kind === 193 && computedPropertyName.expression.operatorToken.kind === 25) { 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 === 226 || - node.kind === 184 || - node.kind === 149); + ts.Debug.assert(node.kind === 227 || + node.kind === 185 || + node.kind === 150); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -37440,66 +37721,66 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 260) { + if (prop.kind === 261) { continue; } - var name_29 = prop.name; - if (name_29.kind === 142) { - checkGrammarComputedPropertyName(name_29); + var name = prop.name; + if (name.kind === 143) { + checkGrammarComputedPropertyName(name); } - if (prop.kind === 259 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 260 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (mod.kind !== 119 || prop.kind !== 149) { + if (mod.kind !== 119 || prop.kind !== 150) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } } var currentKind = void 0; - if (prop.kind === 258 || prop.kind === 259) { + if (prop.kind === 259 || prop.kind === 260) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_29.kind === 8) { - checkGrammarNumericLiteral(name_29); + if (name.kind === 8) { + checkGrammarNumericLiteral(name); } currentKind = Property; } - else if (prop.kind === 149) { + else if (prop.kind === 150) { currentKind = Property; } - else if (prop.kind === 151) { + else if (prop.kind === 152) { currentKind = GetAccessor; } - else if (prop.kind === 152) { + else if (prop.kind === 153) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_29); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name); if (effectiveName === undefined) { continue; } - if (!seen[effectiveName]) { - seen[effectiveName] = currentKind; + var existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); } else { - var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_29, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_29)); + grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[effectiveName] = currentKind | existingKind; + seen.set(effectiveName, currentKind | existingKind); } else { - return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -37508,19 +37789,19 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 252) { + if (attr.kind === 253) { continue; } var jsxAttr = attr; - var name_30 = jsxAttr.name; - if (!seen[name_30.text]) { - seen[name_30.text] = true; + var name = jsxAttr.name; + if (!seen.get(name.text)) { + seen.set(name.text, true); } else { - return grammarErrorOnNode(name_30, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 253 && !initializer.expression) { + if (initializer && initializer.kind === 254 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -37529,7 +37810,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 225) { + if (forInOrOfStatement.initializer.kind === 226) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -37537,20 +37818,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 213 + var diagnostic = forInOrOfStatement.kind === 214 ? 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 = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 213 + var diagnostic = forInOrOfStatement.kind === 214 ? 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 === 213 + var diagnostic = forInOrOfStatement.kind === 214 ? 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); @@ -37577,11 +37858,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 151 ? + return grammarErrorOnNode(accessor.name, kind === 152 ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 152) { + else if (kind === 153) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -37600,10 +37881,10 @@ var ts; } } function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 152 ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 151 ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 152 ? 1 : 2)) { return ts.getThisParameter(accessor); } } @@ -37618,7 +37899,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 176) { + if (node.parent.kind === 177) { if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } @@ -37634,10 +37915,10 @@ 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 === 228) { + else if (node.parent.kind === 229) { 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 === 161) { + else if (node.parent.kind === 162) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -37648,9 +37929,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 220: + case 221: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 215 + var isMisplacedContinueLabel = node.kind === 216 && !ts.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); @@ -37658,8 +37939,8 @@ var ts; return false; } break; - case 219: - if (node.kind === 216 && !node.label) { + case 220: + if (node.kind === 217 && !node.label) { return false; } break; @@ -37672,13 +37953,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 216 + var message = node.kind === 217 ? 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 === 216 + var message = node.kind === 217 ? 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); @@ -37690,7 +37971,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 173 || node.name.kind === 172) { + if (node.name.kind === 174 || node.name.kind === 173) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -37700,11 +37981,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 || expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 213 && node.parent.parent.kind !== 214) { + if (node.parent.parent.kind !== 214 && node.parent.parent.kind !== 215) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -37761,15 +38042,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 209: case 210: case 211: - case 218: case 212: + case 219: case 213: case 214: + case 215: return false; - case 220: + case 221: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -37831,7 +38112,7 @@ var ts; return true; } } - else if (node.parent.kind === 228) { + else if (node.parent.kind === 229) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -37839,7 +38120,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 161) { + else if (node.parent.kind === 162) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -37852,13 +38133,13 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 228 || - node.kind === 229 || + if (node.kind === 229 || + node.kind === 230 || + node.kind === 237 || node.kind === 236 || - node.kind === 235 || + node.kind === 243 || node.kind === 242 || - node.kind === 241 || - node.kind === 234 || + node.kind === 235 || ts.getModifierFlags(node) & (2 | 1 | 512)) { return false; } @@ -37867,7 +38148,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 === 206) { + if (ts.isDeclaration(decl) || decl.kind === 207) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -37886,7 +38167,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 === 205 || node.parent.kind === 232 || node.parent.kind === 262) { + if (node.parent.kind === 206 || node.parent.kind === 233 || node.parent.kind === 263) { 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); @@ -37902,10 +38183,10 @@ var ts; if (languageVersion >= 1) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 171)) { + else if (ts.isChildOfNodeWithKind(node, 172)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 261)) { + else if (ts.isChildOfNodeWithKind(node, 262)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -37925,11 +38206,11 @@ var ts; } function getAmbientModules() { var result = []; - for (var sym in globals) { + globals.forEach(function (global, sym) { if (ambientModuleSymbolRegex.test(sym)) { - result.push(globals[sym]); + result.push(global); } - } + }); return result; } } @@ -37938,54 +38219,56 @@ var ts; var ts; (function (ts) { ; - var nodeEdgeTraversalMap = ts.createMap((_a = {}, - _a[141] = [ - { name: "left", test: ts.isEntityName }, - { name: "right", test: ts.isIdentifier } - ], - _a[145] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[182] = [ - { name: "type", test: ts.isTypeNode }, - { name: "expression", test: ts.isUnaryExpression } - ], - _a[200] = [ - { name: "expression", test: ts.isExpression }, - { name: "type", test: ts.isTypeNode } - ], - _a[201] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[230] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "members", test: ts.isEnumMember } - ], - _a[231] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isModuleName }, - { name: "body", test: ts.isModuleBody } - ], - _a[232] = [ - { name: "statements", test: ts.isStatement } - ], - _a[235] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "moduleReference", test: ts.isModuleReference } - ], - _a[246] = [ - { name: "expression", test: ts.isExpression, optional: true } - ], - _a[261] = [ - { name: "name", test: ts.isPropertyName }, - { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } - ], - _a)); + function getNodeEdgeTraversal(kind) { + switch (kind) { + case 142: return [ + { name: "left", test: ts.isEntityName }, + { name: "right", test: ts.isIdentifier } + ]; + case 146: return [ + { name: "expression", test: ts.isLeftHandSideExpression } + ]; + case 183: return [ + { name: "type", test: ts.isTypeNode }, + { name: "expression", test: ts.isUnaryExpression } + ]; + case 201: return [ + { name: "expression", test: ts.isExpression }, + { name: "type", test: ts.isTypeNode } + ]; + case 202: return [ + { name: "expression", test: ts.isLeftHandSideExpression } + ]; + case 231: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "members", test: ts.isEnumMember } + ]; + case 232: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isModuleName }, + { name: "body", test: ts.isModuleBody } + ]; + case 233: return [ + { name: "statements", test: ts.isStatement } + ]; + case 236: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "moduleReference", test: ts.isModuleReference } + ]; + case 247: return [ + { name: "expression", test: ts.isExpression, optional: true } + ]; + case 262: return [ + { name: "name", test: ts.isPropertyName }, + { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } + ]; + } + } function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } @@ -37999,41 +38282,41 @@ var ts; var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; var cbNodes = cbNodeArray || cbNode; var kind = node.kind; - if ((kind > 0 && kind <= 140)) { + if ((kind > 0 && kind <= 141)) { return initial; } - if ((kind >= 156 && kind <= 171)) { + if ((kind >= 157 && kind <= 172)) { return initial; } var result = initial; switch (node.kind) { - case 204: - case 207: - case 198: - case 223: - case 294: + case 205: + case 208: + case 199: + case 224: + case 295: break; - case 142: + case 143: result = reduceNode(node.expression, cbNode, result); break; - case 144: + case 145: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 145: + case 146: result = reduceNode(node.expression, cbNode, result); break; - case 147: + case 148: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 149: + case 150: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38042,12 +38325,12 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 150: + case 151: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 151: + case 152: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38055,51 +38338,51 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 152: + case 153: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 172: case 173: + case 174: result = reduceNodes(node.elements, cbNodes, result); break; - case 174: + case 175: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 175: + case 176: result = reduceNodes(node.elements, cbNodes, result); break; - case 176: + case 177: result = reduceNodes(node.properties, cbNodes, result); break; - case 177: + case 178: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 178: + case 179: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.argumentExpression, cbNode, result); break; - case 179: + case 180: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 180: + case 181: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 181: + case 182: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 184: + case 185: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -38107,117 +38390,117 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 185: + case 186: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 183: - case 186: + case 184: case 187: case 188: case 189: - case 195: + case 190: case 196: - case 201: + case 197: + case 202: result = reduceNode(node.expression, cbNode, result); break; - case 190: case 191: + case 192: result = reduceNode(node.operand, cbNode, result); break; - case 192: + case 193: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 193: + case 194: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 194: + case 195: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 197: + case 198: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 199: + case 200: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 203: + case 204: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; - case 205: + case 206: result = reduceNodes(node.statements, cbNodes, result); break; - case 206: + case 207: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 208: + case 209: result = reduceNode(node.expression, cbNode, result); break; - case 209: + case 210: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 210: + case 211: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 211: - case 218: + case 212: + case 219: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212: + case 213: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 213: case 214: + case 215: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 217: - case 221: + case 218: + case 222: result = reduceNode(node.expression, cbNode, result); break; - case 219: + case 220: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 220: + case 221: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 222: + case 223: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 224: + case 225: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 225: + case 226: result = reduceNodes(node.declarations, cbNodes, result); break; - case 226: + case 227: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38226,7 +38509,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 227: + case 228: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38234,96 +38517,96 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 233: + case 234: result = reduceNodes(node.clauses, cbNodes, result); break; - case 236: + case 237: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 237: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.namedBindings, cbNode, result); - break; case 238: result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); break; case 239: - case 243: - result = reduceNodes(node.elements, cbNodes, result); + result = reduceNode(node.name, cbNode, result); break; case 240: case 244: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 241: + case 245: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 241: + case 242: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 242: + case 243: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 247: + case 248: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 248: case 249: + case 250: result = reduceNode(node.tagName, cbNode, result); result = reduceNodes(node.attributes, cbNodes, result); break; - case 250: + case 251: result = reduceNode(node.tagName, cbNode, result); break; - case 251: + case 252: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 252: - result = reduceNode(node.expression, cbNode, result); - break; case 253: result = reduceNode(node.expression, cbNode, result); break; case 254: result = reduceNode(node.expression, cbNode, result); + break; case 255: + result = reduceNode(node.expression, cbNode, result); + case 256: result = reduceNodes(node.statements, cbNodes, result); break; - case 256: + case 257: result = reduceNodes(node.types, cbNodes, result); break; - case 257: + case 258: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; - case 258: + case 259: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 259: + case 260: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 260: + case 261: result = reduceNode(node.expression, cbNode, result); break; - case 262: + case 263: result = reduceNodes(node.statements, cbNodes, result); break; - case 295: + case 296: result = reduceNode(node.expression, cbNode, result); break; default: - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + var edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) { var edge = edgeTraversalPath_1[_i]; @@ -38453,183 +38736,183 @@ var ts; return undefined; } var kind = node.kind; - if ((kind > 0 && kind <= 140)) { + if ((kind > 0 && kind <= 141)) { return node; } - if ((kind >= 156 && kind <= 171)) { + if ((kind >= 157 && kind <= 172)) { return node; } switch (node.kind) { - case 204: - case 207: - case 198: - case 223: + case 205: + case 208: + case 199: + case 224: return node; - case 142: + case 143: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); - case 144: + case 145: return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 147: + case 148: return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 149: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 150: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); + return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 151: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); case 152: + return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + case 153: return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 172: - return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); case 173: - return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); + return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); case 174: - return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); + return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); case 175: - return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); + return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); case 176: - return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); + return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); case 177: - return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); case 178: - return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); + return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); case 179: - return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); case 180: - return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); case 181: + return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + case 182: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 183: - return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 184: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 185: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 186: - return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); case 187: - return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 188: - return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); case 189: + return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + case 190: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 192: + case 193: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); - case 190: - return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); case 191: + return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); + case 192: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 193: - return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); case 194: - return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); + return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); case 195: - return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); case 196: - return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); case 197: + return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + case 198: return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 199: + case 200: return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 203: + case 204: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 205: - return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); case 206: + return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); + case 207: return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 208: - return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 209: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 210: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); case 211: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); case 212: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 213: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 214: - return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 215: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 216: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 217: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 218: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); case 219: - return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 220: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); case 221: - return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 222: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + case 223: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true)); - case 224: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 225: - return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 226: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); case 227: + return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + case 228: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 233: + case 234: return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 236: - return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 237: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); + return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 238: - return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); case 239: - return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); case 240: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); case 241: - return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); case 242: - return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); + return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); case 243: - return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); case 244: + return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + case 245: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); - case 247: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 248: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 249: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 250: - return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 251: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); case 252: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 253: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 254: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 255: - return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); case 256: - return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); + return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); case 257: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); case 258: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); case 259: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 260: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 261: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); - case 262: + case 263: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 295: + case 296: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + var edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) { var edge = edgeTraversalPath_2[_i]; @@ -38713,7 +38996,7 @@ var ts; return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { - if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 199)) { + if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 200)) { return 0; } return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); @@ -38761,7 +39044,6 @@ var ts; } } })(Debug = ts.Debug || (ts.Debug = {})); - var _a; })(ts || (ts = {})); var ts; (function (ts) { @@ -38856,10 +39138,10 @@ var ts; } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { - var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_31 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; - var variable = ts.createVariableDeclaration(name_31, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location); variable.original = original; - if (ts.isIdentifier(name_31)) { + if (ts.isIdentifier(name)) { ts.setEmitFlags(variable, 64); } ts.aggregateTransformFlags(variable); @@ -39005,8 +39287,8 @@ var ts; return ts.createElementAccess(value, argumentExpression); } else { - var name_32 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); - return ts.createPropertyAccess(value, name_32); + var name = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name); } } function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { @@ -39083,8 +39365,8 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); context.enableSubstitution(178); + context.enableSubstitution(179); var currentSourceFile; var currentNamespace; var currentNamespaceContainerName; @@ -39117,15 +39399,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 262: + case 263: + case 234: case 233: - case 232: - case 205: + case 206: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; + case 228: case 227: - case 226: if (ts.hasModifier(node, 2)) { break; } @@ -39150,13 +39432,13 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 236: + case 237: return visitImportDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); - case 241: - return visitExportAssignment(node); case 242: + return visitExportAssignment(node); + case 243: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -39166,11 +39448,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 242 || - node.kind === 236 || + if (node.kind === 243 || node.kind === 237 || - (node.kind === 235 && - node.moduleReference.kind === 246)) { + node.kind === 238 || + (node.kind === 236 && + node.moduleReference.kind === 247)) { return undefined; } else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) { @@ -39186,15 +39468,15 @@ var ts; } function classElementVisitorWorker(node) { switch (node.kind) { - case 150: - return undefined; - case 147: - case 155: case 151: + return undefined; + case 148: + case 156: case 152: - case 149: + case 153: + case 150: return visitorWorker(node); - case 204: + case 205: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -39225,23 +39507,22 @@ var ts; case 75: case 123: case 130: - case 162: case 163: - case 161: - case 156: - case 143: + case 164: + case 162: + case 157: + case 144: case 118: case 121: - case 134: + case 135: case 132: case 129: case 104: - case 135: + case 136: + case 160: case 159: + case 161: case 158: - case 160: - case 157: - case 164: case 165: case 166: case 167: @@ -39249,57 +39530,58 @@ var ts; case 169: case 170: case 171: - case 155: - case 145: - case 229: - case 147: + case 172: + case 156: + case 146: + case 230: + case 148: return undefined; - case 150: + case 151: return visitConstructor(node); - case 228: + case 229: return ts.createNotEmittedStatement(node); - case 227: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 256: + case 257: return visitHeritageClause(node); - case 199: + case 200: return visitExpressionWithTypeArguments(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: - return visitGetAccessor(node); case 152: + return visitGetAccessor(node); + case 153: return visitSetAccessor(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: + case 145: return visitParameter(node); - case 183: + case 184: return visitParenthesizedExpression(node); - case 182: - case 200: + case 183: + case 201: return visitAssertionExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 201: + case 202: return visitNonNullExpression(node); - case 230: + case 231: return visitEnumDeclaration(node); - case 206: + case 207: return visitVariableStatement(node); - case 224: + case 225: return visitVariableDeclaration(node); - case 231: + case 232: return visitModuleDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); default: ts.Debug.failBadSyntaxKind(node); @@ -39453,7 +39735,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -39487,7 +39769,7 @@ var ts; return isInitializedProperty(member, false); } function isInitializedProperty(member, isStatic) { - return member.kind === 147 + return member.kind === 148 && isStatic === ts.hasModifier(member, 32) && member.initializer !== undefined; } @@ -39560,12 +39842,12 @@ var ts; } function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { - case 151: case 152: + case 153: return getAllDecoratorsOfAccessors(node, member); - case 149: + case 150: return getAllDecoratorsOfMethod(member); - case 147: + case 148: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -39644,7 +39926,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, true); var descriptor = languageVersion > 0 - ? member.kind === 147 + ? member.kind === 148 ? ts.createVoidZero() : ts.createNull() : undefined; @@ -39728,37 +40010,37 @@ var ts; } function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 149 - || kind === 151 + return kind === 150 || kind === 152 - || kind === 147; + || kind === 153 + || kind === 148; } function shouldAddReturnTypeMetadata(node) { - return node.kind === 149; + return node.kind === 150; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 227: - case 197: + case 228: + case 198: return ts.getFirstConstructorWithBody(node) !== undefined; - case 149: - case 151: + case 150: case 152: + case 153: return true; } return false; } function serializeTypeOfNode(node) { switch (node.kind) { - case 147: - case 144: - case 151: - return serializeTypeNode(node.type); + case 148: + case 145: case 152: + return serializeTypeNode(node.type); + case 153: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 227: - case 197: - case 149: + case 228: + case 198: + case 150: return ts.createIdentifier("Function"); default: return ts.createVoidZero(); @@ -39790,7 +40072,7 @@ var ts; return ts.createArrayLiteral(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 151) { + if (container && node.kind === 152) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -39813,24 +40095,24 @@ var ts; } switch (node.kind) { case 104: - case 137: + case 138: case 94: case 129: return ts.createVoidZero(); - case 166: + case 167: return serializeTypeNode(node.type); - case 158: case 159: + case 160: return ts.createIdentifier("Function"); - case 162: case 163: + case 164: return ts.createIdentifier("Array"); - case 156: + case 157: case 121: return ts.createIdentifier("Boolean"); - case 134: + case 135: return ts.createIdentifier("String"); - case 171: + case 172: switch (node.literal.kind) { case 9: return ts.createIdentifier("String"); @@ -39846,22 +40128,22 @@ var ts; break; case 132: return ts.createIdentifier("Number"); - case 135: + case 136: return languageVersion < 2 ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); - case 157: + case 158: return serializeTypeReferenceNode(node); + case 166: case 165: - case 164: return serializeUnionOrIntersectionType(node); - case 160: - case 168: + case 161: case 169: case 170: - case 161: + case 171: + case 162: case 118: - case 167: + case 168: break; default: ts.Debug.failBadSyntaxKind(node); @@ -39929,15 +40211,15 @@ var ts; function serializeEntityNameAsExpression(node, useFallback) { switch (node.kind) { case 70: - var name_33 = ts.getMutableClone(node); - name_33.flags &= ~8; - name_33.original = undefined; - name_33.parent = currentScope; + var name = ts.getMutableClone(node); + name.flags &= ~8; + name.original = undefined; + name.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_33), ts.createLiteral("undefined")), name_33); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name); } - return name_33; - case 141: + return name; + case 142: return serializeQualifiedNameAsExpression(node, useFallback); } } @@ -40200,16 +40482,16 @@ var ts; if (!currentScopeFirstDeclarationsOfName) { currentScopeFirstDeclarationsOfName = ts.createMap(); } - if (!(name in currentScopeFirstDeclarationsOfName)) { - currentScopeFirstDeclarationsOfName[name] = node; + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_34 = node.symbol && node.symbol.name; - if (name_34) { - return currentScopeFirstDeclarationsOfName[name_34] === node; + var name = node.symbol && node.symbol.name; + if (name) { + return currentScopeFirstDeclarationsOfName.get(name) === node; } } return false; @@ -40221,7 +40503,7 @@ var ts; ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 230) { + if (node.kind === 231) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -40281,7 +40563,7 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 232) { + if (body.kind === 233) { saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; @@ -40304,13 +40586,13 @@ var ts; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); - if (body.kind !== 232) { + if (body.kind !== 233) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 231) { + if (moduleDeclaration.body.kind === 232) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -40330,7 +40612,7 @@ var ts; return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 238) { + if (node.kind === 239) { return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } else { @@ -40458,22 +40740,22 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(70); - classAliases = ts.createMap(); + classAliases = []; } } function enableSubstitutionForNamespaceExports() { if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(70); - context.enableSubstitution(259); - context.enableEmitNotification(231); + context.enableSubstitution(260); + context.enableEmitNotification(232); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 231; + return ts.getOriginalNode(node).kind === 232; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 230; + return ts.getOriginalNode(node).kind === 231; } function onEmitNode(emitContext, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; @@ -40498,14 +40780,14 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2) { - var name_35 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_35); + var name = node.name; + var exportedName = trySubstituteNamespaceExportedName(name); if (exportedName) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_35, initializer, node); + return ts.createPropertyAssignment(name, initializer, node); } - return ts.createPropertyAssignment(name_35, exportedName, node); + return ts.createPropertyAssignment(name, exportedName, node); } } return node; @@ -40514,9 +40796,9 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 177: - return substitutePropertyAccessExpression(node); case 178: + return substitutePropertyAccessExpression(node); + case 179: return substituteElementAccessExpression(node); } return node; @@ -40546,9 +40828,9 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 262) { - var substitute = (applicableSubstitutions & 2 && container.kind === 231) || - (applicableSubstitutions & 8 && container.kind === 230); + if (container && container.kind !== 263) { + var substitute = (applicableSubstitutions & 2 && container.kind === 232) || + (applicableSubstitutions & 8 && container.kind === 231); if (substitute) { return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node); } @@ -40659,37 +40941,37 @@ var ts; return node; } switch (node.kind) { - case 176: + case 177: return visitObjectLiteralExpression(node); - case 192: + case 193: return visitBinaryExpression(node, noDestructuringValue); - case 224: + case 225: return visitVariableDeclaration(node); - case 214: + case 215: return visitForOfStatement(node); - case 212: + case 213: return visitForStatement(node); - case 188: + case 189: return visitVoidExpression(node); - case 150: + case 151: return visitConstructorDeclaration(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: - return visitGetAccessorDeclaration(node); case 152: + return visitGetAccessorDeclaration(node); + case 153: return visitSetAccessorDeclaration(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: + case 145: return visitParameter(node); - case 208: + case 209: return visitExpressionStatement(node); - case 183: + case 184: return visitParenthesizedExpression(node, noDestructuringValue); default: return ts.visitEachChild(node, visitor, context); @@ -40700,7 +40982,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 260) { + if (e.kind === 261) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -40712,7 +40994,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 258) { + if (e.kind === 259) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -40729,7 +41011,7 @@ var ts; function visitObjectLiteralExpression(node) { if (node.transformFlags & 1048576) { var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176) { + if (objects.length && objects[0].kind !== 177) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -40854,6 +41136,9 @@ var ts; text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" }; function createAssignHelper(context, attributesSegments) { + if (context.getCompilerOptions().target >= 2) { + return ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), undefined, attributesSegments); + } context.requestEmitHelper(assignHelper); return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments); } @@ -40885,11 +41170,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 247: - return visitJsxElement(node, false); case 248: + return visitJsxElement(node, false); + case 249: return visitJsxSelfClosingElement(node, false); - case 253: + case 254: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -40899,11 +41184,11 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 253: + case 254: return visitJsxExpression(node); - case 247: - return visitJsxElement(node, true); case 248: + return visitJsxElement(node, true); + case 249: return visitJsxSelfClosingElement(node, true); default: ts.Debug.failBadSyntaxKind(node); @@ -40957,7 +41242,7 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.createLiteral(decoded, node) : node; } - else if (node.kind === 253) { + else if (node.kind === 254) { if (node.expression === undefined) { return ts.createLiteral(true); } @@ -40968,43 +41253,35 @@ var ts; } } function visitJsxText(node) { - var text = ts.getTextOfNode(node, true); - var parts; + var fixed = fixupWhitespaceAndDecodeEntities(ts.getTextOfNode(node, true)); + return fixed === undefined ? undefined : ts.createLiteral(fixed); + } + function fixupWhitespaceAndDecodeEntities(text) { + var acc; var firstNonWhitespace = 0; var lastNonWhitespace = -1; for (var i = 0; i < text.length; i++) { var c = text.charCodeAt(i); if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); } firstNonWhitespace = -1; } - else if (!ts.isWhiteSpace(c)) { + else if (!ts.isWhiteSpaceSingleLine(c)) { lastNonWhitespace = i; if (firstNonWhitespace === -1) { firstNonWhitespace = i; } } } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); - } - if (parts) { - return ts.reduceLeft(parts, aggregateJsxTextParts); - } - return undefined; + return firstNonWhitespace !== -1 + ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) + : acc; } - function aggregateJsxTextParts(left, right) { - return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right); + function addLineOfJsxText(acc, trimmedLine) { + var decoded = decodeEntities(trimmedLine); + return acc === undefined ? decoded : acc + " " + decoded; } function decodeEntities(text) { return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) { @@ -41015,7 +41292,7 @@ var ts; return String.fromCharCode(parseInt(hex, 16)); } else { - var ch = entities[word]; + var ch = entities.get(word); return ch ? String.fromCharCode(ch) : match; } }); @@ -41025,16 +41302,16 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 247) { + if (node.kind === 248) { return getTagName(node.openingElement); } else { - var name_36 = node.tagName; - if (ts.isIdentifier(name_36) && ts.isIntrinsicJsxName(name_36.text)) { - return ts.createLiteral(name_36.text); + var name = node.tagName; + if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.text)) { + return ts.createLiteral(name.text); } else { - return ts.createExpressionFromEntityName(name_36); + return ts.createExpressionFromEntityName(name); } } } @@ -41052,7 +41329,7 @@ var ts; } } ts.transformJsx = transformJsx; - var entities = ts.createMap({ + var entities = ts.createMapFromTemplate({ "quot": 0x0022, "amp": 0x0026, "apos": 0x0027, @@ -41340,15 +41617,15 @@ var ts; switch (node.kind) { case 119: return undefined; - case 189: + case 190: return visitAwaitExpression(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); default: return ts.visitEachChild(node, visitor, context); @@ -41385,7 +41662,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 185; + var isArrowFunction = node.kind === 186; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; if (!isArrowFunction) { var statements = []; @@ -41440,23 +41717,23 @@ var ts; function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; - context.enableSubstitution(179); - context.enableSubstitution(177); + context.enableSubstitution(180); context.enableSubstitution(178); - context.enableEmitNotification(227); - context.enableEmitNotification(149); - context.enableEmitNotification(151); - context.enableEmitNotification(152); + context.enableSubstitution(179); + context.enableEmitNotification(228); context.enableEmitNotification(150); + context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(151); } } function substituteExpression(node) { switch (node.kind) { - case 177: - return substitutePropertyAccessExpression(node); case 178: - return substituteElementAccessExpression(node); + return substitutePropertyAccessExpression(node); case 179: + return substituteElementAccessExpression(node); + case 180: if (enabledSubstitutions & 1) { return substituteCallExpression(node); } @@ -41499,11 +41776,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 227 - || kind === 150 - || kind === 149 + return kind === 228 || kind === 151 - || kind === 152; + || kind === 150 + || kind === 152 + || kind === 153; } function onEmitNode(emitContext, node, emitCallback) { if (enabledSubstitutions & 1 && isSuperContainer(node)) { @@ -41581,7 +41858,7 @@ var ts; return node; } switch (node.kind) { - case 192: + case 193: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -41665,7 +41942,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return hierarchyFacts & 4096 - && node.kind === 217 + && node.kind === 218 && !node.expression; } function shouldVisitNode(node) { @@ -41698,91 +41975,91 @@ var ts; switch (node.kind) { case 114: return undefined; - case 227: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 144: + case 145: return visitParameter(node); - case 226: + case 227: return visitFunctionDeclaration(node); - case 185: + case 186: return visitArrowFunction(node); - case 184: + case 185: return visitFunctionExpression(node); - case 224: + case 225: return visitVariableDeclaration(node); case 70: return visitIdentifier(node); - case 225: + case 226: return visitVariableDeclarationList(node); - case 219: + case 220: return visitSwitchStatement(node); - case 233: + case 234: return visitCaseBlock(node); - case 205: + case 206: return visitBlock(node, false); + case 217: case 216: - case 215: return visitBreakOrContinueStatement(node); - case 220: + case 221: return visitLabeledStatement(node); - case 210: case 211: - return visitDoOrWhileStatement(node, undefined); case 212: - return visitForStatement(node, undefined); + return visitDoOrWhileStatement(node, undefined); case 213: - return visitForInStatement(node, undefined); + return visitForStatement(node, undefined); case 214: + return visitForInStatement(node, undefined); + case 215: return visitForOfStatement(node, undefined); - case 208: + case 209: return visitExpressionStatement(node); - case 176: + case 177: return visitObjectLiteralExpression(node); - case 257: + case 258: return visitCatchClause(node); - case 259: + case 260: return visitShorthandPropertyAssignment(node); - case 142: + case 143: return visitComputedPropertyName(node); - case 175: + case 176: return visitArrayLiteralExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 183: + case 184: return visitParenthesizedExpression(node, true); - case 192: + case 193: return visitBinaryExpression(node, true); case 12: case 13: case 14: case 15: return visitTemplateLiteral(node); - case 181: + case 182: return visitTaggedTemplateExpression(node); - case 194: - return visitTemplateExpression(node); case 195: - return visitYieldExpression(node); + return visitTemplateExpression(node); case 196: + return visitYieldExpression(node); + case 197: return visitSpreadElement(node); case 96: return visitSuperKeyword(false); case 98: return visitThisKeyword(node); - case 202: + case 203: return visitMetaProperty(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: case 152: + case 153: return visitAccessorDeclaration(node); - case 206: + case 207: return visitVariableStatement(node); - case 217: + case 218: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context); @@ -41852,20 +42129,20 @@ var ts; if (ts.isGeneratedIdentifier(node)) { return node; } - if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) { + if (node.text !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { return node; } return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 216 ? 2 : 4; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + var jump = node.kind === 217 ? 2 : 4; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 216) { + if (node.kind === 217) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -41875,7 +42152,7 @@ var ts; } } else { - if (node.kind === 216) { + if (node.kind === 217) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -42033,17 +42310,17 @@ var ts; return block; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 217) { + if (statement.kind === 218) { return true; } - else if (statement.kind === 209) { + else if (statement.kind === 210) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 205) { + else if (statement.kind === 206) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -42072,7 +42349,7 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 208 && ts.isSuperCall(firstStatement.expression)) { + if (firstStatement.kind === 209 && ts.isSuperCall(firstStatement.expression)) { superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } @@ -42080,8 +42357,8 @@ var ts; && statementOffset === ctorStatements.length - 1 && !(ctor.transformFlags & (16384 | 32768))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 192 - || superCallExpression.left.kind !== 179) { + if (superCallExpression.kind !== 193 + || superCallExpression.left.kind !== 180) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))); @@ -42123,15 +42400,15 @@ var ts; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - var name_37 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; if (dotDotDotToken) { continue; } - if (ts.isBindingPattern(name_37)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_37, initializer); + if (ts.isBindingPattern(name)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer); } else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_37, initializer); + addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer); } } } @@ -42181,7 +42458,7 @@ var ts; statements.push(forStatement); } function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 && node.kind !== 185) { + if (node.transformFlags & 32768 && node.kind !== 186) { captureThisForNode(statements, node, ts.createThis()); } } @@ -42198,18 +42475,18 @@ var ts; if (hierarchyFacts & 16384) { var newTarget = void 0; switch (node.kind) { - case 185: + case 186: return statements; - case 149: - case 151: + case 150: case 152: + case 153: newTarget = ts.createVoidZero(); break; - case 150: + case 151: newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); break; - case 226: - case 184: + case 227: + case 185: newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 92, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); break; default: @@ -42230,20 +42507,20 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 204: + case 205: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 149: + case 150: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 150: + case 151: break; default: ts.Debug.failBadSyntaxKind(node); @@ -42366,7 +42643,7 @@ var ts; : enterSubtree(16286, 65); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 16384 && !name && (node.kind === 226 || node.kind === 184)) { + if (hierarchyFacts & 16384 && !name && (node.kind === 227 || node.kind === 185)) { name = ts.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 49152, 0); @@ -42399,7 +42676,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 185); + ts.Debug.assert(node.kind === 186); statementsLocation = ts.moveRangeEnd(body, -1); var equalsGreaterThanToken = node.equalsGreaterThanToken; if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { @@ -42449,9 +42726,9 @@ var ts; } function visitExpressionStatement(node) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateStatement(node, visitBinaryExpression(node.expression, false)); } return ts.visitEachChild(node, visitor, context); @@ -42459,9 +42736,9 @@ var ts; function visitParenthesizedExpression(node, needsDestructuringValue) { if (!needsDestructuringValue) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateParen(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateParen(node, visitBinaryExpression(node.expression, false)); } } @@ -42568,10 +42845,10 @@ var ts; return updated; } function recordLabel(node) { - convertedLoopState.labels[node.label.text] = node.label.text; + convertedLoopState.labels.set(node.label.text, node.label.text); } function resetLabel(node) { - convertedLoopState.labels[node.label.text] = undefined; + convertedLoopState.labels.set(node.label.text, undefined); } function visitLabeledStatement(node) { if (convertedLoopState && !convertedLoopState.labels) { @@ -42645,7 +42922,7 @@ var ts; ts.addRange(statements, convertedLoopBodyStatements); } else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); bodyLocation = statement; @@ -42667,14 +42944,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 210: case 211: - return visitDoOrWhileStatement(node, outermostLabeledStatement); case 212: - return visitForStatement(node, outermostLabeledStatement); + return visitDoOrWhileStatement(node, outermostLabeledStatement); case 213: - return visitForInStatement(node, outermostLabeledStatement); + return visitForStatement(node, outermostLabeledStatement); case 214: + return visitForInStatement(node, outermostLabeledStatement); + case 215: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -42689,7 +42966,7 @@ var ts; && i < numInitialPropertiesWithoutYield) { numInitialPropertiesWithoutYield = i; } - if (property.name.kind === 142) { + if (property.name.kind === 143) { numInitialProperties = i; break; } @@ -42751,11 +43028,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 212: case 213: case 214: + case 215: var initializer = node.initializer; - if (initializer && initializer.kind === 225) { + if (initializer && initializer.kind === 226) { loopInitializer = initializer; } break; @@ -42929,23 +43206,22 @@ var ts; if (!state.labeledNonLocalBreaks) { state.labeledNonLocalBreaks = ts.createMap(); } - state.labeledNonLocalBreaks[labelText] = labelMarker; + state.labeledNonLocalBreaks.set(labelText, labelMarker); } else { if (!state.labeledNonLocalContinues) { state.labeledNonLocalContinues = ts.createMap(); } - state.labeledNonLocalContinues[labelText] = labelMarker; + state.labeledNonLocalContinues.set(labelText, labelMarker); } } function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { if (!table) { return; } - for (var labelText in table) { - var labelMarker = table[labelText]; + table.forEach(function (labelMarker, labelText) { var statements = []; - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) { var label = ts.createIdentifier(labelText); statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)); } @@ -42954,7 +43230,7 @@ var ts; statements.push(ts.createReturn(loopResultName)); } caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)); - } + }); } function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { var name = decl.name; @@ -42980,20 +43256,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 149: + case 150: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 258: + case 259: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 259: + case 260: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -43125,7 +43401,7 @@ var ts; })); if (segments.length === 1) { var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 + return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 176 ? ts.createArraySlice(segments[0]) : segments[0]; } @@ -43253,13 +43529,13 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(98); - context.enableEmitNotification(150); - context.enableEmitNotification(149); context.enableEmitNotification(151); + context.enableEmitNotification(150); context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(186); context.enableEmitNotification(185); - context.enableEmitNotification(184); - context.enableEmitNotification(226); + context.enableEmitNotification(227); } } function onSubstituteNode(emitContext, node) { @@ -43284,10 +43560,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 174: - case 227: - case 230: - case 224: + case 175: + case 228: + case 231: + case 225: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -43330,11 +43606,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 208) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 209) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 180) { return false; } var callTarget = statementExpression.expression; @@ -43342,7 +43618,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 197) { return false; } var expression = callArgument.expression; @@ -43366,13 +43642,15 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var instructionNames = ts.createMap((_a = {}, - _a[2] = "return", - _a[3] = "break", - _a[4] = "yield", - _a[5] = "yield*", - _a[7] = "endfinally", - _a)); + function getInstructionName(instruction) { + switch (instruction) { + case 2: return "return"; + case 3: return "break"; + case 4: return "yield"; + case 5: return "yield*"; + case 7: return "endfinally"; + } + } function transformGenerators(context) { var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); @@ -43438,13 +43716,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 210: - return visitDoStatement(node); case 211: + return visitDoStatement(node); + case 212: return visitWhileStatement(node); - case 219: - return visitSwitchStatement(node); case 220: + return visitSwitchStatement(node); + case 221: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -43452,24 +43730,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); - case 151: case 152: + case 153: return visitAccessorDeclaration(node); - case 206: + case 207: return visitVariableStatement(node); - case 212: - return visitForStatement(node); case 213: + return visitForStatement(node); + case 214: return visitForInStatement(node); - case 216: + case 217: return visitBreakStatement(node); - case 215: + case 216: return visitContinueStatement(node); - case 217: + case 218: return visitReturnStatement(node); default: if (node.transformFlags & 16777216) { @@ -43485,21 +43763,21 @@ var ts; } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 192: - return visitBinaryExpression(node); case 193: + return visitBinaryExpression(node); + case 194: return visitConditionalExpression(node); - case 195: + case 196: return visitYieldExpression(node); - case 175: - return visitArrayLiteralExpression(node); case 176: + return visitArrayLiteralExpression(node); + case 177: return visitObjectLiteralExpression(node); - case 178: - return visitElementAccessExpression(node); case 179: - return visitCallExpression(node); + return visitElementAccessExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -43507,9 +43785,9 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 226: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); default: ts.Debug.failBadSyntaxKind(node); @@ -43666,10 +43944,10 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 177: + case 178: target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 178: + case 179: target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); break; default: @@ -43865,35 +44143,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 205: + case 206: return transformAndEmitBlock(node); - case 208: - return transformAndEmitExpressionStatement(node); case 209: - return transformAndEmitIfStatement(node); + return transformAndEmitExpressionStatement(node); case 210: - return transformAndEmitDoStatement(node); + return transformAndEmitIfStatement(node); case 211: - return transformAndEmitWhileStatement(node); + return transformAndEmitDoStatement(node); case 212: - return transformAndEmitForStatement(node); + return transformAndEmitWhileStatement(node); case 213: + return transformAndEmitForStatement(node); + case 214: return transformAndEmitForInStatement(node); - case 215: - return transformAndEmitContinueStatement(node); case 216: - return transformAndEmitBreakStatement(node); + return transformAndEmitContinueStatement(node); case 217: - return transformAndEmitReturnStatement(node); + return transformAndEmitBreakStatement(node); case 218: - return transformAndEmitWithStatement(node); + return transformAndEmitReturnStatement(node); case 219: - return transformAndEmitSwitchStatement(node); + return transformAndEmitWithStatement(node); case 220: - return transformAndEmitLabeledStatement(node); + return transformAndEmitSwitchStatement(node); case 221: - return transformAndEmitThrowStatement(node); + return transformAndEmitLabeledStatement(node); case 222: + return transformAndEmitThrowStatement(node); + case 223: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true)); @@ -43913,9 +44191,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - var name_38 = ts.getSynthesizedClone(variable.name); - ts.setCommentRange(name_38, variable.name); - hoistVariableDeclaration(name_38); + var name = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -44179,7 +44457,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 255 && defaultClauseIndex === -1) { + if (clause.kind === 256 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -44189,7 +44467,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 254) { + if (clause.kind === 255) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -44305,14 +44583,14 @@ var ts; return node; } function substituteExpressionIdentifier(node) { - if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) { + if (renamedCatchVariables && renamedCatchVariables.has(node.text)) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_39 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_39) { - var clone_7 = ts.getMutableClone(name_39); + var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)]; + if (name) { + var clone_7 = ts.getMutableClone(name); ts.setSourceMapRange(clone_7, node); ts.setCommentRange(clone_7, node); return clone_7; @@ -44420,10 +44698,10 @@ var ts; var name = declareLocal(text); if (!renamedCatchVariables) { renamedCatchVariables = ts.createMap(); - renamedCatchVariableDeclarations = ts.createMap(); + renamedCatchVariableDeclarations = []; context.enableSubstitution(70); } - renamedCatchVariables[text] = true; + renamedCatchVariables.set(text, true); renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; var exception = peekBlock(); ts.Debug.assert(exception.state < 1); @@ -44624,7 +44902,7 @@ var ts; } function createInstruction(instruction) { var literal = ts.createLiteral(instruction); - literal.trailingComment = instructionNames[instruction]; + literal.trailingComment = getInstructionName(instruction); return literal; } function createInlineBreak(label, location) { @@ -44979,7 +45257,6 @@ var ts; priority: 6, text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; - var _a; })(ts || (ts = {})); var ts; (function (ts) { @@ -44987,27 +45264,27 @@ var ts; var compilerOptions = context.getCompilerOptions(); var previousOnEmitNode; var noSubstitution; - if (compilerOptions.jsx === 1) { + if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(249); context.enableEmitNotification(250); - context.enableEmitNotification(248); + context.enableEmitNotification(251); + context.enableEmitNotification(249); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); - context.enableSubstitution(258); + context.enableSubstitution(178); + context.enableSubstitution(259); return transformSourceFile; function transformSourceFile(node) { return node; } function onEmitNode(emitContext, node, emitCallback) { switch (node.kind) { - case 249: case 250: - case 248: + case 251: + case 249: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -45054,12 +45331,13 @@ var ts; var ts; (function (ts) { function transformModule(context) { - var transformModuleDelegates = ts.createMap((_a = {}, - _a[ts.ModuleKind.None] = transformCommonJSModule, - _a[ts.ModuleKind.CommonJS] = transformCommonJSModule, - _a[ts.ModuleKind.AMD] = transformAMDModule, - _a[ts.ModuleKind.UMD] = transformUMDModule, - _a)); + function getTransformModuleDelegate(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.AMD: return transformAMDModule; + case ts.ModuleKind.UMD: return transformUMDModule; + default: return transformCommonJSModule; + } + } var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); @@ -45071,13 +45349,13 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableSubstitution(259); - context.enableEmitNotification(262); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); + context.enableSubstitution(192); + context.enableSubstitution(260); + context.enableEmitNotification(263); + var moduleInfoMap = []; + var deferredExports = []; var currentSourceFile; var currentModuleInfo; var noSubstitution; @@ -45089,8 +45367,9 @@ var ts; return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; + currentModuleInfo = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; + var transformModule = getTransformModuleDelegate(moduleKind); var updated = transformModule(node); currentSourceFile = undefined; currentModuleInfo = undefined; @@ -45216,23 +45495,23 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 236: + case 237: return visitImportDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); - case 242: + case 243: return visitExportDeclaration(node); - case 241: + case 242: return visitExportAssignment(node); - case 206: + case 207: return visitVariableStatement(node); - case 226: - return visitFunctionDeclaration(node); case 227: + return visitFunctionDeclaration(node); + case 228: return visitClassDeclaration(node); - case 296: - return visitMergeDeclarationMarker(node); case 297: + return visitMergeDeclarationMarker(node); + case 298: return visitEndOfDeclarationMarker(node); default: return node; @@ -45430,7 +45709,7 @@ var ts; } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -45462,10 +45741,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 238: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 239: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -45523,7 +45802,7 @@ var ts; } function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl); - var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; @@ -45535,7 +45814,7 @@ var ts; function appendExportStatement(statements, exportName, expression, location, allowComments) { if (exportName.text === "default") { var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile); - if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { + if (sourceFile && !sourceFile.symbol.exports.get("___esModule")) { if (languageVersion === 0) { statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true)))); } @@ -45573,10 +45852,10 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 262) { + if (node.kind === 263) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; - noSubstitution = ts.createMap(); + noSubstitution = []; previousOnEmitNode(emitContext, node, emitCallback); currentSourceFile = undefined; currentModuleInfo = undefined; @@ -45615,10 +45894,10 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); + case 192: case 191: - case 190: return substituteUnaryExpression(node); } return node; @@ -45633,7 +45912,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 262) { + if (exportContainer && exportContainer.kind === 263) { return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -45642,8 +45921,8 @@ var ts; return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_40 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_40), node); + var name = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name), node); } } } @@ -45676,7 +45955,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 + var expression = node.kind === 192 ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 ? 58 : 59), ts.createLiteral(1), node) : node; for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { @@ -45699,7 +45978,6 @@ var ts; } } } - var _a; } ts.transformModule = transformModule; var exportStarHelper = { @@ -45720,14 +45998,14 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableEmitNotification(262); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); - var exportFunctionsMap = ts.createMap(); - var noSubstitutionMap = ts.createMap(); + context.enableSubstitution(192); + context.enableEmitNotification(263); + var moduleInfoMap = []; + var deferredExports = []; + var exportFunctionsMap = []; + var noSubstitutionMap = []; var currentSourceFile; var moduleInfo; var exportFunction; @@ -45746,7 +46024,8 @@ var ts; currentSourceFile = node; enclosingBlockScopedContainer = node; moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); + exportFunction = ts.createUniqueName("exports"); + exportFunctionsMap[id] = exportFunction; contextObject = ts.createUniqueName("context"); var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); @@ -45783,12 +46062,12 @@ var ts; var externalImport = externalImports[i]; var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); var text = externalModuleName.text; - if (ts.hasProperty(groupIndices, text)) { - var groupIndex = groupIndices[text]; + var groupIndex = groupIndices.get(text); + if (groupIndex !== undefined) { dependencyGroups[groupIndex].externalImports.push(externalImport); } else { - groupIndices[text] = dependencyGroups.length; + groupIndices.set(text, dependencyGroups.length); dependencyGroups.push({ name: externalModuleName, externalImports: [externalImport] @@ -45819,11 +46098,11 @@ var ts; if (!moduleInfo.hasExportStarsToExportValues) { return; } - if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) { + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 242 && externalImport.exportClause) { + if (externalImport.kind === 243 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -45846,7 +46125,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 242) { + if (externalImport.kind !== 243) { continue; } var exportDecl = externalImport; @@ -45898,15 +46177,15 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 236: + case 237: if (!entry.importClause) { break; } - case 235: + case 236: ts.Debug.assert(importVariableName !== undefined); statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 242: + case 243: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { var properties = []; @@ -45928,13 +46207,13 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 236: + case 237: return visitImportDeclaration(node); - case 235: + case 236: return visitImportEqualsDeclaration(node); - case 242: + case 243: return undefined; - case 241: + case 242: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -46055,7 +46334,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 1048576) === 0 - && (enclosingBlockScopedContainer.kind === 262 + && (enclosingBlockScopedContainer.kind === 263 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -46077,7 +46356,7 @@ var ts; : preventSubstitution(ts.createAssignment(name, value, location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -46110,10 +46389,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 238: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 239: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -46183,7 +46462,7 @@ var ts; return statements; } var name = ts.getDeclarationName(decl); - var exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; @@ -46212,43 +46491,43 @@ var ts; } function nestedElementVisitor(node) { switch (node.kind) { - case 206: + case 207: return visitVariableStatement(node); - case 226: - return visitFunctionDeclaration(node); case 227: + return visitFunctionDeclaration(node); + case 228: return visitClassDeclaration(node); - case 212: - return visitForStatement(node); case 213: - return visitForInStatement(node); + return visitForStatement(node); case 214: + return visitForInStatement(node); + case 215: return visitForOfStatement(node); - case 210: - return visitDoStatement(node); case 211: + return visitDoStatement(node); + case 212: return visitWhileStatement(node); - case 220: + case 221: return visitLabeledStatement(node); - case 218: - return visitWithStatement(node); case 219: + return visitWithStatement(node); + case 220: return visitSwitchStatement(node); - case 233: + case 234: return visitCaseBlock(node); - case 254: - return visitCaseClause(node); case 255: + return visitCaseClause(node); + case 256: return visitDefaultClause(node); - case 222: + case 223: return visitTryStatement(node); - case 257: + case 258: return visitCatchClause(node); - case 205: + case 206: return visitBlock(node); - case 296: - return visitMergeDeclarationMarker(node); case 297: + return visitMergeDeclarationMarker(node); + case 298: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -46339,7 +46618,7 @@ var ts; } function destructuringVisitor(node) { if (node.transformFlags & 1024 - && node.kind === 192) { + && node.kind === 193) { return visitDestructuringAssignment(node); } else if (node.transformFlags & 2048) { @@ -46376,7 +46655,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 262; + return container !== undefined && container.kind === 263; } else { return false; @@ -46391,7 +46670,7 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 262) { + if (node.kind === 263) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -46424,10 +46703,10 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); - case 190: case 191: + case 192: return substituteUnaryExpression(node); } return node; @@ -46479,14 +46758,14 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 + var expression = node.kind === 192 ? ts.createPrefix(node.operator, node.operand, node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 191) { + if (node.kind === 192) { expression = node.operator === 42 ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -46503,7 +46782,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 262) { + if (exportContainer && exportContainer.kind === 263) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -46513,7 +46792,7 @@ var ts; } function preventSubstitution(node) { if (noSubstitution === undefined) - noSubstitution = ts.createMap(); + noSubstitution = []; noSubstitution[ts.getNodeId(node)] = true; return node; } @@ -46531,7 +46810,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(262); + context.enableEmitNotification(263); context.enableSubstitution(70); var currentSourceFile; return transformSourceFile; @@ -46556,9 +46835,9 @@ var ts; } function visitor(node) { switch (node.kind) { - case 235: + case 236: return undefined; - case 241: + case 242: return visitExportAssignment(node); } return node; @@ -46597,14 +46876,16 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var moduleTransformerMap = ts.createMap((_a = {}, - _a[ts.ModuleKind.ES2015] = ts.transformES2015Module, - _a[ts.ModuleKind.System] = ts.transformSystemModule, - _a[ts.ModuleKind.AMD] = ts.transformModule, - _a[ts.ModuleKind.CommonJS] = ts.transformModule, - _a[ts.ModuleKind.UMD] = ts.transformModule, - _a[ts.ModuleKind.None] = ts.transformModule, - _a)); + function getModuleTransformer(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.ES2015: + return ts.transformES2015Module; + case ts.ModuleKind.System: + return ts.transformSystemModule; + default: + return ts.transformModule; + } + } function getTransformers(compilerOptions) { var jsx = compilerOptions.jsx; var languageVersion = ts.getEmitScriptTarget(compilerOptions); @@ -46627,7 +46908,7 @@ var ts; transformers.push(ts.transformES2015); transformers.push(ts.transformGenerators); } - transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]); + transformers.push(getModuleTransformer(moduleKind)); if (languageVersion < 1) { transformers.push(ts.transformES5); } @@ -46635,7 +46916,7 @@ var ts; } ts.getTransformers = getTransformers; function transformFiles(resolver, host, sourceFiles, transformers) { - var enabledSyntaxKindFeatures = new Array(298); + var enabledSyntaxKindFeatures = new Array(299); var lexicalEnvironmentDisabled = false; var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; @@ -46791,13 +47072,12 @@ var ts; } } ts.transformFiles = transformFiles; - var _a; })(ts || (ts = {})); var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); - ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + ts.forEachEmittedFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { var declarationFilePath = _a.declarationFilePath; @@ -46867,7 +47147,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 236); + ts.Debug.assert(aliasEmitInfo.node.kind === 237); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -46890,9 +47170,9 @@ var ts; } }); if (usedTypeDirectiveReferences) { - for (var directive in usedTypeDirectiveReferences) { + ts.forEachKey(usedTypeDirectiveReferences, function (directive) { referencesOutput += "/// " + newLine; - } + }); } return { reportedDeclarationError: reportedDeclarationError, @@ -46939,10 +47219,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 224) { + if (declaration.kind === 225) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 239 || declaration.kind === 240 || declaration.kind === 237) { + else if (declaration.kind === 240 || declaration.kind === 241 || declaration.kind === 238) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -46953,7 +47233,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 236) { + if (moduleElementEmitInfo.node.kind === 237) { moduleElementEmitInfo.isVisible = true; } else { @@ -46961,12 +47241,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 231) { + if (nodeToCheck.kind === 232) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 231) { + if (nodeToCheck.kind === 232) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -46985,8 +47265,8 @@ var ts; } for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { var directive = typeReferenceDirectives_1[_i]; - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + if (!usedTypeDirectiveReferences.has(directive)) { + usedTypeDirectiveReferences.set(directive, directive); } } } @@ -47079,49 +47359,50 @@ var ts; function emitType(type) { switch (type.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 133: + case 136: case 104: - case 137: + case 138: case 94: case 129: - case 167: - case 171: + case 168: + case 172: return writeTextOfNode(currentText, type); - case 199: + case 200: return emitExpressionWithTypeArguments(type); - case 157: + case 158: return emitTypeReference(type); - case 160: + case 161: return emitTypeQuery(type); - case 162: - return emitArrayType(type); case 163: - return emitTupleType(type); + return emitArrayType(type); case 164: - return emitUnionType(type); + return emitTupleType(type); case 165: - return emitIntersectionType(type); + return emitUnionType(type); case 166: + return emitIntersectionType(type); + case 167: return emitParenType(type); - case 168: - return emitTypeOperator(type); case 169: - return emitIndexedAccessType(type); + return emitTypeOperator(type); case 170: + return emitIndexedAccessType(type); + case 171: return emitMappedType(type); - case 158: case 159: + case 160: return emitSignatureDeclarationWithJsDocComments(type); - case 161: + case 162: return emitTypeLiteral(type); case 70: return emitEntityName(type); - case 141: + case 142: return emitEntityName(type); - case 156: + case 157: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -47129,22 +47410,22 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 141 ? entityName.left : entityName.expression; - var right = entityName.kind === 141 ? entityName.right : entityName.name; + var left = entityName.kind === 142 ? entityName.left : entityName.expression; + var right = entityName.kind === 142 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 235 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 236 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isEntityNameExpression(node.expression)) { - ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 177); + ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 178); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -47248,15 +47529,15 @@ var ts; } function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!(baseName in currentIdentifiers)) { + if (!currentIdentifiers.has(baseName)) { return baseName; } var count = 0; while (true) { count++; - var name_41 = baseName + "_" + count; - if (!(name_41 in currentIdentifiers)) { - return name_41; + var name = baseName + "_" + count; + if (!currentIdentifiers.has(name)) { + return name; } } } @@ -47300,10 +47581,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 235 || - (node.parent.kind === 262 && isCurrentFileExternalModule)) { + else if (node.kind === 236 || + (node.parent.kind === 263 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 262) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 263) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -47312,7 +47593,7 @@ var ts; }); } else { - if (node.kind === 236) { + if (node.kind === 237) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -47330,30 +47611,30 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 226: + case 227: return writeFunctionDeclaration(node); - case 206: + case 207: return writeVariableStatement(node); - case 228: + case 229: return writeInterfaceDeclaration(node); - case 227: + case 228: return writeClassDeclaration(node); - case 229: - return writeTypeAliasDeclaration(node); case 230: - return writeEnumDeclaration(node); + return writeTypeAliasDeclaration(node); case 231: + return writeEnumDeclaration(node); + case 232: return writeModuleDeclaration(node); - case 235: - return writeImportEqualsDeclaration(node); case 236: + return writeImportEqualsDeclaration(node); + case 237: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 262) { + if (node.parent.kind === 263) { var modifiers = ts.getModifierFlags(node); if (modifiers & 1) { write("export "); @@ -47361,7 +47642,7 @@ var ts; if (modifiers & 512) { write("default "); } - else if (node.kind !== 228 && !noDeclare) { + else if (node.kind !== 229 && !noDeclare) { write("declare "); } } @@ -47411,7 +47692,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 238) { + if (namedBindings.kind === 239) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -47434,7 +47715,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 238) { + if (node.importClause.namedBindings.kind === 239) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -47451,13 +47732,13 @@ var ts; writer.writeLine(); } function emitExternalModuleSpecifier(parent) { - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 231; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 232; var moduleSpecifier; - if (parent.kind === 235) { + if (parent.kind === 236) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 231) { + else if (parent.kind === 232) { moduleSpecifier = parent.name; } else { @@ -47525,7 +47806,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 232) { + while (node.body && node.body.kind !== 233) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -47595,7 +47876,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 149 && ts.hasModifier(node.parent, 8); + return node.parent.kind === 150 && ts.hasModifier(node.parent, 8); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -47605,15 +47886,15 @@ var ts; writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - (node.parent.parent && node.parent.parent.kind === 161)) { - ts.Debug.assert(node.parent.kind === 149 || - node.parent.kind === 148 || - node.parent.kind === 158 || + if (node.parent.kind === 159 || + node.parent.kind === 160 || + (node.parent.parent && node.parent.parent.kind === 162)) { + ts.Debug.assert(node.parent.kind === 150 || + node.parent.kind === 149 || node.parent.kind === 159 || - node.parent.kind === 153 || - node.parent.kind === 154); + node.parent.kind === 160 || + node.parent.kind === 154 || + node.parent.kind === 155); emitType(node.constraint); } else { @@ -47623,34 +47904,34 @@ var ts; function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 227: + case 228: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 228: + case 229: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 154: + case 155: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 153: + case 154: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { 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 === 227) { + else if (node.parent.parent.kind === 228) { 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 226: + case 227: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 229: + case 230: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -47687,7 +47968,7 @@ var ts; } function getHeritageClauseVisibilityError() { var diagnosticMessage; - if (node.parent.parent.kind === 227) { + if (node.parent.parent.kind === 228) { 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; @@ -47770,17 +48051,17 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 224 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 225 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentText, node.name); - if ((node.kind === 147 || node.kind === 146 || - (node.kind === 144 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { + if ((node.kind === 148 || node.kind === 147 || + (node.kind === 145 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 147 || node.kind === 146) && node.parent.kind === 161) { + if ((node.kind === 148 || node.kind === 147) && node.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (resolver.isLiteralConstDeclaration(node)) { @@ -47793,14 +48074,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 224) { + if (node.kind === 225) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 === 147 || node.kind === 146) { + else if (node.kind === 148 || node.kind === 147) { if (ts.hasModifier(node, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -47808,7 +48089,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 === 227) { + else if (node.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47834,7 +48115,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198) { + if (element.kind !== 199) { elements.push(element); } } @@ -47900,7 +48181,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 151 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 152 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -47913,7 +48194,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 151 + return accessor.kind === 152 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -47922,7 +48203,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 152) { + if (accessorWithTypeAnnotation.kind === 153) { if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : @@ -47968,17 +48249,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 226) { + if (node.kind === 227) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 149 || node.kind === 150) { + else if (node.kind === 150 || node.kind === 151) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 226) { + if (node.kind === 227) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 150) { + else if (node.kind === 151) { write("constructor"); } else { @@ -47998,15 +48279,15 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; var closeParenthesizedFunctionType = false; - if (node.kind === 155) { + if (node.kind === 156) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); write("["); } else { - if (node.kind === 154 || node.kind === 159) { + if (node.kind === 155 || node.kind === 160) { write("new "); } - else if (node.kind === 158) { + else if (node.kind === 159) { var currentOutput = writer.getText(); if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { closeParenthesizedFunctionType = true; @@ -48017,20 +48298,20 @@ var ts; write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 155) { + if (node.kind === 156) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 158 || node.kind === 159; - if (isFunctionTypeOrConstructorType || node.parent.kind === 161) { + var isFunctionTypeOrConstructorType = node.kind === 159 || node.kind === 160; + if (isFunctionTypeOrConstructorType || node.parent.kind === 162) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 150 && !ts.hasModifier(node, 8)) { + else if (node.kind !== 151 && !ts.hasModifier(node, 8)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -48044,23 +48325,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 154: + case 155: diagnosticMessage = symbolAccessibilityResult.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 153: + case 154: diagnosticMessage = symbolAccessibilityResult.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 155: + case 156: diagnosticMessage = symbolAccessibilityResult.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 150: case 149: - case 148: if (ts.hasModifier(node, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -48068,7 +48349,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 === 227) { + else if (node.parent.kind === 228) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -48081,7 +48362,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 226: + case 227: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -48113,9 +48394,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - node.parent.parent.kind === 161) { + if (node.parent.kind === 159 || + node.parent.kind === 160 || + node.parent.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!ts.hasModifier(node.parent, 8)) { @@ -48131,26 +48412,26 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 150: + case 151: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 154: + case 155: return symbolAccessibilityResult.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 153: + case 154: return symbolAccessibilityResult.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 155: + case 156: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -48158,7 +48439,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 === 227) { + else if (node.parent.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -48170,7 +48451,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 226: + case 227: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -48181,12 +48462,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -48197,10 +48478,10 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 198) { + if (bindingElement.kind === 199) { write(" "); } - else if (bindingElement.kind === 174) { + else if (bindingElement.kind === 175) { if (bindingElement.propertyName) { writeTextOfNode(currentText, bindingElement.propertyName); write(": "); @@ -48222,39 +48503,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 226: - case 231: - case 235: - case 228: case 227: + case 232: + case 236: case 229: + case 228: case 230: + case 231: return emitModuleElement(node, isModuleElementVisible(node)); - case 206: + case 207: return emitModuleElement(node, isVariableStatementVisible(node)); - case 236: + case 237: return emitModuleElement(node, !node.importClause); - case 242: + case 243: return emitExportDeclaration(node); + case 151: case 150: case 149: - case 148: return writeFunctionDeclaration(node); - case 154: - case 153: case 155: + case 154: + case 156: return emitSignatureDeclarationWithJsDocComments(node); - case 151: case 152: + case 153: return emitAccessorDeclaration(node); + case 148: case 147: - case 146: return emitPropertyDeclaration(node); - case 261: + case 262: return emitEnumMemberDeclaration(node); - case 241: + case 242: return emitExportAssignment(node); - case 262: + case 263: return emitSourceFile(node); } } @@ -48265,7 +48546,7 @@ var ts; declFileName = referencedFile.fileName; } else { - ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); @@ -48471,7 +48752,7 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 294 + if (node.kind !== 295 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); @@ -48484,7 +48765,7 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 294 + if (node.kind !== 295 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -48628,7 +48909,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 294; + var isEmittedNode = node.kind !== 295; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { @@ -48642,7 +48923,7 @@ var ts; } if (!skipTrailingComments) { containerEnd = end; - if (node.kind === 225) { + if (node.kind === 226) { declarationListContainerEnd = end; } } @@ -48879,10 +49160,10 @@ var ts; var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification; ts.performance.measure("transformTime", "beforeTransform"); ts.performance.mark("beforePrint"); - ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, emitFile, transformed, emitOnlyDtsFiles); ts.performance.measure("printTime", "beforePrint"); - for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) { - var sourceFile = sourceFiles_4[_b]; + for (var _b = 0, sourceFiles_3 = sourceFiles; _b < sourceFiles_3.length; _b++) { + var sourceFile = sourceFiles_3[_b]; ts.disposeEmitNodes(sourceFile); } return { @@ -48891,7 +49172,8 @@ var ts; emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; - function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) { + function emitFile(_a, sourceFiles, isBundledEmit) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { if (!emitOnlyDtsFiles) { printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); @@ -48923,8 +49205,8 @@ var ts; bundledHelpers = isBundledEmit ? ts.createMap() : undefined; isOwnFileEmit = !isBundledEmit; if (isBundledEmit && moduleKind) { - for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { - var sourceFile = sourceFiles_5[_a]; + for (var _a = 0, sourceFiles_4 = sourceFiles; _a < sourceFiles_4.length; _a++) { + var sourceFile = sourceFiles_4[_a]; emitHelpers(sourceFile, true); } } @@ -48998,7 +49280,7 @@ var ts; function pipelineEmitInSourceFileContext(node) { var kind = node.kind; switch (kind) { - case 262: + case 263: return emitSourceFile(node); } } @@ -49042,7 +49324,6 @@ var ts; case 130: case 131: case 132: - case 133: case 134: case 135: case 136: @@ -49050,190 +49331,191 @@ var ts; case 138: case 139: case 140: + case 141: writeTokenText(kind); return; - case 141: - return emitQualifiedName(node); case 142: - return emitComputedPropertyName(node); + return emitQualifiedName(node); case 143: - return emitTypeParameter(node); + return emitComputedPropertyName(node); case 144: - return emitParameter(node); + return emitTypeParameter(node); case 145: - return emitDecorator(node); + return emitParameter(node); case 146: - return emitPropertySignature(node); + return emitDecorator(node); case 147: - return emitPropertyDeclaration(node); + return emitPropertySignature(node); case 148: - return emitMethodSignature(node); + return emitPropertyDeclaration(node); case 149: - return emitMethodDeclaration(node); + return emitMethodSignature(node); case 150: - return emitConstructor(node); + return emitMethodDeclaration(node); case 151: + return emitConstructor(node); case 152: - return emitAccessorDeclaration(node); case 153: - return emitCallSignature(node); + return emitAccessorDeclaration(node); case 154: - return emitConstructSignature(node); + return emitCallSignature(node); case 155: - return emitIndexSignature(node); + return emitConstructSignature(node); case 156: - return emitTypePredicate(node); + return emitIndexSignature(node); case 157: - return emitTypeReference(node); + return emitTypePredicate(node); case 158: - return emitFunctionType(node); + return emitTypeReference(node); case 159: - return emitConstructorType(node); + return emitFunctionType(node); case 160: - return emitTypeQuery(node); + return emitConstructorType(node); case 161: - return emitTypeLiteral(node); + return emitTypeQuery(node); case 162: - return emitArrayType(node); + return emitTypeLiteral(node); case 163: - return emitTupleType(node); + return emitArrayType(node); case 164: - return emitUnionType(node); + return emitTupleType(node); case 165: - return emitIntersectionType(node); + return emitUnionType(node); case 166: + return emitIntersectionType(node); + case 167: return emitParenthesizedType(node); - case 199: + case 200: return emitExpressionWithTypeArguments(node); - case 167: - return emitThisType(); case 168: - return emitTypeOperator(node); + return emitThisType(); case 169: - return emitIndexedAccessType(node); + return emitTypeOperator(node); case 170: - return emitMappedType(node); + return emitIndexedAccessType(node); case 171: - return emitLiteralType(node); + return emitMappedType(node); case 172: - return emitObjectBindingPattern(node); + return emitLiteralType(node); case 173: - return emitArrayBindingPattern(node); + return emitObjectBindingPattern(node); case 174: + return emitArrayBindingPattern(node); + case 175: return emitBindingElement(node); - case 203: - return emitTemplateSpan(node); case 204: - return emitSemicolonClassElement(); + return emitTemplateSpan(node); case 205: - return emitBlock(node); + return emitSemicolonClassElement(); case 206: - return emitVariableStatement(node); + return emitBlock(node); case 207: - return emitEmptyStatement(); + return emitVariableStatement(node); case 208: - return emitExpressionStatement(node); + return emitEmptyStatement(); case 209: - return emitIfStatement(node); + return emitExpressionStatement(node); case 210: - return emitDoStatement(node); + return emitIfStatement(node); case 211: - return emitWhileStatement(node); + return emitDoStatement(node); case 212: - return emitForStatement(node); + return emitWhileStatement(node); case 213: - return emitForInStatement(node); + return emitForStatement(node); case 214: - return emitForOfStatement(node); + return emitForInStatement(node); case 215: - return emitContinueStatement(node); + return emitForOfStatement(node); case 216: - return emitBreakStatement(node); + return emitContinueStatement(node); case 217: - return emitReturnStatement(node); + return emitBreakStatement(node); case 218: - return emitWithStatement(node); + return emitReturnStatement(node); case 219: - return emitSwitchStatement(node); + return emitWithStatement(node); case 220: - return emitLabeledStatement(node); + return emitSwitchStatement(node); case 221: - return emitThrowStatement(node); + return emitLabeledStatement(node); case 222: - return emitTryStatement(node); + return emitThrowStatement(node); case 223: - return emitDebuggerStatement(node); + return emitTryStatement(node); case 224: - return emitVariableDeclaration(node); + return emitDebuggerStatement(node); case 225: - return emitVariableDeclarationList(node); + return emitVariableDeclaration(node); case 226: - return emitFunctionDeclaration(node); + return emitVariableDeclarationList(node); case 227: - return emitClassDeclaration(node); + return emitFunctionDeclaration(node); case 228: - return emitInterfaceDeclaration(node); + return emitClassDeclaration(node); case 229: - return emitTypeAliasDeclaration(node); + return emitInterfaceDeclaration(node); case 230: - return emitEnumDeclaration(node); + return emitTypeAliasDeclaration(node); case 231: - return emitModuleDeclaration(node); + return emitEnumDeclaration(node); case 232: - return emitModuleBlock(node); + return emitModuleDeclaration(node); case 233: + return emitModuleBlock(node); + case 234: return emitCaseBlock(node); - case 235: - return emitImportEqualsDeclaration(node); case 236: - return emitImportDeclaration(node); + return emitImportEqualsDeclaration(node); case 237: - return emitImportClause(node); + return emitImportDeclaration(node); case 238: - return emitNamespaceImport(node); + return emitImportClause(node); case 239: - return emitNamedImports(node); + return emitNamespaceImport(node); case 240: - return emitImportSpecifier(node); + return emitNamedImports(node); case 241: - return emitExportAssignment(node); + return emitImportSpecifier(node); case 242: - return emitExportDeclaration(node); + return emitExportAssignment(node); case 243: - return emitNamedExports(node); + return emitExportDeclaration(node); case 244: - return emitExportSpecifier(node); + return emitNamedExports(node); case 245: - return; + return emitExportSpecifier(node); case 246: + return; + case 247: return emitExternalModuleReference(node); case 10: return emitJsxText(node); - case 249: - return emitJsxOpeningElement(node); case 250: - return emitJsxClosingElement(node); + return emitJsxOpeningElement(node); case 251: - return emitJsxAttribute(node); + return emitJsxClosingElement(node); case 252: - return emitJsxSpreadAttribute(node); + return emitJsxAttribute(node); case 253: - return emitJsxExpression(node); + return emitJsxSpreadAttribute(node); case 254: - return emitCaseClause(node); + return emitJsxExpression(node); case 255: - return emitDefaultClause(node); + return emitCaseClause(node); case 256: - return emitHeritageClause(node); + return emitDefaultClause(node); case 257: - return emitCatchClause(node); + return emitHeritageClause(node); case 258: - return emitPropertyAssignment(node); + return emitCatchClause(node); case 259: - return emitShorthandPropertyAssignment(node); + return emitPropertyAssignment(node); case 260: - return emitSpreadAssignment(node); + return emitShorthandPropertyAssignment(node); case 261: + return emitSpreadAssignment(node); + case 262: return emitEnumMember(node); } if (ts.isExpression(node)) { @@ -49258,65 +49540,65 @@ var ts; case 98: writeTokenText(kind); return; - case 175: - return emitArrayLiteralExpression(node); case 176: - return emitObjectLiteralExpression(node); + return emitArrayLiteralExpression(node); case 177: - return emitPropertyAccessExpression(node); + return emitObjectLiteralExpression(node); case 178: - return emitElementAccessExpression(node); + return emitPropertyAccessExpression(node); case 179: - return emitCallExpression(node); + return emitElementAccessExpression(node); case 180: - return emitNewExpression(node); + return emitCallExpression(node); case 181: - return emitTaggedTemplateExpression(node); + return emitNewExpression(node); case 182: - return emitTypeAssertionExpression(node); + return emitTaggedTemplateExpression(node); case 183: - return emitParenthesizedExpression(node); + return emitTypeAssertionExpression(node); case 184: - return emitFunctionExpression(node); + return emitParenthesizedExpression(node); case 185: - return emitArrowFunction(node); + return emitFunctionExpression(node); case 186: - return emitDeleteExpression(node); + return emitArrowFunction(node); case 187: - return emitTypeOfExpression(node); + return emitDeleteExpression(node); case 188: - return emitVoidExpression(node); + return emitTypeOfExpression(node); case 189: - return emitAwaitExpression(node); + return emitVoidExpression(node); case 190: - return emitPrefixUnaryExpression(node); + return emitAwaitExpression(node); case 191: - return emitPostfixUnaryExpression(node); + return emitPrefixUnaryExpression(node); case 192: - return emitBinaryExpression(node); + return emitPostfixUnaryExpression(node); case 193: - return emitConditionalExpression(node); + return emitBinaryExpression(node); case 194: - return emitTemplateExpression(node); + return emitConditionalExpression(node); case 195: - return emitYieldExpression(node); + return emitTemplateExpression(node); case 196: - return emitSpreadExpression(node); + return emitYieldExpression(node); case 197: - return emitClassExpression(node); + return emitSpreadExpression(node); case 198: + return emitClassExpression(node); + case 199: return; - case 200: - return emitAsExpression(node); case 201: - return emitNonNullExpression(node); + return emitAsExpression(node); case 202: + return emitNonNullExpression(node); + case 203: return emitMetaProperty(node); - case 247: - return emitJsxElement(node); case 248: + return emitJsxElement(node); + case 249: return emitJsxSelfClosingElement(node); - case 295: + case 296: return emitPartiallyEmittedExpression(node); } } @@ -49415,7 +49697,7 @@ var ts; function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - write(node.kind === 151 ? "get " : "set "); + write(node.kind === 152 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -49613,7 +49895,9 @@ var ts; function needsDotDotForPropertyAccess(expression) { if (expression.kind === 8) { var text = getLiteralTextOfNode(expression); - return text.indexOf(ts.tokenToString(22)) < 0; + return ts.getNumericLiteralFlags(text, 15) === 0 + && !expression.isOctalLiteral + && text.indexOf(ts.tokenToString(22)) < 0; } else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { var constantValue = ts.getConstantValue(expression); @@ -49696,7 +49980,7 @@ var ts; } function shouldEmitWhitespaceBeforeOperand(node) { var operand = node.operand; - return operand.kind === 190 + return operand.kind === 191 && ((node.operator === 36 && (operand.operator === 36 || operand.operator === 42)) || (node.operator === 37 && (operand.operator === 37 || operand.operator === 43))); } @@ -49813,7 +50097,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node); writeToken(81, node.thenStatement.end, node); - if (node.elseStatement.kind === 209) { + if (node.elseStatement.kind === 210) { write(" "); emit(node.elseStatement); } @@ -49875,7 +50159,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 225) { + if (node.kind === 226) { emit(node); } else { @@ -50107,7 +50391,7 @@ var ts; write(node.flags & 16 ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 231) { + while (body.kind === 232) { write("."); emit(body.name); body = body.body; @@ -50303,7 +50587,6 @@ var ts; emitList(node, node.types, 272); } function emitCatchClause(node) { - writeLine(); var openParenPos = writeToken(73, node.pos); write(" "); writeToken(18, openParenPos); @@ -50383,10 +50666,10 @@ var ts; if (shouldSkip) continue; if (shouldBundle) { - if (bundledHelpers[helper.name]) { + if (bundledHelpers.get(helper.name)) { continue; } - bundledHelpers[helper.name] = true; + bundledHelpers.set(helper.name, true); } } else if (isBundle) { @@ -50721,7 +51004,7 @@ var ts; && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); } function skipSynthesizedParentheses(node) { - while (node.kind === 183 && ts.nodeIsSynthesized(node)) { + while (node.kind === 184 && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -50763,13 +51046,14 @@ var ts; } function isUniqueName(name) { return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentFileIdentifiers, name) && - !ts.hasProperty(generatedNameSet, name); + !currentFileIdentifiers.has(name) && + !generatedNameSet.has(name); } function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { - if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { + if (node.locals) { + var local = node.locals.get(name); + if (local && local.flags & (107455 | 1048576 | 8388608)) { return false; } } @@ -50778,21 +51062,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_42 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_42)) { + var name = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name)) { tempFlags |= flags; - return name_42; + return name; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_43 = count < 26 + var name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_43)) { - return name_43; + if (isUniqueName(name)) { + return name; } } } @@ -50805,7 +51089,8 @@ var ts; while (true) { var generatedName = baseName + i; if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; + generatedNameSet.set(generatedName, generatedName); + return generatedName; } i++; } @@ -50836,21 +51121,21 @@ var ts; switch (node.kind) { case 70: return makeUniqueName(getTextOfNode(node)); + case 232: case 231: - case 230: return generateNameForModuleOrEnum(node); - case 236: - case 242: + case 237: + case 243: return generateNameForImportOrExportDeclaration(node); - case 226: case 227: - case 241: + case 228: + case 242: return generateNameForExportDefault(); - case 197: + case 198: return generateNameForClassExpression(); - case 149: - case 151: + case 150: case 152: + case 153: return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0); @@ -51006,11 +51291,11 @@ var ts; return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; } function directoryExists(directoryPath) { - if (directoryPath in existingDirectories) { + if (existingDirectories.has(directoryPath)) { return true; } if (ts.sys.directoryExists(directoryPath)) { - existingDirectories[directoryPath] = true; + existingDirectories.set(directoryPath, true); return true; } return false; @@ -51029,9 +51314,10 @@ var ts; } var hash = ts.sys.createHash(data); var mtimeBefore = ts.sys.getModifiedTime(fileName); - if (mtimeBefore && fileName in outputFingerprints) { - var fingerprint = outputFingerprints[fileName]; - if (fingerprint.byteOrderMark === writeByteOrderMark && + if (mtimeBefore) { + var fingerprint = outputFingerprints.get(fileName); + if (fingerprint && + fingerprint.byteOrderMark === writeByteOrderMark && fingerprint.hash === hash && fingerprint.mtime.getTime() === mtimeBefore.getTime()) { return; @@ -51039,11 +51325,11 @@ var ts; } ts.sys.writeFile(fileName, data, writeByteOrderMark); var mtimeAfter = ts.sys.getModifiedTime(fileName); - outputFingerprints[fileName] = { + outputFingerprints.set(fileName, { hash: hash, byteOrderMark: writeByteOrderMark, mtime: mtimeAfter - }; + }); } function writeFile(fileName, data, writeByteOrderMark, onError) { try { @@ -51142,10 +51428,14 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_44 = names_1[_i]; - var result = name_44 in cache - ? cache[name_44] - : cache[name_44] = loader(name_44, containingFile); + var name = names_1[_i]; + var result = void 0; + if (cache.has(name)) { + result = cache.get(name); + } + else { + cache.set(name, result = loader(name, containingFile)); + } resolutions.push(result); } return resolutions; @@ -51254,7 +51544,7 @@ var ts; return program; function getCommonSourceDirectory() { if (commonSourceDirectory === undefined) { - var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary); + var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary); }); if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); } @@ -51273,7 +51563,7 @@ var ts; classifiableNames = ts.createMap(); for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var sourceFile = files_2[_i]; - ts.copyProperties(sourceFile.classifiableNames, classifiableNames); + ts.copyEntries(sourceFile.classifiableNames, classifiableNames); } } return classifiableNames; @@ -51456,7 +51746,7 @@ var ts; }; } function isSourceFileFromExternalLibrary(file) { - return sourceFilesFoundSearchingNodeModules[file.path]; + return sourceFilesFoundSearchingNodeModules.get(file.path); } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); @@ -51573,57 +51863,57 @@ var ts; return diagnostics; function walk(node) { switch (parent.kind) { - case 144: - case 147: + case 145: + case 148: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); return; } - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 184: - case 226: + case 153: case 185: - case 226: - case 224: + case 227: + case 186: + case 227: + case 225: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); return; } } switch (node.kind) { - case 235: + case 236: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 241: + case 242: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 256: + case 257: var heritageClause = node; if (heritageClause.token === 107) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 228: + case 229: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 231: + case 232: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 229: + case 230: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 230: + case 231: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 182: + case 183: var typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; @@ -51638,26 +51928,26 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 227: - case 149: - case 148: + case 228: case 150: + case 149: case 151: case 152: - case 184: - case 226: + case 153: case 185: - case 226: + case 227: + case 186: + case 227: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - case 206: + case 207: if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 206); + return checkModifiers(nodes, parent.kind === 207); } break; - case 147: + case 148: if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; @@ -51668,15 +51958,15 @@ var ts; return; } break; - case 144: + case 145: if (nodes === parent.modifiers) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); return; } break; - case 179: case 180: - case 199: + case 181: + case 200: if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); return; @@ -51766,7 +52056,7 @@ var ts; && !file.isDeclarationFile) { var externalHelpersModuleReference = ts.createSynthesizedNode(9); externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(236); + var importDecl = ts.createSynthesizedNode(237); importDecl.parent = file; externalHelpersModuleReference.parent = importDecl; imports = [externalHelpersModuleReference]; @@ -51784,9 +52074,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { + case 237: case 236: - case 235: - case 242: + case 243: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -51798,7 +52088,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 231: + case 232: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) { var moduleName = node.name; if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { @@ -51882,18 +52172,18 @@ var ts; if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } - if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) { - sourceFilesFoundSearchingNodeModules[file_1.path] = false; + if (file_1 && sourceFilesFoundSearchingNodeModules.get(file_1.path) && currentNodeModulesDepth == 0) { + sourceFilesFoundSearchingNodeModules.set(file_1.path, false); if (!options.noResolve) { processReferencedFiles(file_1, isDefaultLib); processTypeReferenceDirectives(file_1); } - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } - else if (file_1 && modulesWithElidedImports[file_1.path]) { + else if (file_1 && modulesWithElidedImports.get(file_1.path)) { if (currentNodeModulesDepth < maxNodeModuleJsDepth) { - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } } @@ -51909,7 +52199,7 @@ var ts; }); filesByName.set(path, file); if (file) { - sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0); + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); file.path = path; if (host.useCaseSensitiveFileNames()) { var existingFile = filesByNameIgnoreCase.get(path); @@ -51953,7 +52243,7 @@ var ts; } } function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { - var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); if (previousResolution && previousResolution.primary) { return; } @@ -51981,7 +52271,7 @@ var ts; fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); } if (saveResolution) { - resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective); } } function createDiagnostic(refFile, refPos, refEnd, message) { @@ -52022,7 +52312,7 @@ var ts; var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; if (elideImport) { - modulesWithElidedImports[file.path] = true; + modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); @@ -52040,8 +52330,8 @@ var ts; } function computeCommonSourceDirectory(sourceFiles) { var fileNames = []; - for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { - var file = sourceFiles_6[_i]; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var file = sourceFiles_5[_i]; if (!file.isDeclarationFile) { fileNames.push(file.fileName); } @@ -52052,8 +52342,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { - var sourceFile = sourceFiles_7[_i]; + for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { + var sourceFile = sourceFiles_6[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -52204,7 +52494,7 @@ var ts; if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); - ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) { + ts.forEachEmittedFile(emitHost, function (emitFileNames) { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); }); @@ -52421,33 +52711,33 @@ var ts; ts.emptyArray = []; function getMeaningFromDeclaration(node) { switch (node.kind) { - case 144: - case 224: - case 174: + case 145: + case 225: + case 175: + case 148: case 147: - case 146: - case 258: case 259: - case 261: - case 149: - case 148: + case 260: + case 262: case 150: + case 149: case 151: case 152: - case 226: - case 184: + case 153: + case 227: case 185: - case 257: + case 186: + case 258: return 1; - case 143: - case 228: + case 144: case 229: - case 161: - return 2; - case 227: case 230: - return 1 | 2; + case 162: + return 2; + case 228: case 231: + return 1 | 2; + case 232: if (ts.isAmbientModule(node)) { return 4 | 1; } @@ -52457,21 +52747,24 @@ var ts; else { return 4; } - case 239: case 240: - case 235: - case 236: case 241: + case 236: + case 237: case 242: + case 243: return 1 | 2 | 4; - case 262: + case 263: return 4 | 1; } return 1 | 2 | 4; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 241) { + if (node.kind === 263) { + return 1; + } + else if (node.parent.kind === 242) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -52493,15 +52786,15 @@ var ts; ts.getMeaningFromLocation = getMeaningFromLocation; function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 70); - if (node.parent.kind === 141 && + if (node.parent.kind === 142 && node.parent.right === node && - node.parent.parent.kind === 235) { + node.parent.parent.kind === 236) { return 1 | 2 | 4; } return 4; } function isInRightSideOfImport(node) { - while (node.parent.kind === 141) { + while (node.parent.kind === 142) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -52512,27 +52805,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 141) { - while (root.parent && root.parent.kind === 141) { + if (root.parent.kind === 142) { + while (root.parent && root.parent.kind === 142) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 157 && !isLastClause; + return root.parent.kind === 158 && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 177) { - while (root.parent && root.parent.kind === 177) { + if (root.parent.kind === 178) { + while (root.parent && root.parent.kind === 178) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 && root.parent.parent.kind === 256) { + if (!isLastClause && root.parent.kind === 200 && root.parent.parent.kind === 257) { var decl = root.parent.parent.parent; - return (decl.kind === 227 && root.parent.parent.token === 107) || - (decl.kind === 228 && root.parent.parent.token === 84); + return (decl.kind === 228 && root.parent.parent.token === 107) || + (decl.kind === 229 && root.parent.parent.token === 84); } return false; } @@ -52540,17 +52833,17 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 157 || - (node.parent.kind === 199 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + return node.parent.kind === 158 || + (node.parent.kind === 200 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || (node.kind === 98 && !ts.isPartOfExpression(node)) || - node.kind === 167; + node.kind === 168; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 179); + return isCallOrNewExpressionTarget(node, 180); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 180); + return isCallOrNewExpressionTarget(node, 181); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -52563,7 +52856,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 220 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 221 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -52573,13 +52866,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 && - (node.parent.kind === 216 || node.parent.kind === 215) && + (node.parent.kind === 217 || node.parent.kind === 216) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 && - node.parent.kind === 220 && + node.parent.kind === 221 && node.parent.label === node; } function isLabelName(node) { @@ -52587,15 +52880,15 @@ var ts; } ts.isLabelName = isLabelName; function isRightSideOfQualifiedName(node) { - return node.parent.kind === 141 && node.parent.right === node; + return node.parent.kind === 142 && node.parent.right === node; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 177 && node.parent.name === node; + return node && node.parent && node.parent.kind === 178 && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 231 && node.parent.name === node; + return node.parent.kind === 232 && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -52606,19 +52899,19 @@ var ts; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 || node.kind === 8) { switch (node.parent.kind) { + case 148: case 147: - case 146: - case 258: - case 261: + case 259: + case 262: + case 150: case 149: - case 148: - case 151: case 152: - case 231: + case 153: + case 232: return node.parent.name === node; - case 178: + case 179: return node.parent.argumentExpression === node; - case 142: + case 143: return true; } } @@ -52662,17 +52955,17 @@ var ts; return undefined; } switch (node.kind) { - case 262: + case 263: + case 150: case 149: - case 148: - case 226: - case 184: - case 151: - case 152: case 227: + case 185: + case 152: + case 153: case 228: - case 230: + case 229: case 231: + case 232: return node; } } @@ -52680,46 +52973,46 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 262: + case 263: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 231: + case 232: return ts.ScriptElementKind.moduleElement; - case 227: - case 197: + case 228: + case 198: return ts.ScriptElementKind.classElement; - case 228: return ts.ScriptElementKind.interfaceElement; - case 229: return ts.ScriptElementKind.typeElement; - case 230: return ts.ScriptElementKind.enumElement; - case 224: + case 229: return ts.ScriptElementKind.interfaceElement; + case 230: return ts.ScriptElementKind.typeElement; + case 231: return ts.ScriptElementKind.enumElement; + case 225: return getKindOfVariableDeclaration(node); - case 174: + case 175: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); + case 186: + case 227: case 185: - case 226: - case 184: return ts.ScriptElementKind.functionElement; - case 151: return ts.ScriptElementKind.memberGetAccessorElement; - case 152: return ts.ScriptElementKind.memberSetAccessorElement; + case 152: return ts.ScriptElementKind.memberGetAccessorElement; + case 153: return ts.ScriptElementKind.memberSetAccessorElement; + case 150: case 149: - case 148: return ts.ScriptElementKind.memberFunctionElement; + case 148: case 147: - case 146: return ts.ScriptElementKind.memberVariableElement; - case 155: return ts.ScriptElementKind.indexSignatureElement; - case 154: return ts.ScriptElementKind.constructSignatureElement; - case 153: return ts.ScriptElementKind.callSignatureElement; - case 150: return ts.ScriptElementKind.constructorImplementationElement; - case 143: return ts.ScriptElementKind.typeParameterElement; - case 261: return ts.ScriptElementKind.enumMemberElement; - case 144: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 235: - case 240: - case 237: - case 244: + case 156: return ts.ScriptElementKind.indexSignatureElement; + case 155: return ts.ScriptElementKind.constructSignatureElement; + case 154: return ts.ScriptElementKind.callSignatureElement; + case 151: return ts.ScriptElementKind.constructorImplementationElement; + case 144: return ts.ScriptElementKind.typeParameterElement; + case 262: return ts.ScriptElementKind.enumMemberElement; + case 145: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; + case 236: + case 241: case 238: + case 245: + case 239: return ts.ScriptElementKind.alias; - case 286: + case 287: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -52734,7 +53027,7 @@ var ts; } ts.getNodeKind = getNodeKind; function getStringLiteralTypeForNode(node, typeChecker) { - var searchNode = node.parent.kind === 171 ? node.parent : node; + var searchNode = node.parent.kind === 172 ? node.parent : node; var type = typeChecker.getTypeAtLocation(searchNode); if (type && type.flags & 32) { return type; @@ -52747,7 +53040,7 @@ var ts; case 98: return true; case 70: - return ts.identifierIsThisKeyword(node) && node.parent.kind === 144; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 145; default: return false; } @@ -52791,41 +53084,41 @@ var ts; return false; } switch (n.kind) { - case 227: case 228: - case 230: - case 176: - case 172: - case 161: - case 205: - case 232: + case 229: + case 231: + case 177: + case 173: + case 162: + case 206: case 233: - case 239: - case 243: + case 234: + case 240: + case 244: return nodeEndsWith(n, 17, sourceFile); - case 257: + case 258: return isCompletedNode(n.block, sourceFile); - case 180: + case 181: if (!n.arguments) { return true; } - case 179: - case 183: - case 166: + case 180: + case 184: + case 167: return nodeEndsWith(n, 19, sourceFile); - case 158: case 159: + case 160: return isCompletedNode(n.type, sourceFile); - case 150: case 151: case 152: - case 226: - case 184: - case 149: - case 148: - case 154: case 153: + case 227: case 185: + case 150: + case 149: + case 155: + case 154: + case 186: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -52833,65 +53126,65 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19, sourceFile); - case 231: + case 232: return n.body && isCompletedNode(n.body, sourceFile); - case 209: + case 210: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 208: + case 209: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 24); - case 175: - case 173: - case 178: - case 142: - case 163: + case 176: + case 174: + case 179: + case 143: + case 164: return nodeEndsWith(n, 21, sourceFile); - case 155: + case 156: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 21, sourceFile); - case 254: case 255: + case 256: return false; - case 212: case 213: case 214: - case 211: + case 215: + case 212: return isCompletedNode(n.statement, sourceFile); - case 210: + case 211: var hasWhileKeyword = findChildOfKind(n, 105, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 19, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 160: + case 161: return isCompletedNode(n.exprName, sourceFile); - case 187: - case 186: case 188: - case 195: + case 187: + case 189: case 196: + case 197: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 181: + case 182: return isCompletedNode(n.template, sourceFile); - case 194: + case 195: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 203: + case 204: return ts.nodeIsPresent(n.literal); - case 242: - case 236: + case 243: + case 237: return ts.nodeIsPresent(n.moduleSpecifier); - case 190: + case 191: return isCompletedNode(n.operand, sourceFile); - case 192: - return isCompletedNode(n.right, sourceFile); case 193: + return isCompletedNode(n.right, sourceFile); + case 194: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -52934,7 +53227,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 293 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 294 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -53069,7 +53362,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 262); + ts.Debug.assert(startNode !== undefined || n.kind === 263); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -53114,13 +53407,13 @@ var ts; if (token.kind === 26 && token.parent.kind === 10) { return true; } - if (token.kind === 26 && token.parent.kind === 253) { + if (token.kind === 26 && token.parent.kind === 254) { return true; } - if (token && token.kind === 17 && token.parent.kind === 253) { + if (token && token.kind === 17 && token.parent.kind === 254) { return true; } - if (token.kind === 26 && token.parent.kind === 250) { + if (token.kind === 26 && token.parent.kind === 251) { return true; } return false; @@ -53211,17 +53504,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 157 || node.kind === 179) { + if (node.kind === 158 || node.kind === 180) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 227 || node.kind === 228) { + if (ts.isFunctionLike(node) || node.kind === 228 || node.kind === 229) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 && n.kind <= 140; + return n.kind >= 0 && n.kind <= 141; } ts.isToken = isToken; function isWord(kind) { @@ -53280,18 +53573,18 @@ var ts; } ts.compareDataObjects = compareDataObjects; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 175 || - node.kind === 176) { - if (node.parent.kind === 192 && + if (node.kind === 176 || + node.kind === 177) { + if (node.parent.kind === 193 && node.parent.left === node && node.parent.operatorToken.kind === 57) { return true; } - if (node.parent.kind === 214 && + if (node.parent.kind === 215 && node.parent.initializer === node) { return true; } - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 258 ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 259 ? node.parent.parent : node.parent)) { return true; } } @@ -53319,10 +53612,30 @@ var ts; } } ts.isInNonReferenceComment = isInNonReferenceComment; + function createTextSpanFromNode(node, sourceFile) { + return ts.createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); + } + ts.createTextSpanFromNode = createTextSpanFromNode; + function isTypeKeyword(kind) { + switch (kind) { + case 118: + case 121: + case 129: + case 132: + case 133: + case 135: + case 136: + case 104: + return true; + default: + return false; + } + } + ts.isTypeKeyword = isTypeKeyword; })(ts || (ts = {})); (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 145; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -53498,7 +53811,7 @@ var ts; return location.getText(); } else if (ts.isStringOrNumericLiteral(location) && - location.parent.kind === 142) { + location.parent.kind === 143) { return location.text; } var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); @@ -53508,7 +53821,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 240 || location.parent.kind === 244) && + (location.parent.kind === 241 || location.parent.kind === 245) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -53617,89 +53930,89 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 206: + case 207: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 224: + case 225: + case 148: case 147: - case 146: return spanInVariableDeclaration(node); - case 144: + case 145: return spanInParameterDeclaration(node); - case 226: + case 227: + case 150: case 149: - case 148: - case 151: case 152: - case 150: - case 184: + case 153: + case 151: case 185: + case 186: return spanInFunctionDeclaration(node); - case 205: + case 206: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 232: + case 233: return spanInBlock(node); - case 257: + case 258: return spanInBlock(node.block); - case 208: + case 209: return textSpan(node.expression); - case 217: + case 218: return textSpan(node.getChildAt(0), node.expression); - case 211: + case 212: return textSpanEndingAtNextToken(node, node.expression); - case 210: + case 211: return spanInNode(node.statement); - case 223: + case 224: return textSpan(node.getChildAt(0)); - case 209: + case 210: return textSpanEndingAtNextToken(node, node.expression); - case 220: + case 221: return spanInNode(node.statement); + case 217: case 216: - case 215: return textSpan(node.getChildAt(0), node.label); - case 212: - return spanInForStatement(node); case 213: - return textSpanEndingAtNextToken(node, node.expression); + return spanInForStatement(node); case 214: + return textSpanEndingAtNextToken(node, node.expression); + case 215: return spanInInitializerOfForLike(node); - case 219: + case 220: return textSpanEndingAtNextToken(node, node.expression); - case 254: case 255: + case 256: return spanInNode(node.statements[0]); - case 222: + case 223: return spanInBlock(node.tryBlock); - case 221: + case 222: return textSpan(node, node.expression); - case 241: + case 242: return textSpan(node, node.expression); - case 235: - return textSpan(node, node.moduleReference); case 236: + return textSpan(node, node.moduleReference); + case 237: return textSpan(node, node.moduleSpecifier); - case 242: + case 243: return textSpan(node, node.moduleSpecifier); - case 231: + case 232: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 227: - case 230: - case 261: - case 174: + case 228: + case 231: + case 262: + case 175: return textSpan(node); - case 218: + case 219: return spanInNode(node.statement); - case 145: + case 146: return spanInNodeArray(node.parent.decorators); - case 172: case 173: + case 174: return spanInBindingPattern(node); - case 228: case 229: + case 230: return undefined; case 24: case 1: @@ -53727,20 +54040,20 @@ var ts; case 73: case 86: return spanInNextNode(node); - case 140: + case 141: return spanInOfKeyword(node); default: if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); } if ((node.kind === 70 || - node.kind == 196 || - node.kind === 258 || - node.kind === 259) && + node.kind == 197 || + node.kind === 259 || + node.kind === 260) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 192) { + if (node.kind === 193) { var binaryExpression = node; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left); @@ -53755,38 +54068,38 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 210: + case 211: return spanInPreviousNode(node); - case 145: + case 146: return spanInNode(node.parent); - case 212: - case 214: + case 213: + case 215: return textSpan(node); - case 192: + case 193: if (node.parent.operatorToken.kind === 25) { return textSpan(node); } break; - case 185: + case 186: if (node.parent.body === node) { return textSpan(node); } break; } } - if (node.parent.kind === 258 && + if (node.parent.kind === 259 && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 182 && node.parent.type === node) { + if (node.parent.kind === 183 && node.parent.type === node) { return spanInNextNode(node.parent.type); } if (ts.isFunctionLike(node.parent) && node.parent.type === node) { return spanInPreviousNode(node); } - if ((node.parent.kind === 224 || - node.parent.kind === 144)) { + if ((node.parent.kind === 225 || + node.parent.kind === 145)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -53794,7 +54107,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 192) { + if (node.parent.kind === 193) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -53815,7 +54128,7 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 213) { + if (variableDeclaration.parent.parent.kind === 214) { return spanInNode(variableDeclaration.parent.parent); } if (ts.isBindingPattern(variableDeclaration.name)) { @@ -53823,7 +54136,7 @@ var ts; } if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1) || - variableDeclaration.parent.parent.kind === 214) { + variableDeclaration.parent.parent.kind === 215) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -53855,7 +54168,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1) || - (functionDeclaration.parent.kind === 227 && functionDeclaration.kind !== 150); + (functionDeclaration.parent.kind === 228 && functionDeclaration.kind !== 151); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -53875,22 +54188,22 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 231: + case 232: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 211: - case 209: - case 213: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 212: + case 210: case 214: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 213: + case 215: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 225) { + if (forLikeStatement.initializer.kind === 226) { var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -53912,62 +54225,62 @@ var ts; } } function spanInBindingPattern(bindingPattern) { - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 198 ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 199 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - if (bindingPattern.parent.kind === 174) { + if (bindingPattern.parent.kind === 175) { return textSpan(bindingPattern.parent); } return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 173 && node.kind !== 172); - var elements = node.kind === 175 ? + ts.Debug.assert(node.kind !== 174 && node.kind !== 173); + var elements = node.kind === 176 ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 198 ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 199 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - return textSpan(node.parent.kind === 192 ? node.parent : node); + return textSpan(node.parent.kind === 193 ? node.parent : node); } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 230: + case 231: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 227: + case 228: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 233: + case 234: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 232: + case 233: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 230: - case 227: + case 231: + case 228: return textSpan(node); - case 205: + case 206: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 257: + case 258: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 233: + case 234: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 172: + case 173: var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -53980,7 +54293,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 173: + case 174: var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -53992,33 +54305,33 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 210 || - node.parent.kind === 179 || - node.parent.kind === 180) { + if (node.parent.kind === 211 || + node.parent.kind === 180 || + node.parent.kind === 181) { return spanInPreviousNode(node); } - if (node.parent.kind === 183) { + if (node.parent.kind === 184) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 184: - case 226: case 185: + case 227: + case 186: + case 150: case 149: - case 148: - case 151: case 152: - case 150: - case 211: - case 210: + case 153: + case 151: case 212: - case 214: - case 179: + case 211: + case 213: + case 215: case 180: - case 183: + case 181: + case 184: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -54026,26 +54339,26 @@ var ts; } function spanInColonToken(node) { if (ts.isFunctionLike(node.parent) || - node.parent.kind === 258 || - node.parent.kind === 144) { + node.parent.kind === 259 || + node.parent.kind === 145) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 182) { + if (node.parent.kind === 183) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 210) { + if (node.parent.kind === 211) { return textSpanEndingAtNextToken(node, node.parent.expression); } return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 214) { + if (node.parent.kind === 215) { return spanInNextNode(node); } return spanInNode(node.parent); @@ -54076,7 +54389,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 124 || - keyword2 === 133 || + keyword2 === 134 || keyword2 === 122 || keyword2 === 114) { return true; @@ -54192,10 +54505,10 @@ var ts; angleBracketStack--; } else if (token === 118 || - token === 134 || + token === 135 || token === 132 || token === 121 || - token === 135) { + token === 136) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 70; } @@ -54350,7 +54663,7 @@ var ts; } } function isKeyword(token) { - return token >= 71 && token <= 140; + return token >= 71 && token <= 141; } function classFromKind(token) { if (isKeyword(token)) { @@ -54396,10 +54709,10 @@ var ts; ts.getSemanticClassifications = getSemanticClassifications; function checkForClassificationCancellation(cancellationToken, kind) { switch (kind) { - case 231: - case 227: + case 232: case 228: - case 226: + case 229: + case 227: cancellationToken.throwIfCancellationRequested(); } } @@ -54443,7 +54756,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 231 && + return declaration.kind === 232 && ts.getModuleInstanceState(declaration) === 1; }); } @@ -54454,7 +54767,7 @@ var ts; checkForClassificationCancellation(cancellationToken, kind); if (kind === 70 && !ts.nodeIsMissing(node)) { var identifier = node; - if (classifiableNames[identifier.text]) { + if (classifiableNames.get(identifier.text)) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var type = classifySymbol(symbol, ts.getMeaningFromLocation(node)); @@ -54584,16 +54897,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 282: + case 283: processJSDocParameterTag(tag); break; - case 285: + case 286: processJSDocTemplateTag(tag); break; - case 284: + case 285: processElement(tag.typeExpression); break; - case 283: + case 284: processElement(tag.typeExpression); break; } @@ -54674,22 +54987,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 249: + case 250: if (token.parent.tagName === token) { return 19; } break; - case 250: + case 251: if (token.parent.tagName === token) { return 20; } break; - case 248: + case 249: if (token.parent.tagName === token) { return 21; } break; - case 251: + case 252: if (token.parent.name === token) { return 22; } @@ -54709,17 +55022,17 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 57) { - if (token.parent.kind === 224 || - token.parent.kind === 147 || - token.parent.kind === 144 || - token.parent.kind === 251) { + if (token.parent.kind === 225 || + token.parent.kind === 148 || + token.parent.kind === 145 || + token.parent.kind === 252) { return 5; } } - if (token.parent.kind === 192 || - token.parent.kind === 190 || + if (token.parent.kind === 193 || token.parent.kind === 191 || - token.parent.kind === 193) { + token.parent.kind === 192 || + token.parent.kind === 194) { return 5; } } @@ -54729,7 +55042,7 @@ var ts; return 4; } else if (tokenKind === 9) { - return token.parent.kind === 251 ? 24 : 6; + return token.parent.kind === 252 ? 24 : 6; } else if (tokenKind === 11) { return 6; @@ -54743,32 +55056,32 @@ var ts; else if (tokenKind === 70) { if (token) { switch (token.parent.kind) { - case 227: + case 228: if (token.parent.name === token) { return 11; } return; - case 143: + case 144: if (token.parent.name === token) { return 15; } return; - case 228: + case 229: if (token.parent.name === token) { return 13; } return; - case 230: + case 231: if (token.parent.name === token) { return 12; } return; - case 231: + case 232: if (token.parent.name === token) { return 14; } return; - case 144: + case 145: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 : 17; } @@ -54801,10 +55114,10 @@ var ts; (function (Completions) { function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { if (ts.isInReferenceComment(sourceFile, position)) { - return getTripleSlashReferenceCompletion(sourceFile, position); + return getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); } if (ts.isInString(sourceFile, position)) { - return getStringLiteralCompletionEntries(sourceFile, position); + return getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log); } var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (!completionData) { @@ -54816,13 +55129,13 @@ var ts; } var entries = []; if (ts.isSourceFileJavaScript(sourceFile)) { - var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true, typeChecker, compilerOptions.target, log); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target)); } else { if (!symbols || symbols.length === 0) { if (sourceFile.languageVariant === 1 && - location.parent && location.parent.kind === 250) { + location.parent && location.parent.kind === 251) { var tagName = location.parent.parent.openingElement.tagName; entries.push({ name: tagName.text, @@ -54835,531 +55148,535 @@ var ts; return undefined; } } - getCompletionEntriesFromSymbols(symbols, entries, location, true); + getCompletionEntriesFromSymbols(symbols, entries, location, true, typeChecker, compilerOptions.target, log); } if (!isMemberCompletion && !isJsDocTagName) { ts.addRange(entries, keywordCompletions); } return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { - var entries = []; - var nameTable = ts.getNameTable(sourceFile); - for (var name_45 in nameTable) { - if (nameTable[name_45] === position) { - continue; + } + Completions.getCompletionsAtPosition = getCompletionsAtPosition; + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames, target) { + var entries = []; + var nameTable = ts.getNameTable(sourceFile); + nameTable.forEach(function (pos, name) { + if (pos === position) { + return; + } + if (!uniqueNames.get(name)) { + uniqueNames.set(name, name); + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name), target, true); + if (displayName) { + var entry = { + name: displayName, + kind: ts.ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } - if (!uniqueNames[name_45]) { - uniqueNames[name_45] = name_45; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, true); - if (displayName) { - var entry = { - name: displayName, - kind: ts.ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; + } + }); + return entries; + } + function createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target) { + var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location); + if (!displayName) { + return undefined; + } + return { + name: displayName, + kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), + kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), + sortText: "0", + }; + } + function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks, typeChecker, target, log) { + var start = ts.timestamp(); + var uniqueNames = ts.createMap(); + if (symbols) { + for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { + var symbol = symbols_4[_i]; + var entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!uniqueNames.get(id)) { entries.push(entry); + uniqueNames.set(id, id); } } } - return entries; } - function createCompletionEntry(symbol, location, performCharacterChecks) { - var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location); - if (!displayName) { - return undefined; - } - return { - name: displayName, - kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - sortText: "0", - }; + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); + return uniqueNames; + } + function getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log) { + var node = ts.findPrecedingToken(position, sourceFile); + if (!node || node.kind !== 9) { + return undefined; } - function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) { - var start = ts.timestamp(); - var uniqueNames = ts.createMap(); - if (symbols) { - for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { - var symbol = symbols_4[_i]; - var entry = createCompletionEntry(symbol, location, performCharacterChecks); - if (entry) { - var id = ts.escapeIdentifier(entry.name); - if (!uniqueNames[id]) { - entries.push(entry); - uniqueNames[id] = id; - } - } - } - } - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); - return uniqueNames; + if (node.parent.kind === 259 && + node.parent.parent.kind === 177 && + node.parent.name === node) { + return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent, typeChecker, compilerOptions.target, log); } - function getStringLiteralCompletionEntries(sourceFile, position) { - var node = ts.findPrecedingToken(position, sourceFile); - if (!node || node.kind !== 9) { - return undefined; - } - if (node.parent.kind === 258 && - node.parent.parent.kind === 176 && - node.parent.name === node) { - return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); - } - else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { - return getStringLiteralCompletionEntriesFromElementAccess(node.parent); - } - else if (node.parent.kind === 236 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { - return getStringLiteralCompletionEntriesFromModuleNames(node); - } - else { - var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo) { - return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo); - } - return getStringLiteralCompletionEntriesFromContextualType(node); - } + else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { + return getStringLiteralCompletionEntriesFromElementAccess(node.parent, typeChecker, compilerOptions.target, log); } - function getStringLiteralCompletionEntriesFromPropertyAssignment(element) { - var type = typeChecker.getContextualType(element.parent); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } + else if (node.parent.kind === 237 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { + return getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker); + } + else if (isEqualityExpression(node.parent)) { + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.left === node ? node.parent.right : node.parent.left), typeChecker); + } + else if (ts.isCaseOrDefaultClause(node.parent)) { + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.parent.parent.expression), typeChecker); + } + else { + var argumentInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); + if (argumentInfo) { + return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker); } + return getStringLiteralCompletionEntriesFromType(typeChecker.getContextualType(node), typeChecker); } - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) { - var candidates = []; - var entries = []; - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); - for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { - var candidate = candidates_3[_i]; - if (candidate.parameters.length > argumentInfo.argumentIndex) { - var parameter = candidate.parameters[argumentInfo.argumentIndex]; - addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries); - } + } + function getStringLiteralCompletionEntriesFromPropertyAssignment(element, typeChecker, target, log) { + var type = typeChecker.getContextualType(element.parent); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, false, typeChecker, target, log); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; } + } + } + function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker) { + var candidates = []; + var entries = []; + typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); + for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { + var candidate = candidates_3[_i]; + addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries, typeChecker); + } + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; + } + return undefined; + } + function getStringLiteralCompletionEntriesFromElementAccess(node, typeChecker, target, log) { + var type = typeChecker.getTypeAtLocation(node.expression); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, false, typeChecker, target, log); if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; } - return undefined; } - function getStringLiteralCompletionEntriesFromElementAccess(node) { - var type = typeChecker.getTypeAtLocation(node.expression); + return undefined; + } + function getStringLiteralCompletionEntriesFromType(type, typeChecker) { + if (type) { var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } + addStringLiteralCompletionsFromType(type, entries, typeChecker); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; } - return undefined; } - function getStringLiteralCompletionEntriesFromContextualType(node) { - var type = typeChecker.getContextualType(node); - if (type) { - var entries_2 = []; - addStringLiteralCompletionsFromType(type, entries_2); - if (entries_2.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 }; - } - } - return undefined; + return undefined; + } + function addStringLiteralCompletionsFromType(type, result, typeChecker) { + if (type && type.flags & 16384) { + type = typeChecker.getApparentType(type); } - function addStringLiteralCompletionsFromType(type, result) { - if (type && type.flags & 16384) { - type = typeChecker.getApparentType(type); - } - if (!type) { - return; - } - if (type.flags & 65536) { - ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); }); - } - else { - if (type.flags & 32) { - result.push({ - name: type.text, - kindModifiers: ts.ScriptElementKindModifier.none, - kind: ts.ScriptElementKind.variableElement, - sortText: "0" - }); - } + if (!type) { + return; + } + if (type.flags & 65536) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + addStringLiteralCompletionsFromType(t, result, typeChecker); } } - function getStringLiteralCompletionEntriesFromModuleNames(node) { - var literalValue = ts.normalizeSlashes(node.text); - var scriptPath = node.getSourceFile().path; - var scriptDirectory = ts.getDirectoryPath(scriptPath); - var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); - var entries; - if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { - if (compilerOptions.rootDirs) { - entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath); - } - else { - entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath); - } + else if (type.flags & 32) { + result.push({ + name: type.text, + kindModifiers: ts.ScriptElementKindModifier.none, + kind: ts.ScriptElementKind.variableElement, + sortText: "0" + }); + } + } + function getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker) { + var literalValue = ts.normalizeSlashes(node.text); + var scriptPath = node.getSourceFile().path; + var scriptDirectory = ts.getDirectoryPath(scriptPath); + var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); + var entries; + if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { + var extensions = ts.getSupportedExtensions(compilerOptions); + if (compilerOptions.rootDirs) { + entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, extensions, false, span, compilerOptions, host, scriptPath); } else { - entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span); + entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensions, false, span, host, scriptPath); } - return { - isGlobalCompletion: false, - isMemberCompletion: false, - isNewIdentifierLocation: true, - entries: entries - }; } - function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { - rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); - var relativeDirectory; - for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) { - var rootDirectory = rootDirs_1[_i]; - if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { - relativeDirectory = scriptPath.substr(rootDirectory.length); - break; - } - } - return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); + else { + entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span, compilerOptions, host, typeChecker); } - function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) { - var basePath = compilerOptions.project || host.getCurrentDirectory(); - var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); - var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); - var result = []; - for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { - var baseDirectory = baseDirectories_1[_i]; - getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result); + return { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: true, + entries: entries + }; + } + function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { + rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); + var relativeDirectory; + for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) { + var rootDirectory = rootDirs_1[_i]; + if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { + relativeDirectory = scriptPath.substr(rootDirectory.length); + break; } - return result; } - function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) { - if (result === void 0) { result = []; } - if (fragment === undefined) { - fragment = ""; - } - fragment = ts.normalizeSlashes(fragment); - fragment = ts.getDirectoryPath(fragment); - if (fragment === "") { - fragment = "." + ts.directorySeparator; - } - fragment = ts.ensureTrailingDirectorySeparator(fragment); - var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment)); - var baseDirectory = ts.getDirectoryPath(absolutePath); - var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); - if (tryDirectoryExists(host, baseDirectory)) { - var files = tryReadDirectory(host, baseDirectory, extensions, undefined, ["./*"]); - if (files) { - var foundFiles = ts.createMap(); - for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { - var filePath = files_3[_i]; - filePath = ts.normalizePath(filePath); - if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0) { - continue; - } - var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); - if (!foundFiles[foundFileName]) { - foundFiles[foundFileName] = true; - } + return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); + } + function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, compilerOptions, host, exclude) { + var basePath = compilerOptions.project || host.getCurrentDirectory(); + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); + var result = []; + for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { + var baseDirectory = baseDirectories_1[_i]; + getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, host, exclude, result); + } + return result; + } + function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, host, exclude, result) { + if (result === void 0) { result = []; } + if (fragment === undefined) { + fragment = ""; + } + fragment = ts.normalizeSlashes(fragment); + fragment = ts.getDirectoryPath(fragment); + if (fragment === "") { + fragment = "." + ts.directorySeparator; + } + fragment = ts.ensureTrailingDirectorySeparator(fragment); + var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment)); + var baseDirectory = ts.getDirectoryPath(absolutePath); + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + if (tryDirectoryExists(host, baseDirectory)) { + var files = tryReadDirectory(host, baseDirectory, extensions, undefined, ["./*"]); + if (files) { + var foundFiles = ts.createMap(); + for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { + var filePath = files_3[_i]; + filePath = ts.normalizePath(filePath); + if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0) { + continue; } - for (var foundFile in foundFiles) { - result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); + var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); + if (!foundFiles.get(foundFileName)) { + foundFiles.set(foundFileName, true); } } - var directories = tryGetDirectories(host, baseDirectory); - if (directories) { - for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) { - var directory = directories_2[_a]; - var directoryName = ts.getBaseFileName(ts.normalizePath(directory)); - result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span)); - } + ts.forEachKey(foundFiles, function (foundFile) { + result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); + }); + } + var directories = tryGetDirectories(host, baseDirectory); + if (directories) { + for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) { + var directory = directories_2[_a]; + var directoryName = ts.getBaseFileName(ts.normalizePath(directory)); + result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span)); } } - return result; } - function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) { - var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; - var result; - if (baseUrl) { - var fileExtensions = ts.getSupportedExtensions(compilerOptions); - var projectDir = compilerOptions.project || host.getCurrentDirectory(); - var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); - result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, false, span); - if (paths) { - for (var path in paths) { - if (paths.hasOwnProperty(path)) { - if (path === "*") { - if (paths[path]) { - for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { - var pattern = _a[_i]; - for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) { - var match = _c[_b]; - result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); - } + return result; + } + function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span, compilerOptions, host, typeChecker) { + var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; + var result; + if (baseUrl) { + var fileExtensions = ts.getSupportedExtensions(compilerOptions); + var projectDir = compilerOptions.project || host.getCurrentDirectory(); + var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); + result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, false, span, host); + if (paths) { + for (var path in paths) { + if (paths.hasOwnProperty(path)) { + if (path === "*") { + if (paths[path]) { + for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { + var pattern = _a[_i]; + for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host); _b < _c.length; _b++) { + var match = _c[_b]; + result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); } } } - else if (ts.startsWith(path, fragment)) { - var entry = paths[path] && paths[path].length === 1 && paths[path][0]; - if (entry) { - result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span)); - } + } + else if (ts.startsWith(path, fragment)) { + var entry = paths[path] && paths[path].length === 1 && paths[path][0]; + if (entry) { + result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span)); } } } } } - else { - result = []; - } - getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); - for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) { - var moduleName = _e[_d]; - result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); - } - return result; } - function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) { - if (host.readDirectory) { - var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; - if (parsed) { - var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix); - var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix); - var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix); - var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1; - var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory; - var normalizedSuffix = ts.normalizePath(parsed.suffix); - var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory); - var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; - var includeGlob = normalizedSuffix ? "**/*" : "./*"; - var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); - if (matches) { - var result = []; - for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { - var match = matches_1[_i]; - var normalizedMatch = ts.normalizePath(match); - if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) { - continue; - } - var start = completePrefix.length; - var length_5 = normalizedMatch.length - start - normalizedSuffix.length; - result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); + else { + result = []; + } + getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); + for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host); _d < _e.length; _d++) { + var moduleName = _e[_d]; + result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); + } + return result; + } + function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) { + if (host.readDirectory) { + var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; + if (parsed) { + var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix); + var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix); + var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix); + var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1; + var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory; + var normalizedSuffix = ts.normalizePath(parsed.suffix); + var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory); + var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; + var includeGlob = normalizedSuffix ? "**/*" : "./*"; + var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); + if (matches) { + var result = []; + for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { + var match = matches_1[_i]; + var normalizedMatch = ts.normalizePath(match); + if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) { + continue; } - return result; + var start = completePrefix.length; + var length_5 = normalizedMatch.length - start - normalizedSuffix.length; + result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); } + return result; } } - return undefined; } - function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) { - var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; - var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; - var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); }); - var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); }); - if (isNestedModule) { - var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment); - nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) { - if (ts.startsWith(fragment, moduleNameWithSeperator_1)) { - return moduleName.substr(moduleNameWithSeperator_1.length); - } - return moduleName; - }); - } - if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) { - for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) { - var visibleModule = _a[_i]; - if (!isNestedModule) { - nonRelativeModules.push(visibleModule.moduleName); - } - else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) { - var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, undefined, ["./*"]); - if (nestedFiles) { - for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) { - var f = nestedFiles_1[_b]; - f = ts.normalizePath(f); - var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f)); - nonRelativeModules.push(nestedModule); - } + return undefined; + } + function enumeratePotentialNonRelativeModules(fragment, scriptPath, options, typeChecker, host) { + var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; + var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; + var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); }); + var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); }); + if (isNestedModule) { + var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment); + nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) { + if (ts.startsWith(fragment, moduleNameWithSeperator_1)) { + return moduleName.substr(moduleNameWithSeperator_1.length); + } + return moduleName; + }); + } + if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) { + for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) { + var visibleModule = _a[_i]; + if (!isNestedModule) { + nonRelativeModules.push(visibleModule.moduleName); + } + else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) { + var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, undefined, ["./*"]); + if (nestedFiles) { + for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) { + var f = nestedFiles_1[_b]; + f = ts.normalizePath(f); + var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f)); + nonRelativeModules.push(nestedModule); } } } } - return ts.deduplicate(nonRelativeModules); } - function getTripleSlashReferenceCompletion(sourceFile, position) { - var token = ts.getTokenAtPosition(sourceFile, position); - if (!token) { - return undefined; - } - var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); - if (!commentRanges || !commentRanges.length) { - return undefined; + return ts.deduplicate(nonRelativeModules); + } + function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) { + var token = ts.getTokenAtPosition(sourceFile, position); + if (!token) { + return undefined; + } + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + if (!commentRanges || !commentRanges.length) { + return undefined; + } + var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; }); + if (!range) { + return undefined; + } + var completionInfo = { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: true, + entries: [] + }; + var text = sourceFile.text.substr(range.pos, position - range.pos); + var match = tripleSlashDirectiveFragmentRegex.exec(text); + if (match) { + var prefix = match[1]; + var kind = match[2]; + var toComplete = match[3]; + var scriptPath = ts.getDirectoryPath(sourceFile.path); + if (kind === "path") { + var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); + completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), true, span_10, host, sourceFile.path); } - var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; }); - if (!range) { - return undefined; + else { + var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; + completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11); } - var completionInfo = { - isGlobalCompletion: false, - isMemberCompletion: false, - isNewIdentifierLocation: true, - entries: [] - }; - var text = sourceFile.text.substr(range.pos, position - range.pos); - var match = tripleSlashDirectiveFragmentRegex.exec(text); - if (match) { - var prefix = match[1]; - var kind = match[2]; - var toComplete = match[3]; - var scriptPath = ts.getDirectoryPath(sourceFile.path); - if (kind === "path") { - var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); - completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), true, span_10, sourceFile.path); - } - else { - var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; - completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11); - } + } + return completionInfo; + } + function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { + if (result === void 0) { result = []; } + if (options.types) { + for (var _i = 0, _a = options.types; _i < _a.length; _i++) { + var moduleName = _a[_i]; + result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); } - return completionInfo; } - function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { - if (result === void 0) { result = []; } - if (options.types) { - for (var _i = 0, _a = options.types; _i < _a.length; _i++) { - var moduleName = _a[_i]; - result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); - } + else if (host.getDirectories) { + var typeRoots = void 0; + try { + typeRoots = ts.getEffectiveTypeRoots(options, host); } - else if (host.getDirectories) { - var typeRoots = void 0; - try { - typeRoots = ts.getEffectiveTypeRoots(options, host); - } - catch (e) { } - if (typeRoots) { - for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) { - var root = typeRoots_2[_b]; - getCompletionEntriesFromDirectories(host, root, span, result); - } + catch (e) { } + if (typeRoots) { + for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) { + var root = typeRoots_2[_b]; + getCompletionEntriesFromDirectories(host, root, span, result); } } - if (host.getDirectories) { - for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) { - var packageJson = _d[_c]; - var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); - getCompletionEntriesFromDirectories(host, typesDir, span, result); - } + } + if (host.getDirectories) { + for (var _c = 0, _d = findPackageJsons(scriptPath, host); _c < _d.length; _c++) { + var packageJson = _d[_c]; + var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); + getCompletionEntriesFromDirectories(host, typesDir, span, result); } - return result; } - function getCompletionEntriesFromDirectories(host, directory, span, result) { - if (host.getDirectories && tryDirectoryExists(host, directory)) { - var directories = tryGetDirectories(host, directory); - if (directories) { - for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) { - var typeDirectory = directories_3[_i]; - typeDirectory = ts.normalizePath(typeDirectory); - result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span)); - } + return result; + } + function getCompletionEntriesFromDirectories(host, directory, span, result) { + if (host.getDirectories && tryDirectoryExists(host, directory)) { + var directories = tryGetDirectories(host, directory); + if (directories) { + for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) { + var typeDirectory = directories_3[_i]; + typeDirectory = ts.normalizePath(typeDirectory); + result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span)); } } } - function findPackageJsons(currentDir) { - var paths = []; - var currentConfigPath; - while (true) { - currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, "package.json"); - if (currentConfigPath) { - paths.push(currentConfigPath); - currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_14 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_14) { - break; - } - currentDir = parent_14; - } - else { + } + function findPackageJsons(currentDir, host) { + var paths = []; + var currentConfigPath; + while (true) { + currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, "package.json"); + if (currentConfigPath) { + paths.push(currentConfigPath); + currentDir = ts.getDirectoryPath(currentConfigPath); + var parent = ts.getDirectoryPath(currentDir); + if (currentDir === parent) { break; } + currentDir = parent; } - return paths; - } - function enumerateNodeModulesVisibleToScript(host, scriptPath) { - var result = []; - if (host.readFile && host.fileExists) { - for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) { - var packageJson = _a[_i]; - var contents = tryReadingPackageJson(packageJson); - if (!contents) { - return; - } - var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules"); - var foundModuleNames = []; - for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) { - var key = nodeModulesDependencyKeys_1[_b]; - addPotentialPackageNames(contents[key], foundModuleNames); - } - for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) { - var moduleName = foundModuleNames_1[_c]; - var moduleDir = ts.combinePaths(nodeModulesDir, moduleName); - result.push({ - moduleName: moduleName, - moduleDir: moduleDir - }); - } - } + else { + break; } - return result; - function tryReadingPackageJson(filePath) { - try { - var fileText = tryReadFile(host, filePath); - return fileText ? JSON.parse(fileText) : undefined; + } + return paths; + } + function enumerateNodeModulesVisibleToScript(host, scriptPath) { + var result = []; + if (host.readFile && host.fileExists) { + for (var _i = 0, _a = findPackageJsons(scriptPath, host); _i < _a.length; _i++) { + var packageJson = _a[_i]; + var contents = tryReadingPackageJson(packageJson); + if (!contents) { + return; } - catch (e) { - return undefined; + var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules"); + var foundModuleNames = []; + for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) { + var key = nodeModulesDependencyKeys_1[_b]; + addPotentialPackageNames(contents[key], foundModuleNames); } - } - function addPotentialPackageNames(dependencies, result) { - if (dependencies) { - for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { - result.push(dep); - } - } + for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) { + var moduleName = foundModuleNames_1[_c]; + var moduleDir = ts.combinePaths(nodeModulesDir, moduleName); + result.push({ + moduleName: moduleName, + moduleDir: moduleDir + }); } } } - function createCompletionEntryForModule(name, kind, replacementSpan) { - return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan }; - } - function getDirectoryFragmentTextSpan(text, textStart) { - var index = text.lastIndexOf(ts.directorySeparator); - var offset = index !== -1 ? index + 1 : 0; - return { start: textStart + offset, length: text.length - offset }; + return result; + function tryReadingPackageJson(filePath) { + try { + var fileText = tryReadFile(host, filePath); + return fileText ? JSON.parse(fileText) : undefined; + } + catch (e) { + return undefined; + } } - function isPathRelativeToScript(path) { - if (path && path.length >= 2 && path.charCodeAt(0) === 46) { - var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 ? 2 : 1; - var slashCharCode = path.charCodeAt(slashIndex); - return slashCharCode === 47 || slashCharCode === 92; + function addPotentialPackageNames(dependencies, result) { + if (dependencies) { + for (var dep in dependencies) { + if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + result.push(dep); + } + } } - return false; } - function normalizeAndPreserveTrailingSlash(path) { - return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); + } + function createCompletionEntryForModule(name, kind, replacementSpan) { + return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan }; + } + function getDirectoryFragmentTextSpan(text, textStart) { + var index = text.lastIndexOf(ts.directorySeparator); + var offset = index !== -1 ? index + 1 : 0; + return { start: textStart + offset, length: text.length - offset }; + } + function isPathRelativeToScript(path) { + if (path && path.length >= 2 && path.charCodeAt(0) === 46) { + var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 ? 2 : 1; + var slashCharCode = path.charCodeAt(slashIndex); + return slashCharCode === 47 || slashCharCode === 92; } + return false; + } + function normalizeAndPreserveTrailingSlash(path) { + return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); } - Completions.getCompletionsAtPosition = getCompletionsAtPosition; function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) { var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_3 = completionData.location; - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; }); + var symbols = completionData.symbols, location_1 = completionData.location; + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_1) === entryName ? s : undefined; }); if (symbol) { - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_1, location_1, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { name: entryName, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), @@ -55385,8 +55702,8 @@ var ts; function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) { var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_4 = completionData.location; - return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_4) === entryName ? s : undefined; }); + var symbols = completionData.symbols, location_2 = completionData.location; + return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_2) === entryName ? s : undefined; }); } return undefined; } @@ -55411,9 +55728,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 284: - case 282: + case 285: case 283: + case 284: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -55448,13 +55765,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_15 = contextToken.parent, kind = contextToken.kind; + var parent = contextToken.parent, kind = contextToken.kind; if (kind === 22) { - if (parent_15.kind === 177) { + if (parent.kind === 178) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_15.kind === 141) { + else if (parent.kind === 142) { node = contextToken.parent.left; isRightOfDot = true; } @@ -55467,7 +55784,7 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 40 && contextToken.parent.kind === 250) { + else if (kind === 40 && contextToken.parent.kind === 251) { isStartingCloseTag = true; location = contextToken; } @@ -55512,7 +55829,7 @@ var ts; isGlobalCompletion = false; isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 70 || node.kind === 141 || node.kind === 177) { + if (node.kind === 70 || node.kind === 142 || node.kind === 178) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { symbol = typeChecker.getAliasedSymbol(symbol); @@ -55558,7 +55875,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 248) || (jsxContainer.kind === 249)) { + if ((jsxContainer.kind === 249) || (jsxContainer.kind === 250)) { attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); @@ -55579,9 +55896,9 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 262 || - scopeNode.kind === 194 || - scopeNode.kind === 253 || + scopeNode.kind === 263 || + scopeNode.kind === 195 || + scopeNode.kind === 254 || ts.isStatement(scopeNode); } var symbolMeanings = 793064 | 107455 | 1920 | 8388608; @@ -55609,11 +55926,11 @@ var ts; return true; } if (contextToken.kind === 28 && contextToken.parent) { - if (contextToken.parent.kind === 249) { + if (contextToken.parent.kind === 250) { return true; } - if (contextToken.parent.kind === 250 || contextToken.parent.kind === 248) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 247; + if (contextToken.parent.kind === 251 || contextToken.parent.kind === 249) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 248; } } return false; @@ -55623,40 +55940,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 25: - return containingNodeKind === 179 - || containingNodeKind === 150 - || containingNodeKind === 180 - || containingNodeKind === 175 - || containingNodeKind === 192 - || containingNodeKind === 158; + return containingNodeKind === 180 + || containingNodeKind === 151 + || containingNodeKind === 181 + || containingNodeKind === 176 + || containingNodeKind === 193 + || containingNodeKind === 159; case 18: - return containingNodeKind === 179 - || containingNodeKind === 150 - || containingNodeKind === 180 - || containingNodeKind === 183 - || containingNodeKind === 166; + return containingNodeKind === 180 + || containingNodeKind === 151 + || containingNodeKind === 181 + || containingNodeKind === 184 + || containingNodeKind === 167; case 20: - return containingNodeKind === 175 - || containingNodeKind === 155 - || containingNodeKind === 142; + return containingNodeKind === 176 + || containingNodeKind === 156 + || containingNodeKind === 143; case 127: case 128: return true; case 22: - return containingNodeKind === 231; + return containingNodeKind === 232; case 16: - return containingNodeKind === 227; + return containingNodeKind === 228; case 57: - return containingNodeKind === 224 - || containingNodeKind === 192; + return containingNodeKind === 225 + || containingNodeKind === 193; case 13: - return containingNodeKind === 194; + return containingNodeKind === 195; case 14: - return containingNodeKind === 203; + return containingNodeKind === 204; case 113: case 111: case 112: - return containingNodeKind === 147; + return containingNodeKind === 148; } switch (previousToken.getText()) { case "public": @@ -55687,22 +56004,22 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 176) { + if (objectLikeContainer.kind === 177) { isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); typeForObject = typeForObject && typeForObject.getNonNullableType(); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 172) { + else if (objectLikeContainer.kind === 173) { isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); if (ts.isVariableLike(rootDeclaration)) { var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); - if (!canGetType && rootDeclaration.kind === 144) { + if (!canGetType && rootDeclaration.kind === 145) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 149 || rootDeclaration.parent.kind === 152) { + else if (rootDeclaration.parent.kind === 150 || rootDeclaration.parent.kind === 153) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -55728,9 +56045,9 @@ var ts; return true; } function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 239 ? - 236 : - 242; + var declarationKind = namedImportsOrExports.kind === 240 ? + 237 : + 243; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -55738,12 +56055,13 @@ var ts; } isMemberCompletion = true; isNewIdentifierLocation = false; - var exports; - var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier); - if (moduleSpecifierSymbol) { - exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol); + var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); + if (!moduleSpecifierSymbol) { + symbols = ts.emptyArray; + return true; } - symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : ts.emptyArray; + var exports = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol); + symbols = filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements); return true; } function tryGetObjectLikeCompletionContainer(contextToken) { @@ -55751,9 +56069,9 @@ var ts; switch (contextToken.kind) { case 16: case 25: - var parent_16 = contextToken.parent; - if (parent_16 && (parent_16.kind === 176 || parent_16.kind === 172)) { - return parent_16; + var parent = contextToken.parent; + if (parent && (parent.kind === 177 || parent.kind === 173)) { + return parent; } break; } @@ -55766,8 +56084,8 @@ var ts; case 16: case 25: switch (contextToken.parent.kind) { - case 239: - case 243: + case 240: + case 244: return contextToken.parent; } } @@ -55776,34 +56094,34 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_17 = contextToken.parent; + var parent = contextToken.parent; switch (contextToken.kind) { case 27: case 40: case 70: - case 251: case 252: - if (parent_17 && (parent_17.kind === 248 || parent_17.kind === 249)) { - return parent_17; + case 253: + if (parent && (parent.kind === 249 || parent.kind === 250)) { + return parent; } - else if (parent_17.kind === 251) { - return parent_17.parent; + else if (parent.kind === 252) { + return parent.parent; } break; case 9: - if (parent_17 && ((parent_17.kind === 251) || (parent_17.kind === 252))) { - return parent_17.parent; + if (parent && ((parent.kind === 252) || (parent.kind === 253))) { + return parent.parent; } break; case 17: - if (parent_17 && - parent_17.kind === 253 && - parent_17.parent && - (parent_17.parent.kind === 251)) { - return parent_17.parent.parent; + if (parent && + parent.kind === 254 && + parent.parent && + (parent.parent.kind === 252)) { + return parent.parent.parent; } - if (parent_17 && parent_17.kind === 252) { - return parent_17.parent; + if (parent && parent.kind === 253) { + return parent.parent; } break; } @@ -55812,16 +56130,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 184: case 185: - case 226: + case 186: + case 227: + case 150: case 149: - case 148: - case 151: case 152: case 153: case 154: case 155: + case 156: return true; } return false; @@ -55830,66 +56148,66 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 25: - return containingNodeKind === 224 || - containingNodeKind === 225 || - containingNodeKind === 206 || - containingNodeKind === 230 || + return containingNodeKind === 225 || + containingNodeKind === 226 || + containingNodeKind === 207 || + containingNodeKind === 231 || isFunction(containingNodeKind) || - containingNodeKind === 227 || - containingNodeKind === 197 || containingNodeKind === 228 || - containingNodeKind === 173 || - containingNodeKind === 229; + containingNodeKind === 198 || + containingNodeKind === 229 || + containingNodeKind === 174 || + containingNodeKind === 230; case 22: - return containingNodeKind === 173; - case 55: return containingNodeKind === 174; + case 55: + return containingNodeKind === 175; case 20: - return containingNodeKind === 173; + return containingNodeKind === 174; case 18: - return containingNodeKind === 257 || + return containingNodeKind === 258 || isFunction(containingNodeKind); case 16: - return containingNodeKind === 230 || - containingNodeKind === 228 || - containingNodeKind === 161; + return containingNodeKind === 231 || + containingNodeKind === 229 || + containingNodeKind === 162; case 24: - return containingNodeKind === 146 && + return containingNodeKind === 147 && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 228 || - contextToken.parent.parent.kind === 161); + (contextToken.parent.parent.kind === 229 || + contextToken.parent.parent.kind === 162); case 26: - return containingNodeKind === 227 || - containingNodeKind === 197 || - containingNodeKind === 228 || + return containingNodeKind === 228 || + containingNodeKind === 198 || containingNodeKind === 229 || + containingNodeKind === 230 || isFunction(containingNodeKind); case 114: - return containingNodeKind === 147; + return containingNodeKind === 148; case 23: - return containingNodeKind === 144 || + return containingNodeKind === 145 || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 173); + contextToken.parent.parent.kind === 174); case 113: case 111: case 112: - return containingNodeKind === 144; + return containingNodeKind === 145; case 117: - return containingNodeKind === 240 || - containingNodeKind === 244 || - containingNodeKind === 238; + return containingNodeKind === 241 || + containingNodeKind === 245 || + containingNodeKind === 239; case 74: case 82: case 108: case 88: case 103: case 124: - case 133: + case 134: case 90: case 109: case 75: case 115: - case 136: + case 137: return true; } switch (contextToken.getText()) { @@ -55926,13 +56244,13 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_46 = element.propertyName || element.name; - existingImportsOrExports[name_46.text] = true; + var name = element.propertyName || element.name; + existingImportsOrExports.set(name.text, true); } - if (!ts.someProperties(existingImportsOrExports)) { + if (existingImportsOrExports.size === 0) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); } - return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports[e.name]; }); + return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports.get(e.name); }); } function filterObjectMembersList(contextualMemberSymbols, existingMembers) { if (!existingMembers || existingMembers.length === 0) { @@ -55941,19 +56259,19 @@ var ts; var existingMemberNames = ts.createMap(); for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; - if (m.kind !== 258 && - m.kind !== 259 && - m.kind !== 174 && - m.kind !== 149 && - m.kind !== 151 && - m.kind !== 152) { + if (m.kind !== 259 && + m.kind !== 260 && + m.kind !== 175 && + m.kind !== 150 && + m.kind !== 152 && + m.kind !== 153) { continue; } if (m.getStart() <= position && position <= m.getEnd()) { continue; } var existingName = void 0; - if (m.kind === 174 && m.propertyName) { + if (m.kind === 175 && m.propertyName) { if (m.propertyName.kind === 70) { existingName = m.propertyName.text; } @@ -55961,9 +56279,9 @@ var ts; else { existingName = m.name.text; } - existingMemberNames[existingName] = true; + existingMemberNames.set(existingName, true); } - return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; }); + return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames.get(m.name); }); } function filterJsxAttributes(symbols, attributes) { var seenNames = ts.createMap(); @@ -55972,11 +56290,11 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 251) { - seenNames[attr.name.text] = true; + if (attr.kind === 252) { + seenNames.set(attr.name.text, true); } } - return ts.filter(symbols, function (a) { return !seenNames[a.name]; }); + return ts.filter(symbols, function (a) { return !seenNames.get(a.name); }); } } function getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location) { @@ -56005,7 +56323,7 @@ var ts; return name; } var keywordCompletions = []; - for (var i = 71; i <= 140; i++) { + for (var i = 71; i <= 141; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ts.ScriptElementKind.keyword, @@ -56045,6 +56363,15 @@ var ts; catch (e) { } return undefined; } + function isEqualityExpression(node) { + return ts.isBinaryExpression(node) && isEqualityOperatorKind(node.operatorToken.kind); + } + function isEqualityOperatorKind(kind) { + return kind == 31 || + kind === 32 || + kind === 33 || + kind === 34; + } })(Completions = ts.Completions || (ts.Completions = {})); })(ts || (ts = {})); var ts; @@ -56053,495 +56380,480 @@ var ts; (function (DocumentHighlights) { function getDocumentHighlights(typeChecker, cancellationToken, sourceFile, position, sourceFilesToSearch) { var node = ts.getTouchingWord(sourceFile, position); + return node && (getSemanticDocumentHighlights(node, typeChecker, cancellationToken, sourceFilesToSearch) || getSyntacticDocumentHighlights(node, sourceFile)); + } + DocumentHighlights.getDocumentHighlights = getDocumentHighlights; + function getHighlightSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var end = node.getEnd(); + return { + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + kind: ts.HighlightSpanKind.none + }; + } + function getSemanticDocumentHighlights(node, typeChecker, cancellationToken, sourceFilesToSearch) { + var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFilesToSearch); + return referencedSymbols && convertReferencedSymbols(referencedSymbols); + } + function convertReferencedSymbols(referencedSymbols) { + var fileNameToDocumentHighlights = ts.createMap(); + var result = []; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var referencedSymbol = referencedSymbols_1[_i]; + for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { + var referenceEntry = _b[_a]; + var fileName = referenceEntry.fileName; + var documentHighlights = fileNameToDocumentHighlights.get(fileName); + if (!documentHighlights) { + documentHighlights = { fileName: fileName, highlightSpans: [] }; + fileNameToDocumentHighlights.set(fileName, documentHighlights); + result.push(documentHighlights); + } + documentHighlights.highlightSpans.push({ + textSpan: referenceEntry.textSpan, + kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference + }); + } + } + return result; + } + function getSyntacticDocumentHighlights(node, sourceFile) { + var highlightSpans = getHighlightSpans(node, sourceFile); + if (!highlightSpans || highlightSpans.length === 0) { + return undefined; + } + return [{ fileName: sourceFile.fileName, highlightSpans: highlightSpans }]; + } + function hasKind(node, kind) { + return node !== undefined && node.kind === kind; + } + function parent(node) { + return node && node.parent; + } + function getHighlightSpans(node, sourceFile) { if (!node) { return undefined; } - return getSemanticDocumentHighlights(node) || getSyntacticDocumentHighlights(node); - function getHighlightSpanForNode(node) { - var start = node.getStart(); - var end = node.getEnd(); - return { - fileName: sourceFile.fileName, - textSpan: ts.createTextSpanFromBounds(start, end), - kind: ts.HighlightSpanKind.none - }; + switch (node.kind) { + case 89: + case 81: + if (hasKind(node.parent, 210)) { + return getIfElseOccurrences(node.parent, sourceFile); + } + break; + case 95: + if (hasKind(node.parent, 218)) { + return highlightSpans(getReturnOccurrences(node.parent)); + } + break; + case 99: + if (hasKind(node.parent, 222)) { + return highlightSpans(getThrowOccurrences(node.parent)); + } + break; + case 101: + case 73: + case 86: + var tryStatement = node.kind === 73 ? parent(parent(node)) : parent(node); + if (hasKind(tryStatement, 223)) { + return highlightSpans(getTryCatchFinallyOccurrences(tryStatement, sourceFile)); + } + break; + case 97: + if (hasKind(node.parent, 220)) { + return highlightSpans(getSwitchCaseDefaultOccurrences(node.parent)); + } + break; + case 72: + case 78: + if (hasKind(parent(parent(parent(node))), 220)) { + return highlightSpans(getSwitchCaseDefaultOccurrences(node.parent.parent.parent)); + } + break; + case 71: + case 76: + if (hasKind(node.parent, 217) || hasKind(node.parent, 216)) { + return highlightSpans(getBreakOrContinueStatementOccurrences(node.parent)); + } + break; + case 87: + if (hasKind(node.parent, 213) || + hasKind(node.parent, 214) || + hasKind(node.parent, 215)) { + return highlightSpans(getLoopBreakContinueOccurrences(node.parent)); + } + break; + case 105: + case 80: + if (hasKind(node.parent, 212) || hasKind(node.parent, 211)) { + return highlightSpans(getLoopBreakContinueOccurrences(node.parent)); + } + break; + case 122: + if (hasKind(node.parent, 151)) { + return highlightSpans(getConstructorOccurrences(node.parent)); + } + break; + case 124: + case 134: + if (hasKind(node.parent, 152) || hasKind(node.parent, 153)) { + return highlightSpans(getGetAndSetOccurrences(node.parent)); + } + break; + default: + if (ts.isModifierKind(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 207)) { + return highlightSpans(getModifierOccurrences(node.kind, node.parent)); + } } - function getSemanticDocumentHighlights(node) { - if (node.kind === 70 || - node.kind === 98 || - node.kind === 167 || - node.kind === 96 || - node.kind === 9 || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFilesToSearch, false, false, false); - return convertReferencedSymbols(referencedSymbols); + function highlightSpans(nodes) { + return nodes && nodes.map(function (node) { return getHighlightSpanForNode(node, sourceFile); }); + } + } + function aggregateOwnedThrowStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 222) { + statementAccumulator.push(node); } - return undefined; - function convertReferencedSymbols(referencedSymbols) { - if (!referencedSymbols) { - return undefined; + else if (node.kind === 223) { + var tryStatement = node; + if (tryStatement.catchClause) { + aggregate(tryStatement.catchClause); } - var fileNameToDocumentHighlights = ts.createMap(); - var result = []; - for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { - var referencedSymbol = referencedSymbols_1[_i]; - for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { - var referenceEntry = _b[_a]; - var fileName = referenceEntry.fileName; - var documentHighlights = fileNameToDocumentHighlights[fileName]; - if (!documentHighlights) { - documentHighlights = { fileName: fileName, highlightSpans: [] }; - fileNameToDocumentHighlights[fileName] = documentHighlights; - result.push(documentHighlights); - } - documentHighlights.highlightSpans.push({ - textSpan: referenceEntry.textSpan, - kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference - }); - } + else { + aggregate(tryStatement.tryBlock); } - return result; + if (tryStatement.finallyBlock) { + aggregate(tryStatement.finallyBlock); + } + } + else if (!ts.isFunctionLike(node)) { + ts.forEachChild(node, aggregate); } } - function getSyntacticDocumentHighlights(node) { - var fileName = sourceFile.fileName; - var highlightSpans = getHighlightSpans(node); - if (!highlightSpans || highlightSpans.length === 0) { - return undefined; + } + function getThrowStatementOwner(throwStatement) { + var child = throwStatement; + while (child.parent) { + var parent_2 = child.parent; + if (ts.isFunctionBlock(parent_2) || parent_2.kind === 263) { + return parent_2; } - return [{ fileName: fileName, highlightSpans: highlightSpans }]; - function hasKind(node, kind) { - return node !== undefined && node.kind === kind; + if (parent_2.kind === 223) { + var tryStatement = parent_2; + if (tryStatement.tryBlock === child && tryStatement.catchClause) { + return child; + } } - function parent(node) { - return node && node.parent; + child = parent_2; + } + return undefined; + } + function aggregateAllBreakAndContinueStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 217 || node.kind === 216) { + statementAccumulator.push(node); } - function getHighlightSpans(node) { - if (node) { - switch (node.kind) { - case 89: - case 81: - if (hasKind(node.parent, 209)) { - return getIfElseOccurrences(node.parent); - } - break; - case 95: - if (hasKind(node.parent, 217)) { - return getReturnOccurrences(node.parent); - } - break; - case 99: - if (hasKind(node.parent, 221)) { - return getThrowOccurrences(node.parent); - } - break; - case 73: - if (hasKind(parent(parent(node)), 222)) { - return getTryCatchFinallyOccurrences(node.parent.parent); - } - break; - case 101: - case 86: - if (hasKind(parent(node), 222)) { - return getTryCatchFinallyOccurrences(node.parent); - } - break; - case 97: - if (hasKind(node.parent, 219)) { - return getSwitchCaseDefaultOccurrences(node.parent); - } - break; - case 72: - case 78: - if (hasKind(parent(parent(parent(node))), 219)) { - return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); - } - break; - case 71: - case 76: - if (hasKind(node.parent, 216) || hasKind(node.parent, 215)) { - return getBreakOrContinueStatementOccurrences(node.parent); - } - break; - case 87: - if (hasKind(node.parent, 212) || - hasKind(node.parent, 213) || - hasKind(node.parent, 214)) { - return getLoopBreakContinueOccurrences(node.parent); - } - break; - case 105: - case 80: - if (hasKind(node.parent, 211) || hasKind(node.parent, 210)) { - return getLoopBreakContinueOccurrences(node.parent); - } - break; - case 122: - if (hasKind(node.parent, 150)) { - return getConstructorOccurrences(node.parent); - } - break; - case 124: - case 133: - if (hasKind(node.parent, 151) || hasKind(node.parent, 152)) { - return getGetAndSetOccurrences(node.parent); - } - break; - default: - if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 206)) { - return getModifierOccurrences(node.kind, node.parent); - } - } - } - return undefined; + else if (!ts.isFunctionLike(node)) { + ts.forEachChild(node, aggregate); } - function aggregateOwnedThrowStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 221) { - statementAccumulator.push(node); - } - else if (node.kind === 222) { - var tryStatement = node; - if (tryStatement.catchClause) { - aggregate(tryStatement.catchClause); - } - else { - aggregate(tryStatement.tryBlock); - } - if (tryStatement.finallyBlock) { - aggregate(tryStatement.finallyBlock); - } - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); + } + } + function ownsBreakOrContinueStatement(owner, statement) { + var actualOwner = getBreakOrContinueOwner(statement); + return actualOwner && actualOwner === owner; + } + function getBreakOrContinueOwner(statement) { + for (var node = statement.parent; node; node = node.parent) { + switch (node.kind) { + case 220: + if (statement.kind === 216) { + continue; } - } - } - function getThrowStatementOwner(throwStatement) { - var child = throwStatement; - while (child.parent) { - var parent_18 = child.parent; - if (ts.isFunctionBlock(parent_18) || parent_18.kind === 262) { - return parent_18; + case 213: + case 214: + case 215: + case 212: + case 211: + if (!statement.label || isLabeledBy(node, statement.label.text)) { + return node; } - if (parent_18.kind === 222) { - var tryStatement = parent_18; - if (tryStatement.tryBlock === child && tryStatement.catchClause) { - return child; - } + break; + default: + if (ts.isFunctionLike(node)) { + return undefined; } - child = parent_18; - } + break; + } + } + return undefined; + } + function getModifierOccurrences(modifier, declaration) { + var container = declaration.parent; + if (ts.isAccessibilityModifier(modifier)) { + if (!(container.kind === 228 || + container.kind === 198 || + (declaration.kind === 145 && hasKind(container, 151)))) { return undefined; } - function aggregateAllBreakAndContinueStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 216 || node.kind === 215) { - statementAccumulator.push(node); - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); - } - } + } + else if (modifier === 114) { + if (!(container.kind === 228 || container.kind === 198)) { + return undefined; } - function ownsBreakOrContinueStatement(owner, statement) { - var actualOwner = getBreakOrContinueOwner(statement); - return actualOwner && actualOwner === owner; + } + else if (modifier === 83 || modifier === 123) { + if (!(container.kind === 233 || container.kind === 263)) { + return undefined; } - function getBreakOrContinueOwner(statement) { - for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { - switch (node_2.kind) { - case 219: - if (statement.kind === 215) { - continue; - } - case 212: - case 213: - case 214: - case 211: - case 210: - if (!statement.label || isLabeledBy(node_2, statement.label.text)) { - return node_2; - } - break; - default: - if (ts.isFunctionLike(node_2)) { - return undefined; - } - break; - } - } + } + else if (modifier === 116) { + if (!(container.kind === 228 || declaration.kind === 228)) { return undefined; } - function getModifierOccurrences(modifier, declaration) { - var container = declaration.parent; - if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 227 || - container.kind === 197 || - (declaration.kind === 144 && hasKind(container, 150)))) { - return undefined; - } - } - else if (modifier === 114) { - if (!(container.kind === 227 || container.kind === 197)) { - return undefined; - } - } - else if (modifier === 83 || modifier === 123) { - if (!(container.kind === 232 || container.kind === 262)) { - return undefined; - } - } - else if (modifier === 116) { - if (!(container.kind === 227 || declaration.kind === 227)) { - return undefined; - } + } + else { + return undefined; + } + var keywords = []; + var modifierFlag = getFlagFromModifier(modifier); + var nodes; + switch (container.kind) { + case 233: + case 263: + if (modifierFlag & 128) { + nodes = declaration.members.concat(declaration); } else { - return undefined; - } - var keywords = []; - var modifierFlag = getFlagFromModifier(modifier); - var nodes; - switch (container.kind) { - case 232: - case 262: - if (modifierFlag & 128) { - nodes = declaration.members.concat(declaration); - } - else { - nodes = container.statements; - } - break; - case 150: - nodes = container.parameters.concat(container.parent.members); - break; - case 227: - case 197: - nodes = container.members; - if (modifierFlag & 28) { - var constructor = ts.forEach(container.members, function (member) { - return member.kind === 150 && member; - }); - if (constructor) { - nodes = nodes.concat(constructor.parameters); - } - } - else if (modifierFlag & 128) { - nodes = nodes.concat(container); - } - break; - default: - ts.Debug.fail("Invalid container kind."); + nodes = container.statements; } - ts.forEach(nodes, function (node) { - if (ts.getModifierFlags(node) & modifierFlag) { - ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); - } - }); - return ts.map(keywords, getHighlightSpanForNode); - function getFlagFromModifier(modifier) { - switch (modifier) { - case 113: - return 4; - case 111: - return 8; - case 112: - return 16; - case 114: - return 32; - case 83: - return 1; - case 123: - return 2; - case 116: - return 128; - default: - ts.Debug.fail(); + break; + case 151: + nodes = container.parameters.concat(container.parent.members); + break; + case 228: + case 198: + nodes = container.members; + if (modifierFlag & 28) { + var constructor = ts.forEach(container.members, function (member) { + return member.kind === 151 && member; + }); + if (constructor) { + nodes = nodes.concat(constructor.parameters); } } - } - function pushKeywordIf(keywordList, token) { - var expected = []; - for (var _i = 2; _i < arguments.length; _i++) { - expected[_i - 2] = arguments[_i]; - } - if (token && ts.contains(expected, token.kind)) { - keywordList.push(token); - return true; + else if (modifierFlag & 128) { + nodes = nodes.concat(container); } - return false; + break; + default: + ts.Debug.fail("Invalid container kind."); + } + ts.forEach(nodes, function (node) { + if (ts.getModifierFlags(node) & modifierFlag) { + ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); } - function getGetAndSetOccurrences(accessorDeclaration) { - var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 151); - tryPushAccessorKeyword(accessorDeclaration.symbol, 152); - 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, 124, 133); }); - } - } + }); + return keywords; + function getFlagFromModifier(modifier) { + switch (modifier) { + case 113: + return 4; + case 111: + return 8; + case 112: + return 16; + case 114: + return 32; + case 83: + return 1; + case 123: + return 2; + case 116: + return 128; + default: + ts.Debug.fail(); } - function getConstructorOccurrences(constructorDeclaration) { - var declarations = constructorDeclaration.symbol.getDeclarations(); - var keywords = []; - ts.forEach(declarations, function (declaration) { - ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 122); - }); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getLoopBreakContinueOccurrences(loopNode) { - var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87, 105, 80)) { - if (loopNode.kind === 210) { - var loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 105)) { - break; - } - } - } - } - var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71, 76); - } - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { - var owner = getBreakOrContinueOwner(breakOrContinueStatement); - if (owner) { - switch (owner.kind) { - case 212: - case 213: - case 214: - case 210: - case 211: - return getLoopBreakContinueOccurrences(owner); - case 219: - return getSwitchCaseDefaultOccurrences(owner); + } + } + function pushKeywordIf(keywordList, token) { + var expected = []; + for (var _i = 2; _i < arguments.length; _i++) { + expected[_i - 2] = arguments[_i]; + } + if (token && ts.contains(expected, token.kind)) { + keywordList.push(token); + return true; + } + return false; + } + function getGetAndSetOccurrences(accessorDeclaration) { + var keywords = []; + tryPushAccessorKeyword(accessorDeclaration.symbol, 152); + tryPushAccessorKeyword(accessorDeclaration.symbol, 153); + return keywords; + function tryPushAccessorKeyword(accessorSymbol, accessorKind) { + var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); + if (accessor) { + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124, 134); }); + } + } + } + function getConstructorOccurrences(constructorDeclaration) { + var declarations = constructorDeclaration.symbol.getDeclarations(); + var keywords = []; + ts.forEach(declarations, function (declaration) { + ts.forEach(declaration.getChildren(), function (token) { + return pushKeywordIf(keywords, token, 122); + }); + }); + return keywords; + } + function getLoopBreakContinueOccurrences(loopNode) { + var keywords = []; + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87, 105, 80)) { + if (loopNode.kind === 211) { + var loopTokens = loopNode.getChildren(); + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 105)) { + break; } } - return undefined; } - function getSwitchCaseDefaultOccurrences(switchStatement) { - var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 97); - ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 72, 78); - var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71); - } - }); - }); - return ts.map(keywords, getHighlightSpanForNode); + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71, 76); } - function getTryCatchFinallyOccurrences(tryStatement) { - var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 101); - if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73); - } - if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 86); - } - return ts.map(keywords, getHighlightSpanForNode); + }); + return keywords; + } + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 213: + case 214: + case 215: + case 211: + case 212: + return getLoopBreakContinueOccurrences(owner); + case 220: + return getSwitchCaseDefaultOccurrences(owner); } - function getThrowOccurrences(throwStatement) { - var owner = getThrowStatementOwner(throwStatement); - if (!owner) { - return undefined; + } + return undefined; + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 97); + ts.forEach(switchStatement.caseBlock.clauses, function (clause) { + pushKeywordIf(keywords, clause.getFirstToken(), 72, 78); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71); } - var keywords = []; - ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); - }); - if (ts.isFunctionBlock(owner)) { - ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); - }); + }); + }); + return keywords; + } + function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 101); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 86); + } + return keywords; + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); + }); + if (ts.isFunctionBlock(owner)) { + ts.forEachReturnStatement(owner, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); + }); + } + return keywords; + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + if (!(func && hasKind(func.body, 206))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); + }); + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); + }); + return keywords; + } + function getIfElseOccurrences(ifStatement, sourceFile) { + var keywords = []; + while (hasKind(ifStatement.parent, 210) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 89); + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 81)) { + break; } - return ts.map(keywords, getHighlightSpanForNode); } - function getReturnOccurrences(returnStatement) { - var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 205))) { - return undefined; - } - var keywords = []; - ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); - }); - ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getIfElseOccurrences(ifStatement) { - var keywords = []; - while (hasKind(ifStatement.parent, 209) && ifStatement.parent.elseStatement === ifStatement) { - ifStatement = ifStatement.parent; - } - while (ifStatement) { - var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 89); - for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 81)) { - break; - } - } - if (!hasKind(ifStatement.elseStatement, 209)) { + if (!hasKind(ifStatement.elseStatement, 210)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 81 && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; + var shouldCombindElseAndIf = true; + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { + shouldCombindElseAndIf = false; break; } - ifStatement = ifStatement.elseStatement; } - var result = []; - for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 81 && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; - var shouldCombindElseAndIf = true; - for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { - if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { - shouldCombindElseAndIf = false; - break; - } - } - if (shouldCombindElseAndIf) { - result.push({ - fileName: fileName, - textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), - kind: ts.HighlightSpanKind.reference - }); - i++; - continue; - } - } - result.push(getHighlightSpanForNode(keywords[i])); + if (shouldCombindElseAndIf) { + result.push({ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + kind: ts.HighlightSpanKind.reference + }); + i++; + continue; } - return result; } + result.push(getHighlightSpanForNode(keywords[i], sourceFile)); } + return result; } - DocumentHighlights.getDocumentHighlights = getDocumentHighlights; function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 220; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 221; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -56560,15 +56872,15 @@ var ts; return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); } function getBucketForCompilationSettings(key, createIfMissing) { - var bucket = buckets[key]; + var bucket = buckets.get(key); if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(); + buckets.set(key, bucket = ts.createFileMap()); } return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { - var entries = buckets[name]; + var bucketInfoArray = ts.arrayFrom(buckets.keys()).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { + var entries = buckets.get(name); var sourceFiles = []; entries.forEachValue(function (key, entry) { sourceFiles.push({ @@ -56656,869 +56968,931 @@ var ts; (function (ts) { var FindAllReferences; (function (FindAllReferences) { - function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) { + function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments, isForRename) { var node = ts.getTouchingPropertyName(sourceFile, position, true); - if (node === sourceFile) { - return undefined; - } - switch (node.kind) { - case 8: - if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - break; - } - case 70: - case 98: - case 122: - case 9: - return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, false); - } - return undefined; + return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, isForRename); } FindAllReferences.findReferencedSymbols = findReferencedSymbols; - function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) { + function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, isForRename, implementations) { if (!implementations) { - if (ts.isLabelName(node)) { - if (ts.isJumpStatementTarget(node)) { - var labelDefinition = ts.getTargetLabel(node.parent, node.text); - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; - } - else { - return getLabelReferencesInNode(node.parent, node); - } - } - if (ts.isThis(node)) { - return getReferencesForThisKeyword(node, sourceFiles); - } - if (node.kind === 96) { - return getReferencesForSuperKeyword(node); + var special = getReferencedSymbolsSpecial(node, sourceFiles, typeChecker, cancellationToken); + if (special) { + return special; } } var symbol = typeChecker.getSymbolAtLocation(node); - if (!implementations && !symbol && node.kind === 9) { - return getReferencesForStringLiteral(node, sourceFiles); - } if (!symbol) { + if (!implementations && node.kind === 9) { + return getReferencesForStringLiteral(node, sourceFiles, typeChecker, cancellationToken); + } return undefined; } var declarations = symbol.declarations; if (!declarations || !declarations.length) { return undefined; } - var result; + var _a = followAliases(symbol, node, typeChecker, isForRename), aliasedSymbol = _a.symbol, shorthandModuleSymbol = _a.shorthandModuleSymbol; + symbol = aliasedSymbol; + var searchSymbols = populateSearchSymbolSet(symbol, node, typeChecker, implementations); + if (shorthandModuleSymbol) { + searchSymbols.push(shorthandModuleSymbol); + } var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations); + var result = []; + var symbolToIndex = []; + var inheritsFromCache = ts.createMap(); var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); var scope = getSymbolScope(symbol); - var symbolToIndex = []; if (scope) { - result = []; - getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + getRefs(scope, declaredName); } else { - var internedName = getInternedName(symbol, node); - for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { - var sourceFile = sourceFiles_8[_i]; + var isDefault = ts.isExportDefaultSymbol(symbol); + var internedName = isDefault ? symbol.valueDeclaration.localSymbol.name : getInternedName(symbol, node); + for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { + var sourceFile = sourceFiles_7[_i]; cancellationToken.throwIfCancellationRequested(); - var nameTable = ts.getNameTable(sourceFile); - if (nameTable[internedName] !== undefined) { - result = result || []; - getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + var searchName = (isDefault ? getDefaultImportName(symbol, sourceFile, typeChecker) : undefined) || + (sourceFileHasName(sourceFile, internedName) ? declaredName : undefined); + if (searchName !== undefined) { + getRefs(sourceFile, searchName); } } } return result; - function getDefinition(symbol) { - var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node); - var name = ts.map(info.displayParts, function (p) { return p.text; }).join(""); - var declarations = symbol.declarations; - if (!declarations || declarations.length === 0) { - return undefined; + function getRefs(scope, searchName) { + getReferencesInNode(scope, symbol, searchName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex, implementations, typeChecker, cancellationToken, searchSymbols, inheritsFromCache); + } + } + FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; + function getReferencedSymbolsSpecial(node, sourceFiles, typeChecker, cancellationToken) { + if (ts.isTypeKeyword(node.kind)) { + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken); + } + if (ts.isLabelName(node)) { + if (ts.isJumpStatementTarget(node)) { + var labelDefinition = ts.getTargetLabel(node.parent, node.text); + return labelDefinition && getLabelReferencesInNode(labelDefinition.parent, labelDefinition, cancellationToken); + } + else { + return getLabelReferencesInNode(node.parent, node, cancellationToken); } - return { - containerKind: "", - containerName: "", - name: name, - kind: info.symbolKind, - fileName: declarations[0].getSourceFile().fileName, - textSpan: ts.createTextSpan(declarations[0].getStart(), 0), - displayParts: info.displayParts - }; } - function getAliasSymbolForPropertyNameSymbol(symbol, location) { - if (symbol.flags & 8388608) { - var defaultImport = ts.getDeclarationOfKind(symbol, 237); - if (defaultImport) { - return typeChecker.getAliasedSymbol(symbol); - } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 240 || - declaration.kind === 244) ? declaration : undefined; }); - if (importOrExportSpecifier && - (!importOrExportSpecifier.propertyName || - importOrExportSpecifier.propertyName === location)) { - return importOrExportSpecifier.kind === 240 ? - typeChecker.getAliasedSymbol(symbol) : - typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); - } + if (ts.isThis(node)) { + return getReferencesForThisKeyword(node, sourceFiles, typeChecker, cancellationToken); + } + if (node.kind === 96) { + return getReferencesForSuperKeyword(node, typeChecker, cancellationToken); + } + return undefined; + } + function followAliases(symbol, node, typeChecker, isForRename) { + while (true) { + if (isForRename && isImportDefaultSymbol(symbol)) { + return { symbol: symbol }; + } + var aliasedSymbol = getAliasSymbolForPropertyNameSymbol(symbol, node, typeChecker); + if (!aliasedSymbol || !aliasedSymbol.declarations) { + return { symbol: symbol }; } + if (ts.isShorthandAmbientModuleSymbol(aliasedSymbol)) { + return { symbol: symbol, shorthandModuleSymbol: aliasedSymbol }; + } + symbol = aliasedSymbol; + } + } + function sourceFileHasName(sourceFile, name) { + return ts.getNameTable(sourceFile).get(name) !== undefined; + } + function getDefaultImportName(symbol, sourceFile, checker) { + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var importSpecifier = _a[_i]; + var importDecl = importSpecifier.parent; + ts.Debug.assert(importDecl.moduleSpecifier === importSpecifier); + var defaultName = importDecl.importClause.name; + var defaultReferencedSymbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName)); + if (symbol === defaultReferencedSymbol) { + return defaultName.text; + } + } + return undefined; + } + function getDefinition(symbol, node, typeChecker) { + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node), displayParts = _a.displayParts, symbolKind = _a.symbolKind; + var name = displayParts.map(function (p) { return p.text; }).join(""); + var declarations = symbol.declarations; + if (!declarations || declarations.length === 0) { return undefined; } - function followAliasIfNecessary(symbol, location) { - return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol; + return { + containerKind: "", + containerName: "", + name: name, + kind: symbolKind, + fileName: declarations[0].getSourceFile().fileName, + textSpan: ts.createTextSpan(declarations[0].getStart(), 0), + displayParts: displayParts + }; + } + function getAliasSymbolForPropertyNameSymbol(symbol, location, typeChecker) { + if (!(symbol.flags & 8388608)) { + return undefined; } - function getPropertySymbolOfDestructuringAssignment(location) { - return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && - typeChecker.getPropertySymbolOfDestructuringAssignment(location); + var defaultImport = ts.getDeclarationOfKind(symbol, 238); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); } - function isObjectBindingPatternElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174); - return bindingElement && - bindingElement.parent.kind === 172 && - !bindingElement.propertyName; + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 241 || + declaration.kind === 245) ? declaration : undefined; }); + if (importOrExportSpecifier && + (!importOrExportSpecifier.propertyName || + importOrExportSpecifier.propertyName === location)) { + return importOrExportSpecifier.kind === 241 ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); } - function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174); - var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); - return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + } + function followAliasIfNecessary(symbol, location, typeChecker) { + return getAliasSymbolForPropertyNameSymbol(symbol, location, typeChecker) || symbol; + } + function getPropertySymbolOfDestructuringAssignment(location, typeChecker) { + return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + function isObjectBindingPatternElementWithoutPropertyName(symbol) { + var bindingElement = ts.getDeclarationOfKind(symbol, 175); + return bindingElement && + bindingElement.parent.kind === 173 && + !bindingElement.propertyName; + } + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, typeChecker) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + var bindingElement = ts.getDeclarationOfKind(symbol, 175); + var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + } + return undefined; + } + function getInternedName(symbol, location) { + if (ts.isImportOrExportSpecifierName(location)) { + return location.text; + } + return ts.stripQuotes(symbol.name); + } + function getSymbolScope(symbol) { + var valueDeclaration = symbol.valueDeclaration; + if (valueDeclaration && (valueDeclaration.kind === 185 || valueDeclaration.kind === 198)) { + return valueDeclaration; + } + if (symbol.flags & (4 | 8192)) { + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8) ? d : undefined; }); + if (privateDeclaration) { + return ts.getAncestor(privateDeclaration, 228); } + } + if (symbol.flags & 8388608) { return undefined; } - function getInternedName(symbol, location) { - if (ts.isImportOrExportSpecifierName(location)) { - return location.getText(); - } - var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - symbol = localExportDefaultSymbol || symbol; - return ts.stripQuotes(symbol.name); + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + return undefined; } - function getSymbolScope(symbol) { - var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 184 || valueDeclaration.kind === 197)) { - return valueDeclaration; - } - if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8) ? d : undefined; }); - if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 227); + if (symbol.parent || (symbol.flags & 268435456)) { + return undefined; + } + var scope; + var declarations = symbol.getDeclarations(); + if (declarations) { + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + var container = ts.getContainerNode(declaration); + if (!container) { + return undefined; } + if (scope && scope !== container) { + return undefined; + } + if (container.kind === 263 && !ts.isExternalModule(container)) { + return undefined; + } + scope = container; } - if (symbol.flags & 8388608) { - return undefined; - } - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - return undefined; + } + return scope; + } + function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end, cancellationToken) { + var positions = []; + if (!symbolName || !symbolName.length) { + return positions; + } + var text = sourceFile.text; + var sourceLength = text.length; + var symbolNameLength = symbolName.length; + var position = text.indexOf(symbolName, start); + while (position >= 0) { + cancellationToken.throwIfCancellationRequested(); + if (position > end) + break; + var endPosition = position + symbolNameLength; + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5))) { + positions.push(position); } - if (symbol.parent || (symbol.flags & 268435456)) { - return undefined; + position = text.indexOf(symbolName, position + symbolNameLength + 1); + } + return positions; + } + function getLabelReferencesInNode(container, targetLabel, cancellationToken) { + var references = []; + var sourceFile = container.getSourceFile(); + var labelName = targetLabel.text; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd(), cancellationToken); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.getWidth() !== labelName.length) { + return; } - var scope; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; - var container = ts.getContainerNode(declaration); - if (!container) { - return undefined; - } - if (scope && scope !== container) { - return undefined; - } - if (container.kind === 262 && !ts.isExternalModule(container)) { - return undefined; - } - scope = container; - } + if (node === targetLabel || + (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { + references.push(getReferenceEntryFromNode(node)); } - return scope; + }); + var definition = { + containerKind: "", + containerName: "", + fileName: targetLabel.getSourceFile().fileName, + kind: ts.ScriptElementKind.label, + name: labelName, + textSpan: ts.createTextSpanFromNode(targetLabel, sourceFile), + displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] + }; + return [{ definition: definition, references: references }]; + } + function isValidReferencePosition(node, searchSymbolName) { + switch (node && node.kind) { + case 70: + return node.getWidth() === searchSymbolName.length; + case 9: + return (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) && + node.getWidth() === searchSymbolName.length + 2; + case 8: + return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.getWidth() === searchSymbolName.length; + default: + return false; + } + } + function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) { + var name = ts.tokenToString(keywordKind); + var definition = { + containerKind: "", + containerName: "", + fileName: "", + kind: ts.ScriptElementKind.keyword, + name: name, + textSpan: ts.createTextSpan(0, 1), + displayParts: [{ text: name, kind: ts.ScriptElementKind.keyword }] + }; + var references = []; + for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { + var sourceFile = sourceFiles_8[_i]; + cancellationToken.throwIfCancellationRequested(); + addReferencesForKeywordInFile(sourceFile, keywordKind, name, cancellationToken, references); } - function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { - var positions = []; - if (!symbolName || !symbolName.length) { - return positions; + return [{ definition: definition, references: references }]; + } + function addReferencesForKeywordInFile(sourceFile, kind, searchText, cancellationToken, references) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; + cancellationToken.throwIfCancellationRequested(); + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (referenceLocation.kind === kind) { + references.push({ + textSpan: ts.createTextSpanFromNode(referenceLocation), + fileName: sourceFile.fileName, + isWriteAccess: false, + isDefinition: false, + }); } - var text = sourceFile.text; - var sourceLength = text.length; - var symbolNameLength = symbolName.length; - var position = text.indexOf(symbolName, start); - while (position >= 0) { - cancellationToken.throwIfCancellationRequested(); - if (position > end) - break; - var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5)) && - (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5))) { - positions.push(position); + } + } + function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex, implementations, typeChecker, cancellationToken, searchSymbols, inheritsFromCache) { + var sourceFile = container.getSourceFile(); + var start = findInComments ? container.getFullStart() : container.getStart(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd(), cancellationToken); + var parents = getParentSymbolsOfPropertyAccess(); + for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) { + var position = possiblePositions_2[_i]; + cancellationToken.throwIfCancellationRequested(); + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (!isValidReferencePosition(referenceLocation, searchText)) { + if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || + (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) { + result.push({ + definition: undefined, + references: [{ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpan(position, searchText.length), + isWriteAccess: false, + isDefinition: false + }] + }); } - position = text.indexOf(symbolName, position + symbolNameLength + 1); + continue; } - return positions; - } - function getLabelReferencesInNode(container, targetLabel) { - var references = []; - var sourceFile = container.getSourceFile(); - var labelName = targetLabel.text; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.getWidth() !== labelName.length) { - return; + if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { + continue; + } + var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); + if (referenceSymbol) { + var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; + var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); + var relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocation.kind === 122, parents, inheritsFromCache, typeChecker); + if (relatedSymbol) { + addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); } - if (node === targetLabel || - (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { - references.push(getReferenceEntryFromNode(node)); + else if (!(referenceSymbol.flags & 67108864) && ts.contains(searchSymbols, shorthandValueSymbol)) { + addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); } - }); - var definition = { - containerKind: "", - containerName: "", - fileName: targetLabel.getSourceFile().fileName, - kind: ts.ScriptElementKind.label, - name: labelName, - textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()), - displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] - }; - return [{ definition: definition, references: references }]; - } - function isValidReferencePosition(node, searchSymbolName) { - if (node) { - switch (node.kind) { - case 70: - return node.getWidth() === searchSymbolName.length; - case 9: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - return node.getWidth() === searchSymbolName.length + 2; - } - break; - case 8: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - return node.getWidth() === searchSymbolName.length; - } - break; + else if (searchLocation.kind === 122) { + findAdditionalConstructorReferences(referenceSymbol, referenceLocation); } } - return false; } - function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) { - var sourceFile = container.getSourceFile(); - var start = findInComments ? container.getFullStart() : container.getStart(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd()); - var parents = getParentSymbolsOfPropertyAccess(); - var inheritsFromCache = ts.createMap(); - if (possiblePositions.length) { - var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); - if (!isValidReferencePosition(referenceLocation, searchText)) { - if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || - (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) { - result.push({ - definition: undefined, - references: [{ - fileName: sourceFile.fileName, - textSpan: ts.createTextSpan(position, searchText.length), - isWriteAccess: false, - isDefinition: false - }] - }); - } - return; - } - if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { - return; - } - var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); - if (referenceSymbol) { - var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); - var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, searchLocation.kind === 122, parents, inheritsFromCache); - if (relatedSymbol) { - addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); - } - else if (!(referenceSymbol.flags & 67108864) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { - addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); - } - else if (searchLocation.kind === 122) { - findAdditionalConstructorReferences(referenceSymbol, referenceLocation); + return; + function getParentSymbolsOfPropertyAccess() { + if (implementations) { + var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); + if (propertyAccessExpression) { + var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); + if (localParentType) { + if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== searchSymbol.parent) { + return [localParentType.symbol]; } - } - }); - } - return; - function getParentSymbolsOfPropertyAccess() { - if (implementations) { - var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); - if (propertyAccessExpression) { - var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); - if (localParentType) { - if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== searchSymbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 196608) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } + else if (localParentType.flags & 196608) { + return getSymbolsForClassAndInterfaceComponents(localParentType); } } } } - function getPropertyAccessExpressionFromRightHandSide(node) { - return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { + ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); + var referenceClass = referenceLocation.parent; + if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { + ts.Debug.assert(referenceClass.name === referenceLocation); + addReferences(findOwnConstructorCalls(searchSymbol, sourceFile)); } - function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { - ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); - var referenceClass = referenceLocation.parent; - if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { - ts.Debug.assert(referenceClass.name === referenceLocation); - addReferences(findOwnConstructorCalls(searchSymbol)); - } - else { - var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); - if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) { - addReferences(superConstructorAccesses(classExtending)); - } + else { + var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); + if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation, typeChecker) === searchSymbol) { + addReferences(superConstructorAccesses(classExtending)); } } - function addReferences(references) { - if (references.length) { - var referencedSymbol = getReferencedSymbol(searchSymbol); - ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); - } + } + function addReferences(references) { + if (references.length) { + var referencedSymbol = getReferencedSymbol(searchSymbol); + ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); } - function findOwnConstructorCalls(classSymbol) { - var result = []; - for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150); - var ctrKeyword = decl.getChildAt(0); - ts.Debug.assert(ctrKeyword.kind === 122); - result.push(ctrKeyword); - } - ts.forEachProperty(classSymbol.exports, function (member) { - var decl = member.valueDeclaration; - if (decl && decl.kind === 149) { - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 98, function (thisKeyword) { - if (ts.isNewExpressionTarget(thisKeyword)) { - result.push(thisKeyword); - } - }); - } - } + } + function getReferencedSymbol(symbol) { + var symbolId = ts.getSymbolId(symbol); + var index = symbolToIndex[symbolId]; + if (index === undefined) { + index = result.length; + symbolToIndex[symbolId] = index; + result.push({ + definition: getDefinition(symbol, searchLocation, typeChecker), + references: [] }); - return result; } - function superConstructorAccesses(cls) { - var symbol = cls.symbol; - var ctr = symbol.members["__constructor"]; - if (!ctr) { - return []; - } - var result = []; - for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150); - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 96, function (node) { - if (ts.isCallExpressionTarget(node)) { - result.push(node); - } - }); - } - } - ; - return result; + return result[index]; + } + function addReferenceToRelatedSymbol(node, relatedSymbol) { + var references = getReferencedSymbol(relatedSymbol).references; + if (implementations) { + getImplementationReferenceEntryForNode(node, references, typeChecker); } - function getReferencedSymbol(symbol) { - var symbolId = ts.getSymbolId(symbol); - var index = symbolToIndex[symbolId]; - if (index === undefined) { - index = result.length; - symbolToIndex[symbolId] = index; - result.push({ - definition: getDefinition(symbol), - references: [] + else { + references.push(getReferenceEntryFromNode(node)); + } + } + } + function getPropertyAccessExpressionFromRightHandSide(node) { + return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + function findOwnConstructorCalls(classSymbol, sourceFile) { + var result = []; + for (var _i = 0, _a = classSymbol.members.get("__constructor").declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var ctrKeyword = ts.findChildOfKind(decl, 122, sourceFile); + ts.Debug.assert(decl.kind === 151 && !!ctrKeyword); + result.push(ctrKeyword); + } + classSymbol.exports.forEach(function (member) { + var decl = member.valueDeclaration; + if (decl && decl.kind === 150) { + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 98, function (thisKeyword) { + if (ts.isNewExpressionTarget(thisKeyword)) { + result.push(thisKeyword); + } }); } - return result[index]; } - function addReferenceToRelatedSymbol(node, relatedSymbol) { - var references = getReferencedSymbol(relatedSymbol).references; - if (implementations) { - getImplementationReferenceEntryForNode(node, references); - } - else { - references.push(getReferenceEntryFromNode(node)); - } + }); + return result; + } + function superConstructorAccesses(cls) { + var symbol = cls.symbol; + var ctr = symbol.members.get("__constructor"); + if (!ctr) { + return []; + } + var result = []; + for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts.Debug.assert(decl.kind === 151); + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 96, function (node) { + if (ts.isCallExpressionTarget(node)) { + result.push(node); + } + }); } } - function getImplementationReferenceEntryForNode(refNode, result) { - if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { - result.push(getReferenceEntryFromNode(refNode.parent)); + ; + return result; + } + function getImplementationReferenceEntryForNode(refNode, result, typeChecker) { + if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { + result.push(getReferenceEntryFromNode(refNode.parent)); + } + else if (refNode.kind === 70) { + if (refNode.parent.kind === 260) { + getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); } - else if (refNode.kind === 70) { - if (refNode.parent.kind === 259) { - getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); - } - var containingClass = getContainingClassIfInHeritageClause(refNode); - if (containingClass) { - result.push(getReferenceEntryFromNode(containingClass)); - return; - } - var containingTypeReference = getContainingTypeReference(refNode); - if (containingTypeReference) { - var parent_19 = containingTypeReference.parent; - if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); - } - else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { - if (parent_19.body.kind === 205) { - ts.forEachReturnStatement(parent_19.body, function (returnStatement) { - if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { - maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); - } - }); - } - else if (isImplementationExpression(parent_19.body)) { - maybeAdd(getReferenceEntryFromNode(parent_19.body)); - } + var containingClass = getContainingClassIfInHeritageClause(refNode); + if (containingClass) { + result.push(getReferenceEntryFromNode(containingClass)); + return; + } + var containingTypeReference = getContainingTypeReference(refNode); + if (containingTypeReference) { + var parent = containingTypeReference.parent; + if (ts.isVariableLike(parent) && parent.type === containingTypeReference && parent.initializer && isImplementationExpression(parent.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent.initializer)); + } + else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { + if (parent.body.kind === 206) { + ts.forEachReturnStatement(parent.body, function (returnStatement) { + if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { + maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); + } + }); } - else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_19.expression)); + else if (isImplementationExpression(parent.body)) { + maybeAdd(getReferenceEntryFromNode(parent.body)); } } - } - function maybeAdd(a) { - if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { - result.push(a); + else if (ts.isAssertionExpression(parent) && isImplementationExpression(parent.expression)) { + maybeAdd(getReferenceEntryFromNode(parent.expression)); } } } - function getSymbolsForClassAndInterfaceComponents(type, result) { - if (result === void 0) { result = []; } - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var componentType = _a[_i]; - if (componentType.symbol && componentType.symbol.getFlags() & (32 | 64)) { - result.push(componentType.symbol); - } - if (componentType.getFlags() & 196608) { - getSymbolsForClassAndInterfaceComponents(componentType, result); - } + function maybeAdd(a) { + if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { + result.push(a); } - return result; } - function getContainingTypeReference(node) { - var topLevelTypeReference = undefined; - while (node) { - if (ts.isTypeNode(node)) { - topLevelTypeReference = node; - } - node = node.parent; + } + function getSymbolsForClassAndInterfaceComponents(type, result) { + if (result === void 0) { result = []; } + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var componentType = _a[_i]; + if (componentType.symbol && componentType.symbol.getFlags() & (32 | 64)) { + result.push(componentType.symbol); + } + if (componentType.getFlags() & 196608) { + getSymbolsForClassAndInterfaceComponents(componentType, result); } - return topLevelTypeReference; } - function getContainingClassIfInHeritageClause(node) { - if (node && node.parent) { - if (node.kind === 199 - && node.parent.kind === 256 - && ts.isClassLike(node.parent.parent)) { - return node.parent.parent; - } - else if (node.kind === 70 || node.kind === 177) { - return getContainingClassIfInHeritageClause(node.parent); - } + return result; + } + function getContainingTypeReference(node) { + var topLevelTypeReference = undefined; + while (node) { + if (ts.isTypeNode(node)) { + topLevelTypeReference = node; } - return undefined; + node = node.parent; } - function isImplementationExpression(node) { - if (node.kind === 183) { + return topLevelTypeReference; + } + function getContainingClassIfInHeritageClause(node) { + if (node && node.parent) { + if (node.kind === 200 + && node.parent.kind === 257 + && ts.isClassLike(node.parent.parent)) { + return node.parent.parent; + } + else if (node.kind === 70 || node.kind === 178) { + return getContainingClassIfInHeritageClause(node.parent); + } + } + return undefined; + } + function isImplementationExpression(node) { + switch (node.kind) { + case 184: return isImplementationExpression(node.expression); + case 186: + case 185: + case 177: + case 198: + case 176: + return true; + default: + return false; + } + } + function explicitlyInheritsFrom(child, parent, cachedResults, typeChecker) { + var parentIsInterface = parent.getFlags() & 64; + return searchHierarchy(child); + function searchHierarchy(symbol) { + if (symbol === parent) { + return true; } - return node.kind === 185 || - node.kind === 184 || - node.kind === 176 || - node.kind === 197 || - node.kind === 175; - } - function explicitlyInheritsFrom(child, parent, cachedResults) { - var parentIsInterface = parent.getFlags() & 64; - return searchHierarchy(child); - function searchHierarchy(symbol) { - if (symbol === parent) { - return true; - } - var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); - if (key in cachedResults) { - return cachedResults[key]; - } - cachedResults[key] = false; - var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { - if (ts.isClassLike(declaration)) { - if (parentIsInterface) { - var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration); - if (interfaceReferences) { - for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) { - var typeReference = interfaceReferences_1[_i]; - if (searchTypeReference(typeReference)) { - return true; - } + var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); + var cached = cachedResults.get(key); + if (cached !== undefined) { + return cached; + } + cachedResults.set(key, false); + var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { + if (ts.isClassLike(declaration)) { + if (parentIsInterface) { + var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration); + if (interfaceReferences) { + for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) { + var typeReference = interfaceReferences_1[_i]; + if (searchTypeReference(typeReference)) { + return true; } } } - return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); - } - else if (declaration.kind === 228) { - if (parentIsInterface) { - return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); - } } - return false; - }); - cachedResults[key] = inherits; - return inherits; - } - function searchTypeReference(typeReference) { - if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); - if (type && type.symbol) { - return searchHierarchy(type.symbol); + return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + } + else if (declaration.kind === 229) { + if (parentIsInterface) { + return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } } return false; + }); + cachedResults.set(key, inherits); + return inherits; + } + function searchTypeReference(typeReference) { + if (typeReference) { + var type = typeChecker.getTypeAtLocation(typeReference); + if (type && type.symbol) { + return searchHierarchy(type.symbol); + } } + return false; + } + } + function getReferencesForSuperKeyword(superKeyword, typeChecker, cancellationToken) { + var searchSpaceNode = ts.getSuperContainer(superKeyword, false); + if (!searchSpaceNode) { + return undefined; } - function getReferencesForSuperKeyword(superKeyword) { - var searchSpaceNode = ts.getSuperContainer(superKeyword, false); - if (!searchSpaceNode) { + var staticFlag = 32; + switch (searchSpaceNode.kind) { + case 148: + case 147: + case 150: + case 149: + case 151: + case 152: + case 153: + staticFlag &= ts.getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; + break; + default: return undefined; + } + var references = []; + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd(), cancellationToken); + for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) { + var position = possiblePositions_3[_i]; + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 96) { + continue; } - var staticFlag = 32; - switch (searchSpaceNode.kind) { - case 147: - case 146: - case 149: - case 148: - case 150: - case 151: - case 152: - staticFlag &= ts.getModifierFlags(searchSpaceNode); - searchSpaceNode = searchSpaceNode.parent; + var container = ts.getSuperContainer(node, false); + if (container && (32 & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + references.push(getReferenceEntryFromNode(node)); + } + } + var definition = getDefinition(searchSpaceNode.symbol, superKeyword, typeChecker); + return [{ definition: definition, references: references }]; + } + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, typeChecker, cancellationToken) { + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); + var staticFlag = 32; + switch (searchSpaceNode.kind) { + case 150: + case 149: + if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; - default: + } + case 148: + case 147: + case 151: + case 152: + case 153: + staticFlag &= ts.getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; + break; + case 263: + if (ts.isExternalModule(searchSpaceNode)) { return undefined; - } - var references = []; + } + case 227: + case 185: + break; + default: + return undefined; + } + var references = []; + var possiblePositions; + if (searchSpaceNode.kind === 263) { + ts.forEach(sourceFiles, function (sourceFile) { + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); + }); + } + else { var sourceFile = searchSpaceNode.getSourceFile(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd(), cancellationToken); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); + } + var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); + var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: thisOrSuperKeyword.getSourceFile().fileName, + kind: ts.ScriptElementKind.variableElement, + name: "this", + textSpan: ts.createTextSpanFromNode(thisOrSuperKeyword), + displayParts: displayParts + }, + references: references + }]; + function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 96) { + if (!node || !ts.isThis(node)) { return; } - var container = ts.getSuperContainer(node, false); - if (container && (32 & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - references.push(getReferenceEntryFromNode(node)); + var container = ts.getThisContainer(node, false); + switch (searchSpaceNode.kind) { + case 185: + case 227: + if (searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 150: + case 149: + if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 198: + case 228: + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 263: + if (container.kind === 263 && !ts.isExternalModule(container)) { + result.push(getReferenceEntryFromNode(node)); + } + break; } }); - var definition = getDefinition(searchSpaceNode.symbol); - return [{ definition: definition, references: references }]; } - function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { - var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); - var staticFlag = 32; - switch (searchSpaceNode.kind) { - case 149: - case 148: - if (ts.isObjectLiteralMethod(searchSpaceNode)) { - break; - } - case 147: - case 146: - case 150: - case 151: - case 152: - staticFlag &= ts.getModifierFlags(searchSpaceNode); - searchSpaceNode = searchSpaceNode.parent; - break; - case 262: - if (ts.isExternalModule(searchSpaceNode)) { - return undefined; - } - case 226: - case 184: - break; - default: - return undefined; - } - var references = []; - var possiblePositions; - if (searchSpaceNode.kind === 262) { - ts.forEach(sourceFiles, function (sourceFile) { - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); - getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); - }); - } - else { - var sourceFile = searchSpaceNode.getSourceFile(); - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); - } - var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); - var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: "this", - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: displayParts - }, - references: references - }]; - function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || !ts.isThis(node)) { - return; - } - var container = ts.getThisContainer(node, false); - switch (searchSpaceNode.kind) { - case 184: - case 226: - if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 149: - case 148: - if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 197: - case 227: - if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 262: - if (container.kind === 262 && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); - } - break; - } - }); - } + } + function getReferencesForStringLiteral(node, sourceFiles, typeChecker, cancellationToken) { + var type = ts.getStringLiteralTypeForNode(node, typeChecker); + if (!type) { + return undefined; } - function getReferencesForStringLiteral(node, sourceFiles) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (!type) { - return undefined; - } - var references = []; - for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { - var sourceFile = sourceFiles_9[_i]; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); - getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); - } - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: type.text, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] - }, - references: references - }]; - function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { - for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { - var position = possiblePositions_1[_i]; - cancellationToken.throwIfCancellationRequested(); - var node_3 = ts.getTouchingWord(sourceFile, position); - if (!node_3 || node_3.kind !== 9) { - return; - } - var type_1 = ts.getStringLiteralTypeForNode(node_3, typeChecker); - if (type_1 === searchType) { - references.push(getReferenceEntryFromNode(node_3)); - } + var references = []; + for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { + var sourceFile = sourceFiles_9[_i]; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ts.ScriptElementKind.variableElement, + name: type.text, + textSpan: ts.createTextSpanFromNode(node), + displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] + }, + references: references + }]; + function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { + for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { + var position = possiblePositions_4[_i]; + cancellationToken.throwIfCancellationRequested(); + var node_2 = ts.getTouchingWord(sourceFile, position); + if (!node_2 || node_2.kind !== 9) { + return; } - } - } - function populateSearchSymbolSet(symbol, location) { - var result = [symbol]; - var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 259) { - var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); - if (propertySymbol) { - result.push(propertySymbol); + var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + if (type_2 === searchType) { + references.push(getReferenceEntryFromNode(node_2)); } } - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); - if (aliasSymbol) { - result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); + } + } + function populateSearchSymbolSet(symbol, location, typeChecker, implementations) { + var result = [symbol]; + var containingObjectLiteralElement = getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 260) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, typeChecker); + if (propertySymbol) { + result.push(propertySymbol); } - if (containingObjectLiteralElement) { - ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); - }); - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); - if (shorthandValueSymbol) { - result.push(shorthandValueSymbol); - } + } + if (containingObjectLiteralElement) { + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, typeChecker), function (contextualSymbol) { + ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); + }); + var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol) { + result.push(shorthandValueSymbol); } - if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 && - ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { - result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 145 && + ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { + ts.addRange(result, typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, typeChecker); + if (bindingElementPropertySymbol) { + result.push(bindingElementPropertySymbol); + } + for (var _i = 0, _a = typeChecker.getRootSymbols(symbol); _i < _a.length; _i++) { + var rootSymbol = _a[_i]; + if (rootSymbol !== symbol) { + result.push(rootSymbol); } - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); - if (bindingElementPropertySymbol) { - result.push(bindingElementPropertySymbol); + if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap(), typeChecker); } - ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { - if (rootSymbol !== symbol) { - result.push(rootSymbol); + } + return result; + } + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, typeChecker) { + if (!symbol) { + return; + } + if (previousIterationSymbolsCache.has(symbol.name)) { + return; + } + if (symbol.flags & (32 | 64)) { + ts.forEach(symbol.getDeclarations(), function (declaration) { + if (ts.isClassLike(declaration)) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap()); + else if (declaration.kind === 229) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); - return result; } - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { - if (!symbol) { - return; - } - if (symbol.name in previousIterationSymbolsCache) { - return; - } - if (symbol.flags & (32 | 64)) { - ts.forEach(symbol.getDeclarations(), function (declaration) { - if (ts.isClassLike(declaration)) { - getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); - ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); - } - else if (declaration.kind === 228) { - ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); - } - }); - } - return; - function getPropertySymbolFromTypeReference(typeReference) { - if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); - if (type) { - var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); - if (propertySymbol) { - result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); - } - previousIterationSymbolsCache[symbol.name] = symbol; - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); + return; + function getPropertySymbolFromTypeReference(typeReference) { + if (typeReference) { + var type = typeChecker.getTypeAtLocation(typeReference); + if (type) { + var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); + if (propertySymbol) { + result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); } + previousIterationSymbolsCache.set(symbol.name, symbol); + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, typeChecker); } } } - function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) { - if (ts.contains(searchSymbols, referenceSymbol)) { - return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol; - } - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); - if (aliasSymbol) { - return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache); + } + function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache, typeChecker) { + if (ts.contains(searchSymbols, referenceSymbol)) { + return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) ? referenceSymbol : undefined; + } + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation, typeChecker); + if (aliasSymbol) { + return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache, typeChecker); + } + var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + if (containingObjectLiteralElement) { + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, typeChecker), function (contextualSymbol) { + return ts.find(typeChecker.getRootSymbols(contextualSymbol), function (symbol) { return ts.contains(searchSymbols, symbol); }); + }); + if (contextualSymbol) { + return contextualSymbol; } - var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); - if (containingObjectLiteralElement) { - var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); - }); - if (contextualSymbol) { - return contextualSymbol; - } - var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); - if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { - return propertySymbol; - } + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, typeChecker); + if (propertySymbol && ts.contains(searchSymbols, propertySymbol)) { + return propertySymbol; } - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); - if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { - return bindingElementPropertySymbol; + } + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, typeChecker); + if (bindingElementPropertySymbol && ts.contains(searchSymbols, bindingElementPropertySymbol)) { + return bindingElementPropertySymbol; + } + return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { + if (ts.contains(searchSymbols, rootSymbol)) { + return rootSymbol; } - return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { - if (searchSymbols.indexOf(rootSymbol) >= 0) { - return rootSymbol; - } - if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - if (parents) { - if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) { - return undefined; - } + if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { + if (parents) { + if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache, typeChecker); })) { + return undefined; } - var result_4 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, ts.createMap()); - return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); } - return undefined; - }); - } - function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 142) { - var nameExpression = node.name.expression; - if (ts.isStringOrNumericLiteral(nameExpression)) { - return nameExpression.text; - } - return undefined; + var result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap(), typeChecker); + return ts.find(result, function (symbol) { return ts.contains(searchSymbols, symbol); }); } - return node.name.text; - } - function getPropertySymbolsFromContextualType(node) { - var objectLiteral = node.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); - var name = getNameFromObjectLiteralElement(node); - if (name && contextualType) { - var result_5 = []; - var symbol_2 = contextualType.getProperty(name); - if (symbol_2) { - result_5.push(symbol_2); - } - if (contextualType.flags & 65536) { - ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name); - if (symbol) { - result_5.push(symbol); - } - }); - } - return result_5; + return undefined; + }); + } + function getNameFromObjectLiteralElement(node) { + if (node.name.kind === 143) { + var nameExpression = node.name.expression; + if (ts.isStringOrNumericLiteral(nameExpression)) { + return nameExpression.text; } return undefined; } - function getIntersectingMeaningFromDeclarations(meaning, declarations) { - if (declarations) { - var lastIterationMeaning = void 0; - do { - lastIterationMeaning = meaning; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; - var declarationMeaning = ts.getMeaningFromDeclaration(declaration); - if (declarationMeaning & meaning) { - meaning |= declarationMeaning; - } + return node.name.text; + } + function getPropertySymbolsFromContextualType(node, typeChecker) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = getNameFromObjectLiteralElement(node); + if (name && contextualType) { + var result_4 = []; + var symbol = contextualType.getProperty(name); + if (symbol) { + result_4.push(symbol); + } + if (contextualType.flags & 65536) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_4.push(symbol); } - } while (meaning !== lastIterationMeaning); + }); } - return meaning; + return result_4; } + return undefined; + } + function getIntersectingMeaningFromDeclarations(meaning, declarations) { + if (declarations) { + var lastIterationMeaning = void 0; + do { + lastIterationMeaning = meaning; + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; + var declarationMeaning = ts.getMeaningFromDeclaration(declaration); + if (declarationMeaning & meaning) { + meaning |= declarationMeaning; + } + } + } while (meaning !== lastIterationMeaning); + } + return meaning; } - FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; function convertReferences(referenceSymbols) { if (!referenceSymbols) { return undefined; @@ -57539,7 +57913,7 @@ var ts; if (node.initializer) { return true; } - else if (node.kind === 224) { + else if (node.kind === 225) { var parentStatement = getParentStatementOfVariableDeclaration(node); return parentStatement && ts.hasModifier(parentStatement, 2); } @@ -57549,18 +57923,18 @@ var ts; } else { switch (node.kind) { - case 227: - case 197: - case 230: + case 228: + case 198: case 231: + case 232: return true; } } return false; } function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 206) { - ts.Debug.assert(node.parent.kind === 225); + if (node.parent && node.parent.parent && node.parent.parent.kind === 207) { + ts.Debug.assert(node.parent.kind === 226); return node.parent.parent; } } @@ -57598,10 +57972,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 191 || parent.kind === 190) { + if (parent.kind === 192 || parent.kind === 191) { return true; } - else if (parent.kind === 192 && parent.left === node) { + else if (parent.kind === 193 && parent.left === node) { var operator = parent.operatorToken.kind; return 57 <= operator && operator <= 69; } @@ -57620,7 +57994,7 @@ var ts; switch (node.kind) { case 9: case 8: - if (node.parent.kind === 142) { + if (node.parent.kind === 143) { return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; } case 70: @@ -57630,11 +58004,11 @@ var ts; } function isObjectLiteralPropertyDeclaration(node) { switch (node.kind) { - case 258: case 259: - case 149: - case 151: + case 260: + case 150: case 152: + case 153: return true; } return false; @@ -57648,6 +58022,9 @@ var ts; } return false; } + function isImportDefaultSymbol(symbol) { + return symbol.declarations[0].kind === 238; + } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); var ts; @@ -57665,11 +58042,9 @@ var ts; } var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { - var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; - if (referenceFile && referenceFile.resolvedFileName) { - return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; - } - return undefined; + var referenceFile = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName); + return referenceFile && referenceFile.resolvedFileName && + [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } var node = ts.getTouchingPropertyName(sourceFile, position); if (node === sourceFile) { @@ -57678,7 +58053,7 @@ var ts; if (ts.isJumpStatementTarget(node)) { var labelName = node.text; var label = ts.getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, undefined)] : undefined; + return label ? [createDefinitionInfoFromName(label, ts.ScriptElementKind.label, labelName, undefined)] : undefined; } var typeChecker = program.getTypeChecker(); var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); @@ -57693,11 +58068,11 @@ var ts; var declaration = symbol.declarations[0]; if (node.kind === 70 && (node.parent === declaration || - (declaration.kind === 240 && declaration.parent && declaration.parent.kind === 239))) { + (declaration.kind === 241 && declaration.parent && declaration.parent.kind === 240))) { symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 259) { + if (node.parent.kind === 260) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -57725,13 +58100,13 @@ var ts; return undefined; } if (type.flags & 65536 && !(type.flags & 16)) { - var result_6 = []; + var result_5 = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(result_6, getDefinitionFromSymbol(typeChecker, t.symbol, node)); + ts.addRange(result_5, getDefinitionFromSymbol(typeChecker, t.symbol, node)); } }); - return result_6; + return result_5; } if (!type.symbol) { return undefined; @@ -57773,29 +58148,40 @@ var ts; function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { var declarations = []; var definition; - ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 150) || - (!selectConstructors && (d.kind === 226 || d.kind === 149 || d.kind === 148))) { + for (var _i = 0, signatureDeclarations_1 = signatureDeclarations; _i < signatureDeclarations_1.length; _i++) { + var d = signatureDeclarations_1[_i]; + if (selectConstructors ? d.kind === 151 : isSignatureDeclaration(d)) { declarations.push(d); if (d.body) definition = d; } - }); - if (definition) { - result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); - return true; } - else if (declarations.length) { - result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); + if (declarations.length) { + result.push(createDefinitionInfo(definition || ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); return true; } return false; } } + function isSignatureDeclaration(node) { + switch (node.kind) { + case 151: + case 227: + case 150: + case 149: + return true; + default: + return false; + } + } function createDefinitionInfo(node, symbolKind, symbolName, containerName) { + return createDefinitionInfoFromName(node.name || node, symbolKind, symbolName, containerName); + } + function createDefinitionInfoFromName(name, symbolKind, symbolName, containerName) { + var sourceFile = name.getSourceFile(); return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromNode(name, sourceFile), kind: symbolKind, name: symbolName, containerKind: undefined, @@ -57842,7 +58228,11 @@ var ts; } function tryGetSignatureDeclaration(typeChecker, node) { var callLike = getAncestorCallLikeExpression(node); - return callLike && typeChecker.getResolvedSignature(callLike).declaration; + var decl = callLike && typeChecker.getResolvedSignature(callLike).declaration; + if (decl && isSignatureDeclaration(decl)) { + return decl; + } + return undefined; } })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); })(ts || (ts = {})); @@ -57851,7 +58241,7 @@ var ts; var GoToImplementation; (function (GoToImplementation) { function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { - if (node.parent.kind === 259) { + if (node.parent.kind === 260) { var result = []; ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); return result.length > 0 ? result : undefined; @@ -57861,7 +58251,7 @@ var ts; return symbol.valueDeclaration && [ts.FindAllReferences.getReferenceEntryFromNode(symbol.valueDeclaration)]; } else { - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, false, false, true); + var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, false, false, false, true); var result = ts.flatMap(referencedSymbols, function (symbol) { return ts.map(symbol.references, function (_a) { var textSpan = _a.textSpan, fileName = _a.fileName; @@ -57977,16 +58367,16 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 226: - case 149: - case 150: case 227: - case 206: + case 150: + case 151: + case 228: + case 207: break findOwner; - case 262: + case 263: return undefined; - case 231: - if (commentOwner.parent.kind === 231) { + case 232: + if (commentOwner.parent.kind === 232) { return undefined; } break findOwner; @@ -58026,7 +58416,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 206) { + if (commentOwner.kind === 207) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -58036,17 +58426,17 @@ var ts; return ts.emptyArray; } function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 183) { + while (rightHandSide.kind === 184) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 184: case 185: + case 186: return rightHandSide.parameters; - case 197: + case 198: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150) { + if (member.kind === 151) { return member.parameters; } } @@ -58084,7 +58474,7 @@ var ts; }); if (!safeList) { var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMap(result.config) : EmptySafeList; + safeList = result.config ? ts.createMapFromTemplate(result.config) : EmptySafeList; } var filesToWatch = []; var searchDirs = []; @@ -58109,31 +58499,31 @@ var ts; if (unresolvedImports) { for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { var moduleId = unresolvedImports_1[_a]; - var typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; + var typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); } } } - for (var name_47 in packageNameToTypingLocation) { - if (name_47 in inferredTypings && !inferredTypings[name_47]) { - inferredTypings[name_47] = packageNameToTypingLocation[name_47]; + packageNameToTypingLocation.forEach(function (typingLocation, name) { + if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { + inferredTypings.set(name, typingLocation); } - } + }); for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { var excludeTypingName = exclude_1[_b]; - delete inferredTypings[excludeTypingName]; + inferredTypings.delete(excludeTypingName); } var newTypingNames = []; var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); + inferredTypings.forEach(function (inferred, typing) { + if (inferred !== undefined) { + cachedTypingPaths.push(inferred); } else { newTypingNames.push(typing); } - } + }); return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; function mergeTypings(typingNames) { if (!typingNames) { @@ -58141,8 +58531,8 @@ var ts; } for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; + if (!inferredTypings.has(typing)) { + inferredTypings.set(typing, undefined); } } } @@ -58172,7 +58562,7 @@ var ts; var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); if (safeList !== EmptySafeList) { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return safeList.has(f); })); } var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; }); if (hasJsxFile) { @@ -58205,7 +58595,7 @@ var ts; } if (packageJson.typings) { var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; + inferredTypings.set(packageJson.name, absolutePath); } else { typingNames.push(packageJson.name); @@ -58224,41 +58614,43 @@ var ts; function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; - ts.forEach(sourceFiles, function (sourceFile) { + var _loop_4 = function (sourceFile) { cancellationToken.throwIfCancellationRequested(); if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) { - return; + return "continue"; } - var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_48 in nameToDeclarations) { - var declarations = nameToDeclarations[name_48]; + ts.forEachEntry(sourceFile.getNamedDeclarations(), function (declarations, name) { if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_48); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); if (!matches) { - continue; + return; } for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; if (patternMatcher.patternContainsDots) { var containers = getContainers(declaration); if (!containers) { - return undefined; + return true; } - matches = patternMatcher.getMatches(containers, name_48); + matches = patternMatcher.getMatches(containers, name); if (!matches) { - continue; + return; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_48, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } - } - }); + }); + }; + for (var _i = 0, sourceFiles_10 = sourceFiles; _i < sourceFiles_10.length; _i++) { + var sourceFile = sourceFiles_10[_i]; + _loop_4(sourceFile); + } rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 237 || decl.kind === 240 || decl.kind === 235) { + if (decl.kind === 238 || decl.kind === 241 || decl.kind === 236) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -58299,7 +58691,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 142) { + else if (declaration.name.kind === 143) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -58316,7 +58708,7 @@ var ts; } return true; } - if (expression.kind === 177) { + if (expression.kind === 178) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -58327,7 +58719,7 @@ var ts; } function getContainers(declaration) { var containers = []; - if (declaration.name.kind === 142) { + if (declaration.name.kind === 143) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -58368,7 +58760,7 @@ var ts; matchKind: ts.PatternMatchKind[rawItem.matchKind], isCaseSensitive: rawItem.isCaseSensitive, fileName: rawItem.fileName, - textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + textSpan: ts.createTextSpanFromNode(declaration), containerName: container && container.name ? container.name.text : "", containerKind: container && container.name ? ts.getNodeKind(container) : "" }; @@ -58459,7 +58851,7 @@ var ts; return; } switch (node.kind) { - case 150: + case 151: var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); for (var _i = 0, _a = ctr.parameters; _i < _a.length; _i++) { @@ -58469,28 +58861,28 @@ var ts; } } break; - case 149: - case 151: + case 150: case 152: - case 148: + case 153: + case 149: if (!ts.hasDynamicName(node)) { addNodeWithRecursiveChild(node, node.body); } break; + case 148: case 147: - case 146: if (!ts.hasDynamicName(node)) { addLeafNode(node); } break; - case 237: + case 238: var importClause = node; if (importClause.name) { addLeafNode(importClause); } var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 238) { + if (namedBindings.kind === 239) { addLeafNode(namedBindings); } else { @@ -58501,12 +58893,12 @@ var ts; } } break; - case 174: - case 224: + case 175: + case 225: var decl = node; - var name_49 = decl.name; - if (ts.isBindingPattern(name_49)) { - addChildrenRecursively(name_49); + var name = decl.name; + if (ts.isBindingPattern(name)) { + addChildrenRecursively(name); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { addChildrenRecursively(decl.initializer); @@ -58515,12 +58907,12 @@ var ts; addNodeWithRecursiveChild(decl, decl.initializer); } break; + case 186: + case 227: case 185: - case 226: - case 184: addNodeWithRecursiveChild(node, node.body); break; - case 230: + case 231: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -58530,9 +58922,9 @@ var ts; } endNode(); break; - case 227: - case 197: case 228: + case 198: + case 229: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -58540,21 +58932,21 @@ var ts; } endNode(); break; - case 231: + case 232: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 244: - case 235: - case 155: - case 153: + case 245: + case 236: + case 156: case 154: - case 229: + case 155: + case 230: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 286) { + if (tag.kind === 287) { addLeafNode(tag); } }); @@ -58570,9 +58962,9 @@ var ts; if (!name) { return true; } - var itemsWithSameName = nameToItems[name]; + var itemsWithSameName = nameToItems.get(name); if (!itemsWithSameName) { - nameToItems[name] = child; + nameToItems.set(name, child); return true; } if (itemsWithSameName instanceof Array) { @@ -58590,7 +58982,7 @@ var ts; if (tryMerge(itemWithSameName, child)) { return false; } - nameToItems[name] = [itemWithSameName, child]; + nameToItems.set(name, [itemWithSameName, child]); return true; } function tryMerge(a, b) { @@ -58602,12 +58994,12 @@ var ts; } }); function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 231 || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 232 || areSameModule(a, b)); function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 231) { + if (a.body.kind !== 232) { return true; } return areSameModule(a.body, b.body); @@ -58633,32 +59025,15 @@ var ts; function compareChildren(child1, child2) { var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node); if (name1 && name2) { - var cmp = localeCompareFix(name1, name2); + var cmp = ts.compareStringsCaseInsensitive(name1, name2); return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } else { return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } } - var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; - var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) { - for (var i = 0; i < Math.min(a.length, b.length); i++) { - var chA = a.charAt(i), chB = b.charAt(i); - if (chA === "\"" && chB === "'") { - return 1; - } - if (chA === "'" && chB === "\"") { - return -1; - } - var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase()); - if (cmp !== 0) { - return cmp; - } - } - return a.length - b.length; - }; function tryGetName(node) { - if (node.kind === 231) { + if (node.kind === 232) { return getModuleName(node); } var decl = node; @@ -58666,18 +59041,18 @@ var ts; return ts.getPropertyNameForPropertyNameNode(decl.name); } switch (node.kind) { - case 184: case 185: - case 197: + case 186: + case 198: return getFunctionOrClassName(node); - case 286: + case 287: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 231) { + if (node.kind === 232) { return getModuleName(node); } var name = node.name; @@ -58688,29 +59063,29 @@ var ts; } } switch (node.kind) { - case 262: + case 263: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 185: - case 226: - case 184: + case 186: case 227: - case 197: + case 185: + case 228: + case 198: if (ts.getModifierFlags(node) & 512) { return "default"; } return getFunctionOrClassName(node); - case 150: + case 151: return "constructor"; - case 154: + case 155: return "new()"; - case 153: + case 154: return "()"; - case 155: + case 156: return "[]"; - case 286: + case 287: return getJSDocTypedefTagName(node); default: return ""; @@ -58722,7 +59097,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 206) { + if (parentNode && parentNode.kind === 207) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -58750,24 +59125,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 227: - case 197: - case 230: case 228: + case 198: case 231: - case 262: case 229: - case 286: + case 232: + case 263: + case 230: + case 287: return true; - case 150: - case 149: case 151: + case 150: case 152: - case 224: + case 153: + case 225: return hasSomeImportantChild(item); + case 186: + case 227: case 185: - case 226: - case 184: return isTopLevelFunctionDeclaration(item); default: return false; @@ -58777,10 +59152,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 232: - case 262: - case 149: + case 233: + case 263: case 150: + case 151: return true; default: return hasSomeImportantChild(item); @@ -58789,7 +59164,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 224 && childKind !== 174; + return childKind !== 225 && childKind !== 175; }); } } @@ -58799,7 +59174,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToTree) }; @@ -58808,7 +59183,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray, indent: n.indent, @@ -58844,35 +59219,41 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 231) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 232) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } return result.join("."); } function getInteriorModule(decl) { - return decl.body.kind === 231 ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 232 ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 142; + return !member.name || member.name.kind === 143; } function getNodeSpan(node) { - return node.kind === 262 + return node.kind === 263 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); + : ts.createTextSpanFromNode(node, curSourceFile); + } + function getModifiers(node) { + if (node.parent && node.parent.kind === 225) { + node = node.parent; + } + return ts.getNodeModifiers(node); } function getFunctionOrClassName(node) { if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 224) { + else if (node.parent.kind === 225) { return ts.declarationNameToString(node.parent.name); } - else if (node.parent.kind === 192 && + else if (node.parent.kind === 193 && node.parent.operatorToken.kind === 57) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 258 && node.parent.name) { + else if (node.parent.kind === 259 && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512) { @@ -58883,7 +59264,7 @@ var ts; } } function isFunctionOrClassExpression(node) { - return node.kind === 184 || node.kind === 185 || node.kind === 197; + return node.kind === 185 || node.kind === 186 || node.kind === 198; } var whiteSpaceRegex = /\s+/g; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); @@ -58899,7 +59280,7 @@ var ts; if (hintSpanNode && startElement && endElement) { var span_12 = { textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), - hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + hintSpan: ts.createTextSpanFromNode(hintSpanNode, sourceFile), bannerText: collapseText, autoCollapse: autoCollapse }; @@ -58956,7 +59337,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 185; + return ts.isFunctionBlock(node) && node.parent.kind !== 186; } var depth = 0; var maxDepth = 20; @@ -58968,26 +59349,26 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 205: + case 206: if (!ts.isFunctionBlock(n)) { - var parent_20 = n.parent; + var parent = n.parent; var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); - if (parent_20.kind === 210 || - parent_20.kind === 213 || - parent_20.kind === 214 || - parent_20.kind === 212 || - parent_20.kind === 209 || - parent_20.kind === 211 || - parent_20.kind === 218 || - parent_20.kind === 257) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + if (parent.kind === 211 || + parent.kind === 214 || + parent.kind === 215 || + parent.kind === 213 || + parent.kind === 210 || + parent.kind === 212 || + parent.kind === 219 || + parent.kind === 258) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_20.kind === 222) { - var tryStatement = parent_20; + if (parent.kind === 223) { + var tryStatement = parent; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -58998,7 +59379,7 @@ var ts; } } } - var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end); + var span_14 = ts.createTextSpanFromNode(n); elements.push({ textSpan: span_14, hintSpan: span_14, @@ -59007,23 +59388,23 @@ var ts; }); break; } - case 232: { + case 233: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 227: case 228: - case 230: - case 176: - case 233: { + case 229: + case 231: + case 177: + case 234: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 175: + case 176: var openBracket = ts.findChildOfKind(n, 20, sourceFile); var closeBracket = ts.findChildOfKind(n, 21, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -59100,10 +59481,11 @@ var ts; return totalMatch; } function getWordSpans(word) { - if (!(word in stringToWordSpans)) { - stringToWordSpans[word] = breakIntoWordSpans(word); + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - return stringToWordSpans[word]; + return spans; } function matchTextChunk(candidate, chunk, punctuationStripped) { var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); @@ -59536,7 +59918,7 @@ var ts; else { if (token === 70 || ts.isKeyword(token)) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59562,7 +59944,7 @@ var ts; } if (token === 17) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59576,7 +59958,7 @@ var ts; token = nextToken(); if (token === 70 || ts.isKeyword(token)) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59602,7 +59984,7 @@ var ts; } if (token === 17) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59612,7 +59994,7 @@ var ts; } else if (token === 38) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59739,90 +60121,82 @@ var ts; var Rename; (function (Rename) { function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) { - var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); + var getCanonicalDefaultLibName = ts.memoize(function () { return getCanonicalFileName(ts.normalizePath(defaultLibFileName)); }); var node = ts.getTouchingWord(sourceFile, position, true); - if (node) { - if (node.kind === 70 || - node.kind === 9 || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - ts.isThis(node)) { - var symbol = typeChecker.getSymbolAtLocation(node); - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - if (ts.forEach(declarations, isDefinedInLibraryFile)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - if (kind) { - return { - canRename: true, - kind: kind, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } - else if (node.kind === 9) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (type) { - if (isDefinedInLibraryFile(node)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - else { - var displayName = ts.stripQuotes(type.text); - return { - canRename: true, - kind: ts.ScriptElementKind.variableElement, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: displayName, - kindModifiers: ts.ScriptElementKindModifier.none, - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } + var renameInfo = node && nodeIsEligibleForRename(node) + ? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) + : undefined; + return renameInfo || getRenameInfoError(ts.Diagnostics.You_cannot_rename_this_element); + function isDefinedInLibraryFile(declaration) { + if (!defaultLibFileName) { + return false; } + var sourceFile = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName)); + return canonicalName === getCanonicalDefaultLibName(); } - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element)); - function getRenameInfoError(localizedErrorMessage) { - return { - canRename: false, - localizedErrorMessage: localizedErrorMessage, - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }; - } - function isDefinedInLibraryFile(declaration) { - if (defaultLibFileName) { - var sourceFile_1 = declaration.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)); - if (canonicalName === canonicalDefaultLibName) { - return true; + } + Rename.getRenameInfo = getRenameInfo; + function getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) { + var symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + if (ts.some(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); + return kind ? getRenameInfoSuccess(displayName, typeChecker.getFullyQualifiedName(symbol), kind, ts.SymbolDisplay.getSymbolModifiers(symbol), node, sourceFile) : undefined; } - return false; } - function createTriggerSpanForNode(node, sourceFile) { - var start = node.getStart(sourceFile); - var width = node.getWidth(sourceFile); - if (node.kind === 9) { - start += 1; - width -= 2; + else if (node.kind === 9) { + var type = ts.getStringLiteralTypeForNode(node, typeChecker); + if (type) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); + } + var displayName = ts.stripQuotes(type.text); + return getRenameInfoSuccess(displayName, displayName, ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, node, sourceFile); } - return ts.createTextSpan(start, width); } } - Rename.getRenameInfo = getRenameInfo; + function getRenameInfoSuccess(displayName, fullDisplayName, kind, kindModifiers, node, sourceFile) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: fullDisplayName, + kindModifiers: kindModifiers, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + function getRenameInfoError(diagnostic) { + return { + canRename: false, + localizedErrorMessage: ts.getLocaleSpecificMessage(diagnostic), + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9) { + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } + function nodeIsEligibleForRename(node) { + return node.kind === 70 || node.kind === 9 || + ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + ts.isThis(node); + } })(Rename = ts.Rename || (ts.Rename = {})); })(ts || (ts = {})); var ts; @@ -59855,14 +60229,14 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 179) { + if (argumentInfo.invocation.kind !== 180) { return undefined; } var callExpression = argumentInfo.invocation; var expression = callExpression.expression; var name = expression.kind === 70 ? expression - : expression.kind === 177 + : expression.kind === 178 ? expression.name : undefined; if (!name || !name.text) { @@ -59872,7 +60246,7 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameToDeclarations = sourceFile.getNamedDeclarations(); - var declarations = nameToDeclarations[name.text]; + var declarations = nameToDeclarations.get(name.text); if (declarations) { for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) { var declaration = declarations_10[_b]; @@ -59891,7 +60265,7 @@ var ts; } } function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { - if (node.parent.kind === 179 || node.parent.kind === 180) { + if (node.parent.kind === 180 || node.parent.kind === 181) { var callExpression = node.parent; if (node.kind === 26 || node.kind === 18) { @@ -59923,23 +60297,23 @@ var ts; } return undefined; } - else if (node.kind === 12 && node.parent.kind === 181) { + else if (node.kind === 12 && node.parent.kind === 182) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0, sourceFile); } } - else if (node.kind === 13 && node.parent.parent.kind === 181) { + else if (node.kind === 13 && node.parent.parent.kind === 182) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194); + ts.Debug.assert(templateExpression.kind === 195); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 203 && node.parent.parent.parent.kind === 181) { + else if (node.parent.kind === 204 && node.parent.parent.parent.kind === 182) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194); + ts.Debug.assert(templateExpression.kind === 195); if (node.kind === 15 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } @@ -59949,6 +60323,7 @@ var ts; } return undefined; } + SignatureHelp.getImmediatelyContainingArgumentInfo = getImmediatelyContainingArgumentInfo; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); @@ -60003,7 +60378,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 194) { + if (template.kind === 195) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -60012,7 +60387,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 262; n = n.parent) { + for (var n = node; n.kind !== 263; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -60144,7 +60519,7 @@ var ts; function getSymbolKind(typeChecker, symbol, location) { var flags = symbol.getFlags(); if (flags & 32) - return ts.getDeclarationOfKind(symbol, 197) ? + return ts.getDeclarationOfKind(symbol, 198) ? ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement; if (flags & 384) return ts.ScriptElementKind.enumElement; @@ -60244,14 +60619,14 @@ var ts; var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 177) { + if (location.parent && location.parent.kind === 178) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } var callExpression = void 0; - if (location.kind === 179 || location.kind === 180) { + if (location.kind === 180 || location.kind === 181) { callExpression = location; } else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) { @@ -60263,7 +60638,7 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 180 || callExpression.expression.kind === 96; + var useConstructSignatures = callExpression.kind === 181 || callExpression.expression.kind === 96; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -60311,21 +60686,21 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 122 && location.parent.kind === 150)) { + (location.kind === 122 && location.parent.kind === 151)) { var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 150 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration.kind === 151 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 150) { + if (functionDeclaration.kind === 151) { symbolKind = ts.ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 154 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -60334,7 +60709,7 @@ var ts; } } if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) { - if (ts.getDeclarationOfKind(symbol, 197)) { + if (ts.getDeclarationOfKind(symbol, 198)) { pushTypePart(ts.ScriptElementKind.localClassElement); } else { @@ -60353,7 +60728,7 @@ var ts; } if (symbolFlags & 524288) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(136)); + displayParts.push(ts.keywordPart(137)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -60374,7 +60749,7 @@ var ts; } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 231); + var declaration = ts.getDeclarationOfKind(symbol, 232); var isNamespace = declaration && declaration.name && declaration.name.kind === 70; displayParts.push(ts.keywordPart(isNamespace ? 128 : 127)); displayParts.push(ts.spacePart()); @@ -60393,25 +60768,25 @@ var ts; writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - var declaration = ts.getDeclarationOfKind(symbol, 143); + var declaration = ts.getDeclarationOfKind(symbol, 144); ts.Debug.assert(declaration !== undefined); declaration = declaration.parent; if (declaration) { if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 154) { + if (declaration.kind === 155) { displayParts.push(ts.keywordPart(93)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 153 && declaration.name) { + else if (declaration.kind !== 154 && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); } - else if (declaration.kind === 229) { + else if (declaration.kind === 230) { addInPrefix(); - displayParts.push(ts.keywordPart(136)); + displayParts.push(ts.keywordPart(137)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -60422,7 +60797,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 261) { + if (declaration.kind === 262) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -60434,7 +60809,7 @@ var ts; } if (symbolFlags & 8388608) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 234) { + if (symbol.declarations[0].kind === 235) { displayParts.push(ts.keywordPart(83)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128)); @@ -60445,7 +60820,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 235) { + if (declaration.kind === 236) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -60513,10 +60888,10 @@ var ts; if (!documentation) { documentation = symbol.getDocumentationComment(); if (documentation.length === 0 && symbol.flags & 4) { - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 262; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 263; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 192) { + if (!declaration.parent || declaration.parent.kind !== 193) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -60596,14 +60971,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 184) { + if (declaration.kind === 185) { return true; } - if (declaration.kind !== 224 && declaration.kind !== 226) { + if (declaration.kind !== 225 && declaration.kind !== 227) { return false; } - for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { - if (parent_21.kind === 262 || parent_21.kind === 232) { + for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { + if (parent.kind === 263 || parent.kind === 233) { return false; } } @@ -60638,7 +61013,7 @@ var ts; sourceFile.moduleName = transpileOptions.moduleName; } if (transpileOptions.renamedDependencies) { - sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies); + sourceFile.renamedDependencies = ts.createMapFromTemplate(transpileOptions.renamedDependencies); } var newLine = ts.getNewLineCharacter(options); var outputText; @@ -60684,10 +61059,10 @@ var ts; var commandLineOptionsStringToEnum; function fixupCompilerOptions(options, diagnostics) { commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { - return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); + return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_3 = function (opt) { + var _loop_5 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -60696,14 +61071,14 @@ var ts; options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics); } else { - if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) { + if (!ts.forEachEntry(opt.type, function (v) { return v === value; })) { diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt)); } } }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_3(opt); + _loop_5(opt); } return options; } @@ -60794,10 +61169,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { + case 252: + case 250: case 251: case 249: - case 250: - case 248: return node.kind === 70; } } @@ -61130,7 +61505,7 @@ var ts; this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromRange(0, 140, [19])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromRange(0, 141, [19])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17, 81), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17, 105), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); @@ -61173,14 +61548,14 @@ var ts; this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([19, 80, 81, 72]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNotForContext), 2)); this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101, 86]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 133]), 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 134]), 70), 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.IsNonJsxSameLineTokenContext, 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.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127, 131]), 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 130, 133, 114, 136, 138, 126]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 138])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 130, 134, 114, 137, 139, 126]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 139])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(35, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); @@ -61194,7 +61569,7 @@ var ts; this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8)); this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116, 70, 83, 78, 74, 114, 113, 111, 112, 124, 133, 20, 38])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116, 70, 83, 78, 74, 114, 113, 111, 112, 124, 134, 20, 38])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38, formatting.Shared.TokenRange.FromTokens([70, 18])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); @@ -61300,44 +61675,44 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_50 in o) { - if (o[name_50] === rule) { - return name_50; + for (var name in o) { + if (o[name] === rule) { + return name; } } throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 212; + return context.contextNode.kind === 213; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 192: case 193: - case 200: - case 244: - case 240: - case 156: - case 164: + case 194: + case 201: + case 245: + case 241: + case 157: case 165: + case 166: return true; - case 174: - case 229: - case 235: - case 224: - case 144: - case 261: + case 175: + case 230: + case 236: + case 225: + case 145: + case 262: + case 148: case 147: - case 146: return context.currentTokenSpan.kind === 57 || context.nextTokenSpan.kind === 57; - case 213: - case 143: - return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91; case 214: - return context.currentTokenSpan.kind === 140 || context.nextTokenSpan.kind === 140; + case 144: + return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91; + case 215: + return context.currentTokenSpan.kind === 141 || context.nextTokenSpan.kind === 141; } return false; }; @@ -61345,13 +61720,13 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 193; + return context.contextNode.kind === 194; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; Rules.IsBraceWrappedContext = function (context) { - return context.contextNode.kind === 172 || Rules.IsSingleLineBlockContext(context); + return context.contextNode.kind === 173 || Rules.IsSingleLineBlockContext(context); }; Rules.IsBeforeMultilineBlockContext = function (context) { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); @@ -61373,65 +61748,65 @@ var ts; return true; } switch (node.kind) { - case 205: + case 206: + case 234: + case 177: case 233: - case 176: - case 232: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 226: + case 227: + case 150: case 149: - case 148: - case 151: case 152: case 153: - case 184: - case 150: + case 154: case 185: - case 228: + case 151: + case 186: + case 229: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 226 || context.contextNode.kind === 184; + return context.contextNode.kind === 227 || context.contextNode.kind === 185; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 227: - case 197: case 228: - case 230: - case 161: + case 198: + case 229: case 231: - case 242: + case 162: + case 232: case 243: - case 236: - case 239: + case 244: + case 237: + case 240: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 227: - case 231: - case 230: - case 257: + case 228: case 232: - case 219: + case 231: + case 258: + case 233: + case 220: return true; - case 205: { + case 206: { var blockParent = context.currentTokenParent.parent; - if (blockParent.kind !== 185 && - blockParent.kind !== 184) { + if (blockParent.kind !== 186 && + blockParent.kind !== 185) { return true; } } @@ -61440,29 +61815,29 @@ var ts; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 209: - case 219: - case 212: + case 210: + case 220: case 213: case 214: + case 215: + case 212: + case 223: case 211: - case 222: - case 210: - case 218: - case 257: + case 219: + case 258: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 176; + return context.contextNode.kind === 177; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 179; + return context.contextNode.kind === 180; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 180; + return context.contextNode.kind === 181; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -61474,25 +61849,25 @@ var ts; return context.nextTokenSpan.kind !== 21; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 185; + return context.contextNode.kind === 186; }; Rules.IsNonJsxSameLineTokenContext = function (context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 247; + return context.contextNode.kind !== 248; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 253; + return context.contextNode.kind === 254; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 251; + return context.nextTokenParent.kind === 252; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 251; + return context.contextNode.kind === 252; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 248; + return context.contextNode.kind === 249; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -61507,42 +61882,42 @@ var ts; while (ts.isPartOfExpression(node)) { node = node.parent; } - return node.kind === 145; + return node.kind === 146; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 225 && + return context.currentTokenParent.kind === 226 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 231; + return context.contextNode.kind === 232; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 161; + return context.contextNode.kind === 162; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 26 && token.kind !== 28) { return false; } switch (parent.kind) { - case 157: - case 182: + case 158: + case 183: + case 230: + case 228: + case 198: case 229: case 227: - case 197: - case 228: - case 226: - case 184: case 185: + case 186: + case 150: case 149: - case 148: - case 153: case 154: - case 179: + case 155: case 180: - case 199: + case 181: + case 200: return true; default: return false; @@ -61553,16 +61928,16 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 182; + return context.contextNode.kind === 183; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 104 && context.currentTokenParent.kind === 188; + return context.currentTokenSpan.kind === 104 && context.currentTokenParent.kind === 189; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 195 && context.contextNode.expression !== undefined; + return context.contextNode.kind === 196 && context.contextNode.expression !== undefined; }; Rules.IsNonNullAssertionContext = function (context) { - return context.contextNode.kind === 201; + return context.contextNode.kind === 202; }; return Rules; }()); @@ -61584,7 +61959,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 140 + 1; + this.mapRowLength = 141 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -61597,7 +61972,7 @@ var ts; }); }; RulesMap.prototype.GetRuleBucketIndex = function (row, column) { - ts.Debug.assert(row <= 140 && column <= 140, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 141 && column <= 141, "Must compute formatting context from tokens"); var rulesBucketIndex = (row * this.mapRowLength) + column; return rulesBucketIndex; }; @@ -61761,7 +62136,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 140; token++) { + for (var token = 0; token <= 141; token++) { result.push(token); } return result; @@ -61805,9 +62180,9 @@ var ts; }()); TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(71, 140); + TokenRange.Keywords = TokenRange.FromRange(71, 141); TokenRange.BinaryOperators = TokenRange.FromRange(26, 69); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91, 92, 140, 117, 125]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91, 92, 141, 117, 125]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42, 43, 51, 50]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 70, 18, 20, 16, 98, 93]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]); @@ -61815,7 +62190,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70, 19, 21, 93]); TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([70, 132, 134, 121, 135, 104, 118]); + TokenRange.TypeNames = TokenRange.FromTokens([70, 132, 135, 121, 136, 104, 118]); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -62035,17 +62410,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 227: case 228: + case 229: return ts.rangeContainsRange(parent.members, node); - case 231: - var body = parent.body; - return body && body.kind === 232 && ts.rangeContainsRange(body.statements, node); - case 262: - case 205: case 232: + var body = parent.body; + return body && body.kind === 233 && ts.rangeContainsRange(body.statements, node); + case 263: + case 206: + case 233: return ts.rangeContainsRange(parent.statements, node); - case 257: + case 258: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -62201,18 +62576,18 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 227: return 74; - case 228: return 108; - case 226: return 88; - case 230: return 230; - case 151: return 124; - case 152: return 133; - case 149: + case 228: return 74; + case 229: return 108; + case 227: return 88; + case 231: return 231; + case 152: return 124; + case 153: return 134; + case 150: if (node.asteriskToken) { return 38; } - case 147: - case 144: + case 148: + case 145: return node.name.kind; } } @@ -62244,16 +62619,16 @@ var ts; return indentation; case 40: case 28: { - if (container.kind === 249 || - container.kind === 250 || - container.kind === 248) { + if (container.kind === 250 || + container.kind === 251 || + container.kind === 249) { return indentation; } break; } case 20: case 21: { - if (container.kind !== 170) { + if (container.kind !== 171) { return indentation; } break; @@ -62341,11 +62716,11 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 145 ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 146 ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 175 && inheritedIndentation === -1) { + if (isFirstListItem && parent.kind === 176 && inheritedIndentation === -1) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -62661,12 +63036,12 @@ var ts; } function getOpenTokenForList(node, list) { switch (node.kind) { + case 151: + case 227: + case 185: case 150: - case 226: - case 184: case 149: - case 148: - case 185: + case 186: if (node.typeParameters === list) { return 26; } @@ -62674,8 +63049,8 @@ var ts; return 18; } break; - case 179: case 180: + case 181: if (node.typeArguments === list) { return 26; } @@ -62683,7 +63058,7 @@ var ts; return 18; } break; - case 157: + case 158: if (node.typeArguments === list) { return 26; } @@ -62784,7 +63159,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 25 && precedingToken.parent.kind !== 192) { + if (precedingToken.kind === 25 && precedingToken.parent.kind !== 193) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -62886,7 +63261,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 262 || !parentAndChildShareLine); + (parent.kind === 263 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -62910,7 +63285,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 209 && parent.elseStatement === child) { + if (parent.kind === 210 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -62922,23 +63297,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 157: + case 158: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 176: + case 177: return node.parent.properties; - case 175: + case 176: return node.parent.elements; - case 226: - case 184: + case 227: case 185: + case 186: + case 150: case 149: - case 148: - case 153: - case 154: { + case 154: + case 155: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -62949,8 +63324,8 @@ var ts; } break; } - case 180: - case 179: { + case 181: + case 180: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -62978,8 +63353,8 @@ var ts; if (node.kind === 19) { return -1; } - if (node.parent && (node.parent.kind === 179 || - node.parent.kind === 180) && + if (node.parent && (node.parent.kind === 180 || + node.parent.kind === 181) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -62997,10 +63372,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 179: case 180: - case 177: + case 181: case 178: + case 179: node = node.expression; break; default: @@ -63054,49 +63429,49 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 208: - case 227: - case 197: + case 209: case 228: - case 230: + case 198: case 229: - case 175: - case 205: - case 232: + case 231: + case 230: case 176: - case 161: - case 170: - case 163: + case 206: case 233: - case 255: - case 254: - case 183: case 177: - case 179: + case 162: + case 171: + case 164: + case 234: + case 256: + case 255: + case 184: + case 178: case 180: - case 206: - case 224: - case 241: - case 217: - case 193: + case 181: + case 207: + case 225: + case 242: + case 218: + case 194: + case 174: case 173: - case 172: + case 250: case 249: - case 248: - case 253: - case 148: - case 153: + case 254: + case 149: case 154: - case 144: - case 158: + case 155: + case 145: case 159: - case 166: - case 181: - case 189: - case 243: - case 239: + case 160: + case 167: + case 182: + case 190: case 244: case 240: + case 245: + case 241: return true; } return false; @@ -63104,27 +63479,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0; switch (parent.kind) { - case 210: case 211: - case 213: - case 214: case 212: - case 209: - case 226: - case 184: - case 149: + case 214: + case 215: + case 213: + case 210: + case 227: case 185: case 150: + case 186: case 151: case 152: - return childKind !== 205; - case 242: - return childKind !== 243; - case 236: - return childKind !== 237 || - (child.namedBindings && child.namedBindings.kind !== 239); - case 247: - return childKind !== 250; + case 153: + return childKind !== 206; + case 243: + return childKind !== 244; + case 237: + return childKind !== 238 || + (child.namedBindings && child.namedBindings.kind !== 240); + case 248: + return childKind !== 251; } return indentByDefault; } @@ -63140,7 +63515,7 @@ var ts; (function (ts) { var codefix; (function (codefix) { - var codeFixes = ts.createMap(); + var codeFixes = []; function registerCodeFix(action) { ts.forEach(action.errorCodes, function (error) { var fixes = codeFixes[error]; @@ -63213,9 +63588,9 @@ var ts; if (IndexInfoOfKind) { var writer = ts.getSingleLineStringWriter(); checker.getSymbolDisplayBuilder().buildIndexSignatureDisplay(IndexInfoOfKind, writer, kind, enclosingDeclaration); - var result_7 = writer.string(); + var result_6 = writer.string(); ts.releaseStringWriter(writer); - return result_7; + return result_6; } } return ""; @@ -63301,7 +63676,7 @@ var ts; if (!superCall) { return undefined; } - if (superCall.expression && superCall.expression.kind == 179) { + if (superCall.expression && superCall.expression.kind == 180) { var arguments_1 = superCall.expression.arguments; for (var i = 0; i < arguments_1.length; i++) { if (arguments_1[i].expression === token) { @@ -63325,7 +63700,7 @@ var ts; changes: changes }]; function findSuperCall(n) { - if (n.kind === 208 && ts.isSuperCall(n.expression)) { + if (n.kind === 209 && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -63404,6 +63779,24 @@ var ts; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + var start = token.getStart(sourceFile); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_this_to_unresolved_variable), + changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "this.", span: { start: start, length: 0 } }] }] + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var codefix; (function (codefix) { @@ -63422,9 +63815,9 @@ var ts; switch (token.kind) { case 70: switch (token.parent.kind) { - case 224: + case 225: switch (token.parent.parent.parent.kind) { - case 212: + case 213: var forStatement = token.parent.parent.parent; var forInitializer = forStatement.initializer; if (forInitializer.declarations.length === 1) { @@ -63433,16 +63826,16 @@ var ts; else { return removeSingleItem(forInitializer.declarations, token); } - case 214: + case 215: var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 225) { + if (forOfStatement.initializer.kind === 226) { var forOfInitializer = forOfStatement.initializer; return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); } break; - case 213: + case 214: return undefined; - case 257: + case 258: var catchClause = token.parent.parent; var parameter = catchClause.variableDeclaration.getChildren()[0]; return createCodeFix("", parameter.pos, parameter.end - parameter.pos); @@ -63456,7 +63849,7 @@ var ts; return removeSingleItem(declarations, token); } } - case 143: + case 144: var typeParameters = token.parent.parent.typeParameters; if (typeParameters.length === 1) { return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); @@ -63464,7 +63857,7 @@ var ts; else { return removeSingleItem(typeParameters, token); } - case 144: + case 145: var functionDeclaration = token.parent.parent; if (functionDeclaration.parameters.length === 1) { return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); @@ -63472,10 +63865,10 @@ var ts; else { return removeSingleItem(functionDeclaration.parameters, token); } - case 235: + case 236: var importEquals = findImportDeclaration(token); return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 240: + case 241: var namedImports = token.parent.parent; if (namedImports.elements.length === 1) { var importSpec = findImportDeclaration(token); @@ -63484,7 +63877,7 @@ var ts; else { return removeSingleItem(namedImports.elements, token); } - case 237: + case 238: var importClause = token.parent; if (!importClause.namedBindings) { var importDecl = findImportDeclaration(importClause); @@ -63493,7 +63886,7 @@ var ts; else { return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); } - case 238: + case 239: var namespaceImport = token.parent; if (namespaceImport.name == token && !namespaceImport.parent.name) { var importDecl = findImportDeclaration(namespaceImport); @@ -63505,9 +63898,9 @@ var ts; } } break; - case 147: + case 148: return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 238: + case 239: return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); } if (ts.isDeclarationName(token)) { @@ -63521,14 +63914,14 @@ var ts; } function findImportDeclaration(token) { var importDecl = token; - while (importDecl.kind != 236 && importDecl.parent) { + while (importDecl.kind != 237 && importDecl.parent) { importDecl = importDecl.parent; } return importDecl; } function createCodeFix(newText, start, length) { return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_declaration_for_Colon_0), { 0: token.getText() }), changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: newText, span: { start: start, length: length } }] @@ -63559,18 +63952,19 @@ var ts; })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); var ImportCodeActionMap = (function () { function ImportCodeActionMap() { - this.symbolIdToActionMap = ts.createMap(); + this.symbolIdToActionMap = []; } ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { if (!newAction) { return; } - if (!this.symbolIdToActionMap[symbolId]) { + var actions = this.symbolIdToActionMap[symbolId]; + if (!actions) { this.symbolIdToActionMap[symbolId] = [newAction]; return; } if (newAction.kind === "CodeChange") { - this.symbolIdToActionMap[symbolId].push(newAction); + actions.push(newAction); return; } var updatedNewImports = []; @@ -63603,8 +63997,8 @@ var ts; }; ImportCodeActionMap.prototype.getAllActions = function () { var result = []; - for (var symbolId in this.symbolIdToActionMap) { - result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + for (var key in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[key]); } return result; }; @@ -63645,7 +64039,7 @@ var ts; var token = ts.getTokenAtPosition(sourceFile, context.span.start); var name = token.getText(); var symbolIdActionMap = new ImportCodeActionMap(); - var cachedImportDeclarations = ts.createMap(); + var cachedImportDeclarations = []; var cachedNewImportInsertPosition; var currentTokenMeaning = ts.getMeaningFromLocation(token); if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -63679,8 +64073,9 @@ var ts; return symbolIdActionMap.getAllActions(); function getImportDeclarations(moduleSymbol) { var moduleSymbolId = getUniqueSymbolId(moduleSymbol); - if (cachedImportDeclarations[moduleSymbolId]) { - return cachedImportDeclarations[moduleSymbolId]; + var cached = cachedImportDeclarations[moduleSymbolId]; + if (cached) { + return cached; } var existingDeclarations = []; for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { @@ -63695,10 +64090,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 236) { + if (node.kind === 237) { return node; } - if (node.kind === 235) { + if (node.kind === 236) { return node; } node = node.parent; @@ -63731,9 +64126,9 @@ var ts; var existingModuleSpecifier; for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { var declaration = declarations_11[_i]; - if (declaration.kind === 236) { + if (declaration.kind === 237) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 238) { + if (namedBindings && namedBindings.kind === 239) { namespaceImportDeclaration = declaration; } else { @@ -63760,7 +64155,7 @@ var ts; } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 246) { + if (declaration.moduleReference && declaration.moduleReference.kind === 247) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); @@ -63793,7 +64188,7 @@ var ts; } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 236) { + if (declaration.kind === 237) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { @@ -63832,13 +64227,13 @@ var ts; var sourceDirectory = ts.getDirectoryPath(fileName); var options = context.program.getCompilerOptions(); return tryGetModuleNameFromAmbientModule() || - tryGetModuleNameFromBaseUrl() || - tryGetModuleNameFromRootDirs() || tryGetModuleNameFromTypeRoots() || tryGetModuleNameAsNodeModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 262) { + if (moduleSymbol.valueDeclaration.kind !== 263) { return moduleSymbol.name; } } @@ -63992,7 +64387,7 @@ var ts; (function (codefix) { function getMissingMembersInsertion(classDeclaration, possiblyMissingSymbols, checker, newlineChar) { var classMembers = classDeclaration.symbol.members; - var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !(symbol.getName() in classMembers); }); + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !classMembers.has(symbol.getName()); }); var insertion = ""; for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { var symbol = missingMembers_1[_i]; @@ -64011,14 +64406,14 @@ var ts; var name = declaration.name ? declaration.name.getText() : undefined; var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration)); switch (declaration.kind) { - case 151: case 152: - case 146: + case 153: case 147: + case 148: var typeString = checker.typeToString(type, enclosingDeclaration, 0); return "" + visibility + name + ": " + typeString + ";" + newlineChar; - case 148: case 149: + case 150: var signatures = checker.getSignaturesOfType(type, 0); if (!(signatures && signatures.length > 0)) { return ""; @@ -64049,7 +64444,7 @@ var ts; } } function createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker) { - var newSignatureDeclaration = ts.createNode(153); + var newSignatureDeclaration = ts.createNode(154); newSignatureDeclaration.parent = enclosingDeclaration; newSignatureDeclaration.name = signatures[0].getDeclaration().name; var maxNonRestArgs = -1; @@ -64080,7 +64475,7 @@ var ts; } return checker.getSignatureFromDeclaration(newSignatureDeclaration); function createParameterDeclarationWithoutType(index, minArgCount, enclosingSignatureDeclaration) { - var newParameter = ts.createNode(144); + var newParameter = ts.createNode(145); newParameter.symbol = new SymbolConstructor(1, maxArgsParameterSymbolNames[index] || "rest"); newParameter.symbol.valueDeclaration = newParameter; newParameter.symbol.declarations = [newParameter]; @@ -64110,7 +64505,7 @@ var ts; (function (ts) { ts.servicesVersion = "0.5"; function createNode(kind, pos, end, parent) { - var node = kind >= 141 ? new NodeObject(kind, pos, end) : + var node = kind >= 142 ? new NodeObject(kind, pos, end) : kind === 70 ? new IdentifierObject(70, pos, end) : new TokenObject(kind, pos, end); node.parent = parent; @@ -64168,7 +64563,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(293, nodes.pos, nodes.end, this); + var list = createNode(294, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -64187,11 +64582,11 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 141) { + if (this.kind >= 142) { ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 279 && this.kind <= 292; + var useJSDocScanner_1 = this.kind >= 280 && this.kind <= 293; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -64244,8 +64639,10 @@ var ts; if (!children.length) { return undefined; } - var child = children[0]; - return child.kind < 141 ? child : child.getFirstToken(sourceFile); + var child = ts.find(children, function (kid) { return kid.kind < 264 || kid.kind > 293; }); + return child.kind < 142 ? + child : + child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -64253,7 +64650,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 141 ? child : child.getLastToken(sourceFile); + return child.kind < 142 ? child : child.getLastToken(sourceFile); }; return NodeObject; }()); @@ -64450,27 +64847,31 @@ var ts; return this.namedDeclarations; }; SourceFileObject.prototype.computeNamedDeclarations = function () { - var result = ts.createMap(); + var result = ts.createMultiMap(); ts.forEachChild(this, visit); return result; function addDeclaration(declaration) { var name = getDeclarationName(declaration); if (name) { - ts.multiMapAdd(result, name, declaration); + result.add(name, declaration); } } function getDeclarations(name) { - return result[name] || (result[name] = []); + var declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; } function getDeclarationName(declaration) { if (declaration.name) { - var result_8 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_8 !== undefined) { - return result_8; + var result_7 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_7 !== undefined) { + return result_7; } - if (declaration.name.kind === 142) { + if (declaration.name.kind === 143) { var expr = declaration.name.expression; - if (expr.kind === 177) { + if (expr.kind === 178) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -64490,10 +64891,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 226: - case 184: + case 227: + case 185: + case 150: case 149: - case 148: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -64510,30 +64911,30 @@ var ts; } ts.forEachChild(node, visit); break; - case 227: - case 197: case 228: + case 198: case 229: case 230: case 231: - case 235: - case 244: - case 240: - case 235: - case 237: + case 232: + case 236: + case 245: + case 241: + case 236: case 238: - case 151: + case 239: case 152: - case 161: + case 153: + case 162: addDeclaration(node); ts.forEachChild(node, visit); break; - case 144: + case 145: if (!ts.hasModifier(node, 92)) { break; } - case 224: - case 174: { + case 225: + case 175: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -64542,24 +64943,24 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 261: + case 262: + case 148: case 147: - case 146: addDeclaration(node); break; - case 242: + case 243: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 236: + case 237: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 238) { + if (importClause.namedBindings.kind === 239) { addDeclaration(importClause.namedBindings); } else { @@ -65002,10 +65403,10 @@ var ts; if (!symbol || typeChecker.isUnknownSymbol(symbol)) { switch (node.kind) { case 70: - case 177: - case 141: + case 178: + case 142: case 98: - case 167: + case 168: case 96: var type = typeChecker.getTypeAtLocation(node); if (type) { @@ -65044,8 +65445,8 @@ var ts; function getOccurrencesAtPosition(fileName, position) { var results = getOccurrencesAtPositionCore(fileName, position); if (results) { - var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); - results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; }); + var sourceFile_1 = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_1; }); } return results; } @@ -65079,20 +65480,20 @@ var ts; } } function findRenameLocations(fileName, position, findInStrings, findInComments) { - var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments); + var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments, true); return ts.FindAllReferences.convertReferences(referencedSymbols); } function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); + var referencedSymbols = findReferencedSymbols(fileName, position, false, false, false); return ts.FindAllReferences.convertReferences(referencedSymbols); } function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); + var referencedSymbols = findReferencedSymbols(fileName, position, false, false, false); return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); } - function findReferencedSymbols(fileName, position, findInStrings, findInComments) { + function findReferencedSymbols(fileName, position, findInStrings, findInComments, isForRename) { synchronizeHostData(); - return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments); + return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments, isForRename); } function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { synchronizeHostData(); @@ -65134,15 +65535,15 @@ var ts; return; } switch (node.kind) { - case 177: - case 141: + case 178: + case 142: case 9: case 85: case 100: case 94: case 96: case 98: - case 167: + case 168: case 70: break; default: @@ -65154,7 +65555,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 231 && + if (nodeForStartPos.parent.parent.kind === 232 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -65447,15 +65848,15 @@ var ts; function walk(node) { switch (node.kind) { case 70: - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); break; case 9: case 8: if (ts.isDeclarationName(node) || - node.parent.kind === 246 || + node.parent.kind === 247 || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); } break; default: @@ -65468,11 +65869,14 @@ var ts; } } } + function setNameTable(text, node) { + nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); + } } function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 178 && + node.parent.kind === 179 && node.parent.argumentExpression === node; } function getDefaultLibFilePath(options) { @@ -65595,14 +65999,14 @@ var ts; }; } server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings; - function mergeMaps(target, source) { + function mergeMapLikes(target, source) { for (var key in source) { if (ts.hasProperty(source, key)) { target[key] = source[key]; } } } - server.mergeMaps = mergeMaps; + server.mergeMapLikes = mergeMapLikes; function removeItemFromSet(items, itemToRemove) { if (items.length === 0) { return; @@ -65633,19 +66037,19 @@ var ts; } server.asNormalizedPath = asNormalizedPath; function createNormalizedPathMap() { - var map = Object.create(null); + var map = ts.createMap(); return { get: function (path) { - return map[path]; + return map.get(path); }, set: function (path, value) { - map[path] = value; + map.set(path, value); }, contains: function (path) { - return ts.hasProperty(map, path); + return map.has(path); }, remove: function (path) { - delete map[path]; + map.delete(path); } }; } @@ -65669,13 +66073,14 @@ var ts; this.pendingTimeouts = ts.createMap(); } ThrottledOperations.prototype.schedule = function (operationId, delay, cb) { - if (ts.hasProperty(this.pendingTimeouts, operationId)) { - this.host.clearTimeout(this.pendingTimeouts[operationId]); + var pendingTimeout = this.pendingTimeouts.get(operationId); + if (pendingTimeout) { + this.host.clearTimeout(pendingTimeout); } - this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb); + this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb)); }; ThrottledOperations.run = function (self, operationId, cb) { - delete self.pendingTimeouts[operationId]; + self.pendingTimeouts.delete(operationId); cb(); }; return ThrottledOperations; @@ -66777,7 +67182,7 @@ var ts; if (!this.formatCodeSettings) { this.formatCodeSettings = server.getDefaultFormatCodeSettings(this.host); } - server.mergeMaps(this.formatCodeSettings, formatSettings); + server.mergeMapLikes(this.formatCodeSettings, formatSettings); } }; ScriptInfo.prototype.setWatcher = function (watcher) { @@ -66832,6 +67237,9 @@ var ts; ScriptInfo.prototype.positionToLineOffset = function (position) { return this.textStorage.positionToLineOffset(position); }; + ScriptInfo.prototype.isJavaScript = function () { + return this.scriptKind === 1 || this.scriptKind === 2; + }; return ScriptInfo; }()); server.ScriptInfo = ScriptInfo; @@ -66886,15 +67294,16 @@ var ts; var compilerOptions = this.getCompilationSettings(); var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName; for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { - var name_51 = names_2[_i]; - var resolution = newResolutions[name_51]; + var name = names_2[_i]; + var resolution = newResolutions.get(name); if (!resolution) { - var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_51]; + var existingResolution = currentResolutionsInFile && currentResolutionsInFile.get(name); if (moduleResolutionIsValid(existingResolution)) { resolution = existingResolution; } else { - newResolutions[name_51] = resolution = loader(name_51, containingFile, compilerOptions, this); + resolution = loader(name, containingFile, compilerOptions, this); + newResolutions.set(name, resolution); } if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) { this.filesWithChangedSetOfUnresolvedImports.push(path); @@ -67042,18 +67451,19 @@ var ts; var unique = 0; for (var _i = 0, arr1_1 = arr1; _i < arr1_1.length; _i++) { var v = arr1_1[_i]; - if (set[v] !== true) { - set[v] = true; + if (set.get(v) !== true) { + set.set(v, true); unique++; } } for (var _a = 0, arr2_1 = arr2; _a < arr2_1.length; _a++) { var v = arr2_1[_a]; - if (!ts.hasProperty(set, v)) { + var isSet = set.get(v); + if (isSet === undefined) { return false; } - if (set[v] === true) { - set[v] = false; + if (isSet === true) { + set.set(v, false); unique--; } } @@ -67083,38 +67493,38 @@ var ts; if (!typeAcquisition || !typeAcquisition.enable) { return server.emptyArray; } - var entry = this.perProjectCache[project.getProjectName()]; + var entry = this.perProjectCache.get(project.getProjectName()); var result = entry ? entry.typings : server.emptyArray; if (forceRefresh || !entry || typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions) || unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) { - this.perProjectCache[project.getProjectName()] = { + this.perProjectCache.set(project.getProjectName(), { compilerOptions: project.getCompilerOptions(), typeAcquisition: typeAcquisition, typings: result, unresolvedImports: unresolvedImports, poisoned: true - }; + }); this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); } return result; }; TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) { - this.perProjectCache[projectName] = { + this.perProjectCache.set(projectName, { compilerOptions: compilerOptions, typeAcquisition: typeAcquisition, typings: server.toSortedReadonlyArray(newTypings), unresolvedImports: unresolvedImports, poisoned: false - }; + }); }; TypingsCache.prototype.deleteTypingsForProject = function (projectName) { - delete this.perProjectCache[projectName]; + this.perProjectCache.delete(projectName); }; TypingsCache.prototype.onProjectClosed = function (project) { - delete this.perProjectCache[project.getProjectName()]; + this.perProjectCache.delete(project.getProjectName()); this.installer.onProjectClosed(project); }; return TypingsCache; @@ -67429,7 +67839,9 @@ var ts; }; Project.prototype.removeFile = function (info, detachFromProject) { if (detachFromProject === void 0) { detachFromProject = true; } - this.removeRootFileIfNecessary(info); + if (this.isRoot(info)) { + this.removeRoot(info); + } this.lsHost.notifyFileRemoved(info); this.cachedUnresolvedImportsPerFile.remove(info.path); if (detachFromProject) { @@ -67438,7 +67850,7 @@ var ts; this.markAsDirty(); }; Project.prototype.registerFileUpdate = function (fileName) { - (this.updatedFileNames || (this.updatedFileNames = ts.createMap()))[fileName] = fileName; + (this.updatedFileNames || (this.updatedFileNames = ts.createMap())).set(fileName, fileName); }; Project.prototype.markAsDirty = function () { this.projectStateVersion++; @@ -67446,17 +67858,17 @@ var ts; Project.prototype.extractUnresolvedImportsFromSourceFile = function (file, result) { var cached = this.cachedUnresolvedImportsPerFile.get(file.path); if (cached) { - for (var _i = 0, cached_1 = cached; _i < cached_1.length; _i++) { - var f = cached_1[_i]; + for (var _i = 0, cached_2 = cached; _i < cached_2.length; _i++) { + var f = cached_2[_i]; result.push(f); } return; } var unresolvedImports; if (file.resolvedModules) { - for (var name_52 in file.resolvedModules) { - if (!file.resolvedModules[name_52] && !ts.isExternalModuleNameRelative(name_52)) { - var trimmed = name_52.trim(); + file.resolvedModules.forEach(function (resolvedModule, name) { + if (!resolvedModule && !ts.isExternalModuleNameRelative(name)) { + var trimmed = name.trim(); var i = trimmed.indexOf("/"); if (i !== -1 && trimmed.charCodeAt(0) === 64) { i = trimmed.indexOf("/", i + 1); @@ -67467,7 +67879,7 @@ var ts; (unresolvedImports || (unresolvedImports = [])).push(trimmed); result.push(trimmed); } - } + }); } this.cachedUnresolvedImportsPerFile.set(file.path, unresolvedImports || server.emptyArray); }; @@ -67563,9 +67975,6 @@ var ts; }; Project.prototype.setCompilerOptions = function (compilerOptions) { if (compilerOptions) { - if (this.projectKind === ProjectKind.Inferred) { - compilerOptions.allowJs = true; - } compilerOptions.allowNonTsExtensions = true; if (ts.changesAffectModuleResolution(this.compilerOptions, compilerOptions)) { this.cachedUnresolvedImportsPerFile.clear(); @@ -67601,24 +68010,24 @@ var ts; if (this.projectStructureVersion == this.lastReportedVersion && !updatedFileNames) { return { info: info, projectErrors: this.projectErrors }; } - var lastReportedFileNames = this.lastReportedFileNames; - var currentFiles = ts.arrayToMap(this.getFileNames(), function (x) { return x; }); - var added = []; - var removed = []; - var updated = ts.getOwnKeys(updatedFileNames); - for (var id in currentFiles) { - if (!ts.hasProperty(lastReportedFileNames, id)) { - added.push(id); + var lastReportedFileNames_1 = this.lastReportedFileNames; + var currentFiles_1 = ts.arrayToMap(this.getFileNames(), function (x) { return x; }); + var added_1 = []; + var removed_1 = []; + var updated = ts.arrayFrom(updatedFileNames.keys()); + ts.forEachKey(currentFiles_1, function (id) { + if (!lastReportedFileNames_1.has(id)) { + added_1.push(id); } - } - for (var id in lastReportedFileNames) { - if (!ts.hasProperty(currentFiles, id)) { - removed.push(id); + }); + ts.forEachKey(lastReportedFileNames_1, function (id) { + if (!currentFiles_1.has(id)) { + removed_1.push(id); } - } - this.lastReportedFileNames = currentFiles; + }); + this.lastReportedFileNames = currentFiles_1; this.lastReportedVersion = this.projectStructureVersion; - return { info: info, changes: { added: added, removed: removed, updated: updated }, projectErrors: this.projectErrors }; + return { info: info, changes: { added: added_1, removed: removed_1, updated: updated }, projectErrors: this.projectErrors }; } else { var projectFileNames = this.getFileNames(); @@ -67645,7 +68054,7 @@ var ts; if (symbol && symbol.declarations && symbol.declarations[0]) { var declarationSourceFile = symbol.declarations[0].getSourceFile(); if (declarationSourceFile) { - referencedFiles[declarationSourceFile.path] = true; + referencedFiles.set(declarationSourceFile.path, true); } } } @@ -67656,28 +68065,25 @@ var ts; for (var _b = 0, _c = sourceFile.referencedFiles; _b < _c.length; _b++) { var referencedFile = _c[_b]; var referencedPath = ts.toPath(referencedFile.fileName, currentDirectory, getCanonicalFileName); - referencedFiles[referencedPath] = true; + referencedFiles.set(referencedPath, true); } } if (sourceFile.resolvedTypeReferenceDirectiveNames) { - for (var typeName in sourceFile.resolvedTypeReferenceDirectiveNames) { - var resolvedTypeReferenceDirective = sourceFile.resolvedTypeReferenceDirectiveNames[typeName]; + sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (resolvedTypeReferenceDirective) { if (!resolvedTypeReferenceDirective) { - continue; + return; } var fileName = resolvedTypeReferenceDirective.resolvedFileName; var typeFilePath = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - referencedFiles[typeFilePath] = true; - } + referencedFiles.set(typeFilePath, true); + }); } - var allFileNames = ts.map(Object.keys(referencedFiles), function (key) { return key; }); + var allFileNames = ts.arrayFrom(referencedFiles.keys()); return ts.filter(allFileNames, function (file) { return _this.projectService.host.fileExists(file); }); }; - Project.prototype.removeRootFileIfNecessary = function (info) { - if (this.isRoot(info)) { - remove(this.rootFiles, info); - this.rootFilesMap.remove(info.path); - } + Project.prototype.removeRoot = function (info) { + remove(this.rootFiles, info); + this.rootFilesMap.remove(info.path); }; return Project; }()); @@ -67686,9 +68092,44 @@ var ts; __extends(InferredProject, _super); function InferredProject(projectService, documentRegistry, compilerOptions) { var _this = _super.call(this, InferredProject.newName(), ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this; + _this._isJsInferredProject = false; _this.directoriesWatchedForTsconfig = []; return _this; } + InferredProject.prototype.toggleJsInferredProject = function (isJsInferredProject) { + if (isJsInferredProject !== this._isJsInferredProject) { + this._isJsInferredProject = isJsInferredProject; + this.setCompilerOptions(); + } + }; + InferredProject.prototype.setCompilerOptions = function (options) { + var newOptions = options ? ts.clone(options) : this.getCompilerOptions(); + if (!newOptions) { + return; + } + if (this._isJsInferredProject && typeof newOptions.maxNodeModuleJsDepth !== "number") { + newOptions.maxNodeModuleJsDepth = 2; + } + else if (!this._isJsInferredProject) { + newOptions.maxNodeModuleJsDepth = undefined; + } + newOptions.allowJs = true; + _super.prototype.setCompilerOptions.call(this, newOptions); + }; + InferredProject.prototype.addRoot = function (info) { + if (!this._isJsInferredProject && info.isJavaScript()) { + this.toggleJsInferredProject(true); + } + _super.prototype.addRoot.call(this, info); + }; + InferredProject.prototype.removeRoot = function (info) { + if (this._isJsInferredProject && info.isJavaScript()) { + if (ts.filter(this.getRootScriptInfos(), function (info) { return info.isJavaScript(); }).length === 0) { + this.toggleJsInferredProject(false); + } + } + _super.prototype.removeRoot.call(this, info); + }; InferredProject.prototype.getProjectRootPath = function () { if (this.projectService.useSingleInferredProject) { return undefined; @@ -67776,14 +68217,14 @@ var ts; return; } var configDirectoryPath = ts.getDirectoryPath(this.getConfigFilePath()); - this.directoriesWatchedForWildcards = ts.reduceProperties(this.wildcardDirectories, function (watchers, flag, directory) { + this.directoriesWatchedForWildcards = ts.createMap(); + this.wildcardDirectories.forEach(function (flag, directory) { if (ts.comparePaths(configDirectoryPath, directory, ".", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) { var recursive = (flag & 1) !== 0; _this.projectService.logger.info("Add " + (recursive ? "recursive " : "") + "watcher for: " + directory); - watchers[directory] = _this.projectService.host.watchDirectory(directory, function (path) { return callback(_this, path); }, recursive); + _this.directoriesWatchedForWildcards.set(directory, _this.projectService.host.watchDirectory(directory, function (path) { return callback(_this, path); }, recursive)); } - return watchers; - }, {}); + }); }; ConfiguredProject.prototype.stopWatchingDirectory = function () { if (this.directoryWatcher) { @@ -67803,9 +68244,9 @@ var ts; } this.typeRootsWatchers = undefined; } - for (var id in this.directoriesWatchedForWildcards) { - this.directoriesWatchedForWildcards[id].close(); - } + this.directoriesWatchedForWildcards.forEach(function (watcher) { + watcher.close(); + }); this.directoriesWatchedForWildcards = undefined; this.stopWatchingDirectory(); }; @@ -67882,36 +68323,35 @@ var ts; var option = commandLineOptions_1[_i]; if (typeof option.type === "object") { var optionMap = option.type; - for (var id in optionMap) { - ts.Debug.assert(typeof optionMap[id] === "number"); - } - map[option.name] = optionMap; + optionMap.forEach(function (value) { + ts.Debug.assert(typeof value === "number"); + }); + map.set(option.name, optionMap); } } return map; } var compilerOptionConverters = prepareConvertersForEnumLikeCompilerOptions(ts.optionDeclarations); - var indentStyle = ts.createMap({ + var indentStyle = ts.createMapFromTemplate({ "none": ts.IndentStyle.None, "block": ts.IndentStyle.Block, "smart": ts.IndentStyle.Smart }); function convertFormatOptions(protocolOptions) { if (typeof protocolOptions.indentStyle === "string") { - protocolOptions.indentStyle = indentStyle[protocolOptions.indentStyle.toLowerCase()]; + protocolOptions.indentStyle = indentStyle.get(protocolOptions.indentStyle.toLowerCase()); ts.Debug.assert(protocolOptions.indentStyle !== undefined); } return protocolOptions; } server.convertFormatOptions = convertFormatOptions; function convertCompilerOptions(protocolOptions) { - for (var id in compilerOptionConverters) { + compilerOptionConverters.forEach(function (mappedValues, id) { var propertyValue = protocolOptions[id]; if (typeof propertyValue === "string") { - var mappedValues = compilerOptionConverters[id]; - protocolOptions[id] = mappedValues[propertyValue.toLowerCase()]; + protocolOptions[id] = mappedValues.get(propertyValue.toLowerCase()); } - } + }); return protocolOptions; } server.convertCompilerOptions = convertCompilerOptions; @@ -67978,24 +68418,25 @@ var ts; this.directoryWatchersRefCount = ts.createMap(); } DirectoryWatchers.prototype.stopWatchingDirectory = function (directory) { - this.directoryWatchersRefCount[directory]--; - if (this.directoryWatchersRefCount[directory] === 0) { + var refCount = this.directoryWatchersRefCount.get(directory) - 1; + this.directoryWatchersRefCount.set(directory, refCount); + if (refCount === 0) { this.projectService.logger.info("Close directory watcher for: " + directory); - this.directoryWatchersForTsconfig[directory].close(); - delete this.directoryWatchersForTsconfig[directory]; + this.directoryWatchersForTsconfig.get(directory).close(); + this.directoryWatchersForTsconfig.delete(directory); } }; DirectoryWatchers.prototype.startWatchingContainingDirectoriesForFile = function (fileName, project, callback) { var currentPath = ts.getDirectoryPath(fileName); var parentPath = ts.getDirectoryPath(currentPath); while (currentPath != parentPath) { - if (!this.directoryWatchersForTsconfig[currentPath]) { + if (!this.directoryWatchersForTsconfig.has(currentPath)) { this.projectService.logger.info("Add watcher for: " + currentPath); - this.directoryWatchersForTsconfig[currentPath] = this.projectService.host.watchDirectory(currentPath, callback); - this.directoryWatchersRefCount[currentPath] = 1; + this.directoryWatchersForTsconfig.set(currentPath, this.projectService.host.watchDirectory(currentPath, callback)); + this.directoryWatchersRefCount.set(currentPath, 1); } else { - this.directoryWatchersRefCount[currentPath] += 1; + this.directoryWatchersRefCount.set(currentPath, this.directoryWatchersRefCount.get(currentPath) + 1); } project.directoriesWatchedForTsconfig.push(currentPath); currentPath = parentPath; @@ -68442,7 +68883,7 @@ var ts; files: parsedCommandLine.fileNames, compilerOptions: parsedCommandLine.options, configHasFilesProperty: config["files"] !== undefined, - wildcardDirectories: ts.createMap(parsedCommandLine.wildcardDirectories), + wildcardDirectories: ts.createMapFromTemplate(parsedCommandLine.wildcardDirectories), typeAcquisition: parsedCommandLine.typeAcquisition, compileOnSave: parsedCommandLine.compileOnSave }; @@ -68700,7 +69141,7 @@ var ts; this.logger.info("Host information " + args.hostInfo); } if (args.formatOptions) { - server.mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); + server.mergeMapLikes(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); this.logger.info("Format host information updated"); } if (args.extraFileExtensions) { @@ -68780,13 +69221,13 @@ var ts; this.printProjects(); }; ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) { - var _loop_4 = function (proj) { + var _loop_6 = function (proj) { var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; }); result.push(proj.getChangesSinceVersion(knownProject && knownProject.version)); }; for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) { var proj = currentProjects_1[_i]; - _loop_4(proj); + _loop_6(proj); } }; ProjectService.prototype.synchronizeProjectList = function (knownProjects) { @@ -68845,7 +69286,7 @@ var ts; ProjectService.prototype.closeExternalProject = function (uncheckedFileName, suppressRefresh) { if (suppressRefresh === void 0) { suppressRefresh = false; } var fileName = server.toNormalizedPath(uncheckedFileName); - var configFiles = this.externalProjectToConfiguredProjectMap[fileName]; + var configFiles = this.externalProjectToConfiguredProjectMap.get(fileName); if (configFiles) { var shouldRefreshInferredProjects = false; for (var _i = 0, configFiles_1 = configFiles; _i < configFiles_1.length; _i++) { @@ -68854,7 +69295,7 @@ var ts; shouldRefreshInferredProjects = true; } } - delete this.externalProjectToConfiguredProjectMap[fileName]; + this.externalProjectToConfiguredProjectMap.delete(fileName); if (shouldRefreshInferredProjects && !suppressRefresh) { this.refreshInferredProjects(); } @@ -68870,18 +69311,19 @@ var ts; } }; ProjectService.prototype.openExternalProjects = function (projects) { + var _this = this; var projectsToClose = ts.arrayToMap(this.externalProjects, function (p) { return p.getProjectName(); }, function (_) { return true; }); - for (var externalProjectName in this.externalProjectToConfiguredProjectMap) { - projectsToClose[externalProjectName] = true; - } + ts.forEachKey(this.externalProjectToConfiguredProjectMap, function (externalProjectName) { + projectsToClose.set(externalProjectName, true); + }); for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) { var externalProject = projects_4[_i]; this.openExternalProject(externalProject, true); - delete projectsToClose[externalProject.projectFileName]; - } - for (var externalProjectName in projectsToClose) { - this.closeExternalProject(externalProjectName, true); + projectsToClose.delete(externalProject.projectFileName); } + ts.forEachKey(projectsToClose, function (externalProjectName) { + _this.closeExternalProject(externalProjectName, true); + }); this.refreshInferredProjects(); }; ProjectService.prototype.openExternalProject = function (proj, suppressRefreshOfInferredProjects) { @@ -68923,12 +69365,12 @@ var ts; } this.closeExternalProject(proj.projectFileName, true); } - else if (this.externalProjectToConfiguredProjectMap[proj.projectFileName]) { + else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) { if (!tsConfigFiles) { this.closeExternalProject(proj.projectFileName, true); } else { - var oldConfigFiles = this.externalProjectToConfiguredProjectMap[proj.projectFileName]; + var oldConfigFiles = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName); var iNew = 0; var iOld = 0; while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) { @@ -68953,7 +69395,7 @@ var ts; } } if (tsConfigFiles) { - this.externalProjectToConfiguredProjectMap[proj.projectFileName] = tsConfigFiles; + this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, tsConfigFiles); for (var _b = 0, tsConfigFiles_1 = tsConfigFiles; _b < tsConfigFiles_1.length; _b++) { var tsconfigFile = tsConfigFiles_1[_b]; var project = this.findConfiguredProjectByProjectName(tsconfigFile); @@ -68967,7 +69409,7 @@ var ts; } } else { - delete this.externalProjectToConfiguredProjectMap[proj.projectFileName]; + this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName); this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); } if (!suppressRefreshOfInferredProjects) { @@ -69132,7 +69574,7 @@ var ts; this.logger = logger; this.canUseEvents = canUseEvents; this.changeSeq = 0; - this.handlers = ts.createMap((_a = {}, + this.handlers = ts.createMapFromTemplate((_a = {}, _a[CommandNames.OpenExternalProject] = function (request) { _this.projectService.openExternalProject(request.arguments, false); return _this.requiredResponse(true); @@ -69624,18 +70066,21 @@ var ts; }; Session.prototype.getImplementation = function (args, simplifiedResult) { var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); + var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); var implementations = project.getLanguageService().getImplementationAtPosition(file, position); if (!implementations) { return []; } if (simplifiedResult) { - return implementations.map(function (impl) { return ({ - file: impl.fileName, - start: scriptInfo.positionToLineOffset(impl.textSpan.start), - end: scriptInfo.positionToLineOffset(ts.textSpanEnd(impl.textSpan)) - }); }); + return implementations.map(function (_a) { + var fileName = _a.fileName, textSpan = _a.textSpan; + var scriptInfo = project.getScriptInfo(fileName); + return { + file: fileName, + start: scriptInfo.positionToLineOffset(textSpan.start), + end: scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan)) + }; + }); } else { return implementations; @@ -70045,9 +70490,9 @@ var ts; if (simplifiedResult) { return completions.entries.reduce(function (result, entry) { if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) { - var name_53 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; + var name = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined; - result.push({ name: name_53, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); + result.push({ name: name, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); } return result; }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); }); @@ -70389,13 +70834,13 @@ var ts; return { response: response, responseRequired: true }; }; Session.prototype.addProtocolHandler = function (command, handler) { - if (command in this.handlers) { + if (this.handlers.has(command)) { throw new Error("Protocol handler already exists for command \"" + command + "\""); } - this.handlers[command] = handler; + this.handlers.set(command, handler); }; Session.prototype.executeCommand = function (request) { - var handler = this.handlers[request.command]; + var handler = this.handlers.get(request.command); if (handler) { return handler(request); } @@ -70468,7 +70913,7 @@ var ts; BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) { for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var statement = _a[_i]; - if (statement.kind !== 231 || statement.name.kind !== 9) { + if (statement.kind !== 232 || statement.name.kind !== 9) { return false; } } @@ -70721,25 +71166,25 @@ var ts; } var queue = fileInfo.referencedBy.slice(0); var fileNameSet = ts.createMap(); - fileNameSet[scriptInfo.fileName] = scriptInfo; + fileNameSet.set(scriptInfo.fileName, scriptInfo); while (queue.length > 0) { var processingFileInfo = queue.pop(); if (processingFileInfo.updateShapeSignature() && processingFileInfo.referencedBy.length > 0) { for (var _i = 0, _a = processingFileInfo.referencedBy; _i < _a.length; _i++) { var potentialFileInfo = _a[_i]; - if (!fileNameSet[potentialFileInfo.scriptInfo.fileName]) { + if (!fileNameSet.has(potentialFileInfo.scriptInfo.fileName)) { queue.push(potentialFileInfo); } } } - fileNameSet[processingFileInfo.scriptInfo.fileName] = processingFileInfo.scriptInfo; + fileNameSet.set(processingFileInfo.scriptInfo.fileName, processingFileInfo.scriptInfo); } var result = []; - for (var fileName in fileNameSet) { - if (shouldEmitFile(fileNameSet[fileName])) { + fileNameSet.forEach(function (scriptInfo, fileName) { + if (shouldEmitFile(scriptInfo)) { result.push(fileName); } - } + }); return result; }; return ModuleBuilder; @@ -70848,7 +71293,9 @@ var ts; if (settingsJson == null || settingsJson == "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); } - return JSON.parse(settingsJson); + var compilerOptions = JSON.parse(settingsJson); + compilerOptions.allowNonTsExtensions = true; + return compilerOptions; }; LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { var encoded = this.shimHost.getScriptFileNames(); @@ -71286,12 +71733,6 @@ var ts; var compilerOptions = JSON.parse(compilerOptionsJson); var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; - if (resolvedFileName && !compilerOptions.allowJs && ts.fileExtensionIs(resolvedFileName, ".js")) { - return { - resolvedFileName: undefined, - failedLookupLocations: [] - }; - } return { resolvedFileName: resolvedFileName, failedLookupLocations: result.failedLookupLocations diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 65a33f28c3392..897a9eae6694a 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -14,11 +14,36 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { + /** + * Type of objects whose values are all of the same type. + * The `in` and `for-in` operators can *not* be safely used, + * since `Object.prototype` may be modified by outside code. + */ interface MapLike { [index: string]: T; } - interface Map extends MapLike { - __mapBrand: any; + /** ES6 Map interface. */ + interface Map { + get(key: string): T; + has(key: string): boolean; + set(key: string, value: T): this; + delete(key: string): boolean; + clear(): void; + forEach(action: (value: T, key: string) => void): void; + readonly size: number; + keys(): Iterator; + values(): Iterator; + entries(): Iterator<[string, T]>; + } + /** ES6 Iterator type. */ + interface Iterator { + next(): { + value: T; + done: false; + } | { + value: never; + done: true; + }; } type Path = string & { __pathBrand: any; @@ -170,172 +195,173 @@ declare namespace ts { ReadonlyKeyword = 130, RequireKeyword = 131, NumberKeyword = 132, - SetKeyword = 133, - StringKeyword = 134, - SymbolKeyword = 135, - TypeKeyword = 136, - UndefinedKeyword = 137, - FromKeyword = 138, - GlobalKeyword = 139, - OfKeyword = 140, - QualifiedName = 141, - ComputedPropertyName = 142, - TypeParameter = 143, - Parameter = 144, - Decorator = 145, - PropertySignature = 146, - PropertyDeclaration = 147, - MethodSignature = 148, - MethodDeclaration = 149, - Constructor = 150, - GetAccessor = 151, - SetAccessor = 152, - CallSignature = 153, - ConstructSignature = 154, - IndexSignature = 155, - TypePredicate = 156, - TypeReference = 157, - FunctionType = 158, - ConstructorType = 159, - TypeQuery = 160, - TypeLiteral = 161, - ArrayType = 162, - TupleType = 163, - UnionType = 164, - IntersectionType = 165, - ParenthesizedType = 166, - ThisType = 167, - TypeOperator = 168, - IndexedAccessType = 169, - MappedType = 170, - LiteralType = 171, - ObjectBindingPattern = 172, - ArrayBindingPattern = 173, - BindingElement = 174, - ArrayLiteralExpression = 175, - ObjectLiteralExpression = 176, - PropertyAccessExpression = 177, - ElementAccessExpression = 178, - CallExpression = 179, - NewExpression = 180, - TaggedTemplateExpression = 181, - TypeAssertionExpression = 182, - ParenthesizedExpression = 183, - FunctionExpression = 184, - ArrowFunction = 185, - DeleteExpression = 186, - TypeOfExpression = 187, - VoidExpression = 188, - AwaitExpression = 189, - PrefixUnaryExpression = 190, - PostfixUnaryExpression = 191, - BinaryExpression = 192, - ConditionalExpression = 193, - TemplateExpression = 194, - YieldExpression = 195, - SpreadElement = 196, - ClassExpression = 197, - OmittedExpression = 198, - ExpressionWithTypeArguments = 199, - AsExpression = 200, - NonNullExpression = 201, - MetaProperty = 202, - TemplateSpan = 203, - SemicolonClassElement = 204, - Block = 205, - VariableStatement = 206, - EmptyStatement = 207, - ExpressionStatement = 208, - IfStatement = 209, - DoStatement = 210, - WhileStatement = 211, - ForStatement = 212, - ForInStatement = 213, - ForOfStatement = 214, - ContinueStatement = 215, - BreakStatement = 216, - ReturnStatement = 217, - WithStatement = 218, - SwitchStatement = 219, - LabeledStatement = 220, - ThrowStatement = 221, - TryStatement = 222, - DebuggerStatement = 223, - VariableDeclaration = 224, - VariableDeclarationList = 225, - FunctionDeclaration = 226, - ClassDeclaration = 227, - InterfaceDeclaration = 228, - TypeAliasDeclaration = 229, - EnumDeclaration = 230, - ModuleDeclaration = 231, - ModuleBlock = 232, - CaseBlock = 233, - NamespaceExportDeclaration = 234, - ImportEqualsDeclaration = 235, - ImportDeclaration = 236, - ImportClause = 237, - NamespaceImport = 238, - NamedImports = 239, - ImportSpecifier = 240, - ExportAssignment = 241, - ExportDeclaration = 242, - NamedExports = 243, - ExportSpecifier = 244, - MissingDeclaration = 245, - ExternalModuleReference = 246, - JsxElement = 247, - JsxSelfClosingElement = 248, - JsxOpeningElement = 249, - JsxClosingElement = 250, - JsxAttribute = 251, - JsxSpreadAttribute = 252, - JsxExpression = 253, - CaseClause = 254, - DefaultClause = 255, - HeritageClause = 256, - CatchClause = 257, - PropertyAssignment = 258, - ShorthandPropertyAssignment = 259, - SpreadAssignment = 260, - EnumMember = 261, - SourceFile = 262, - JSDocTypeExpression = 263, - JSDocAllType = 264, - JSDocUnknownType = 265, - JSDocArrayType = 266, - JSDocUnionType = 267, - JSDocTupleType = 268, - JSDocNullableType = 269, - JSDocNonNullableType = 270, - JSDocRecordType = 271, - JSDocRecordMember = 272, - JSDocTypeReference = 273, - JSDocOptionalType = 274, - JSDocFunctionType = 275, - JSDocVariadicType = 276, - JSDocConstructorType = 277, - JSDocThisType = 278, - JSDocComment = 279, - JSDocTag = 280, - JSDocAugmentsTag = 281, - JSDocParameterTag = 282, - JSDocReturnTag = 283, - JSDocTypeTag = 284, - JSDocTemplateTag = 285, - JSDocTypedefTag = 286, - JSDocPropertyTag = 287, - JSDocTypeLiteral = 288, - JSDocLiteralType = 289, - JSDocNullKeyword = 290, - JSDocUndefinedKeyword = 291, - JSDocNeverKeyword = 292, - SyntaxList = 293, - NotEmittedStatement = 294, - PartiallyEmittedExpression = 295, - MergeDeclarationMarker = 296, - EndOfDeclarationMarker = 297, - Count = 298, + ObjectKeyword = 133, + SetKeyword = 134, + StringKeyword = 135, + SymbolKeyword = 136, + TypeKeyword = 137, + UndefinedKeyword = 138, + FromKeyword = 139, + GlobalKeyword = 140, + OfKeyword = 141, + QualifiedName = 142, + ComputedPropertyName = 143, + TypeParameter = 144, + Parameter = 145, + Decorator = 146, + PropertySignature = 147, + PropertyDeclaration = 148, + MethodSignature = 149, + MethodDeclaration = 150, + Constructor = 151, + GetAccessor = 152, + SetAccessor = 153, + CallSignature = 154, + ConstructSignature = 155, + IndexSignature = 156, + TypePredicate = 157, + TypeReference = 158, + FunctionType = 159, + ConstructorType = 160, + TypeQuery = 161, + TypeLiteral = 162, + ArrayType = 163, + TupleType = 164, + UnionType = 165, + IntersectionType = 166, + ParenthesizedType = 167, + ThisType = 168, + TypeOperator = 169, + IndexedAccessType = 170, + MappedType = 171, + LiteralType = 172, + ObjectBindingPattern = 173, + ArrayBindingPattern = 174, + BindingElement = 175, + ArrayLiteralExpression = 176, + ObjectLiteralExpression = 177, + PropertyAccessExpression = 178, + ElementAccessExpression = 179, + CallExpression = 180, + NewExpression = 181, + TaggedTemplateExpression = 182, + TypeAssertionExpression = 183, + ParenthesizedExpression = 184, + FunctionExpression = 185, + ArrowFunction = 186, + DeleteExpression = 187, + TypeOfExpression = 188, + VoidExpression = 189, + AwaitExpression = 190, + PrefixUnaryExpression = 191, + PostfixUnaryExpression = 192, + BinaryExpression = 193, + ConditionalExpression = 194, + TemplateExpression = 195, + YieldExpression = 196, + SpreadElement = 197, + ClassExpression = 198, + OmittedExpression = 199, + ExpressionWithTypeArguments = 200, + AsExpression = 201, + NonNullExpression = 202, + MetaProperty = 203, + TemplateSpan = 204, + SemicolonClassElement = 205, + Block = 206, + VariableStatement = 207, + EmptyStatement = 208, + ExpressionStatement = 209, + IfStatement = 210, + DoStatement = 211, + WhileStatement = 212, + ForStatement = 213, + ForInStatement = 214, + ForOfStatement = 215, + ContinueStatement = 216, + BreakStatement = 217, + ReturnStatement = 218, + WithStatement = 219, + SwitchStatement = 220, + LabeledStatement = 221, + ThrowStatement = 222, + TryStatement = 223, + DebuggerStatement = 224, + VariableDeclaration = 225, + VariableDeclarationList = 226, + FunctionDeclaration = 227, + ClassDeclaration = 228, + InterfaceDeclaration = 229, + TypeAliasDeclaration = 230, + EnumDeclaration = 231, + ModuleDeclaration = 232, + ModuleBlock = 233, + CaseBlock = 234, + NamespaceExportDeclaration = 235, + ImportEqualsDeclaration = 236, + ImportDeclaration = 237, + ImportClause = 238, + NamespaceImport = 239, + NamedImports = 240, + ImportSpecifier = 241, + ExportAssignment = 242, + ExportDeclaration = 243, + NamedExports = 244, + ExportSpecifier = 245, + MissingDeclaration = 246, + ExternalModuleReference = 247, + JsxElement = 248, + JsxSelfClosingElement = 249, + JsxOpeningElement = 250, + JsxClosingElement = 251, + JsxAttribute = 252, + JsxSpreadAttribute = 253, + JsxExpression = 254, + CaseClause = 255, + DefaultClause = 256, + HeritageClause = 257, + CatchClause = 258, + PropertyAssignment = 259, + ShorthandPropertyAssignment = 260, + SpreadAssignment = 261, + EnumMember = 262, + SourceFile = 263, + JSDocTypeExpression = 264, + JSDocAllType = 265, + JSDocUnknownType = 266, + JSDocArrayType = 267, + JSDocUnionType = 268, + JSDocTupleType = 269, + JSDocNullableType = 270, + JSDocNonNullableType = 271, + JSDocRecordType = 272, + JSDocRecordMember = 273, + JSDocTypeReference = 274, + JSDocOptionalType = 275, + JSDocFunctionType = 276, + JSDocVariadicType = 277, + JSDocConstructorType = 278, + JSDocThisType = 279, + JSDocComment = 280, + JSDocTag = 281, + JSDocAugmentsTag = 282, + JSDocParameterTag = 283, + JSDocReturnTag = 284, + JSDocTypeTag = 285, + JSDocTemplateTag = 286, + JSDocTypedefTag = 287, + JSDocPropertyTag = 288, + JSDocTypeLiteral = 289, + JSDocLiteralType = 290, + JSDocNullKeyword = 291, + JSDocUndefinedKeyword = 292, + JSDocNeverKeyword = 293, + SyntaxList = 294, + NotEmittedStatement = 295, + PartiallyEmittedExpression = 296, + MergeDeclarationMarker = 297, + EndOfDeclarationMarker = 298, + Count = 299, FirstAssignment = 57, LastAssignment = 69, FirstCompoundAssignment = 58, @@ -343,15 +369,15 @@ declare namespace ts { FirstReservedWord = 71, LastReservedWord = 106, FirstKeyword = 71, - LastKeyword = 140, + LastKeyword = 141, FirstFutureReservedWord = 107, LastFutureReservedWord = 115, - FirstTypeNode = 156, - LastTypeNode = 171, + FirstTypeNode = 157, + LastTypeNode = 172, FirstPunctuation = 16, LastPunctuation = 69, FirstToken = 0, - LastToken = 140, + LastToken = 141, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -360,11 +386,11 @@ declare namespace ts { LastTemplateToken = 15, FirstBinaryOperator = 26, LastBinaryOperator = 69, - FirstNode = 141, - FirstJSDocNode = 263, - LastJSDocNode = 289, - FirstJSDocTagNode = 279, - LastJSDocTagNode = 292, + FirstNode = 142, + FirstJSDocNode = 264, + LastJSDocNode = 293, + FirstJSDocTagNode = 280, + LastJSDocTagNode = 293, } enum NodeFlags { None = 0, @@ -632,7 +658,7 @@ declare namespace ts { _typeNodeBrand: any; } interface KeywordTypeNode extends TypeNode { - kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword; + kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword; } interface ThisTypeNode extends TypeNode { kind: SyntaxKind.ThisType; @@ -1578,7 +1604,7 @@ declare namespace ts { getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; - getBaseTypes(type: InterfaceType): ObjectType[]; + getBaseTypes(type: InterfaceType): BaseType[]; getReturnTypeOfSignature(signature: Signature): Type; getNonNullableType(type: Type): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; @@ -1778,6 +1804,7 @@ declare namespace ts { Intersection = 131072, Index = 262144, IndexedAccess = 524288, + NonPrimitive = 16777216, Literal = 480, StringOrNumberLiteral = 96, PossiblyFalsy = 7406, @@ -1787,10 +1814,10 @@ declare namespace ts { EnumLike = 272, UnionOrIntersection = 196608, StructuredType = 229376, - StructuredOrTypeParameter = 507904, + StructuredOrTypeVariable = 1032192, TypeVariable = 540672, - Narrowable = 1033215, - NotUnionOrUnit = 33281, + Narrowable = 17810431, + NotUnionOrUnit = 16810497, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -1806,7 +1833,7 @@ declare namespace ts { regularType?: LiteralType; } interface EnumType extends Type { - memberTypes: Map; + memberTypes: EnumLiteralType[]; } interface EnumLiteralType extends LiteralType { baseType: EnumType & UnionType; @@ -1822,6 +1849,7 @@ declare namespace ts { ObjectLiteral = 128, EvolvingArray = 256, ObjectLiteralPatternWithComputedProperties = 512, + NonPrimitive = 1024, ClassOrInterface = 3, } interface ObjectType extends Type { @@ -1834,6 +1862,7 @@ declare namespace ts { localTypeParameters: TypeParameter[]; thisType: TypeParameter; } + type BaseType = ObjectType | IntersectionType; interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; declaredCallSignatures: Signature[]; @@ -2034,6 +2063,7 @@ declare namespace ts { None = 0, Preserve = 1, React = 2, + ReactNative = 3, } enum NewLineKind { CarriageReturnLineFeed = 0, @@ -2173,6 +2203,8 @@ declare namespace ts { /** The version of the TypeScript compiler release */ const version = "2.2.0"; } +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; +declare function clearTimeout(handle: any): void; declare namespace ts { type FileWatcherCallback = (fileName: string, removed?: boolean) => void; type DirectoryWatcherCallback = (fileName: string) => void; @@ -2267,8 +2299,8 @@ declare namespace ts { function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; - function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined; /** Optionally, get the shebang */ function getShebang(text: string): string; function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; @@ -2327,6 +2359,10 @@ declare namespace ts { function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { + /** Array that is only intended to be pushed to, never read. */ + interface Push { + push(value: T): void; + } function moduleHasNonRelativeName(moduleName: string): boolean; function getEffectiveTypeRoots(options: CompilerOptions, host: { directoryExists?: (directoryName: string) => boolean; @@ -2454,7 +2490,7 @@ declare namespace ts { getConstructSignatures(): Signature[]; getStringIndexType(): Type; getNumberIndexType(): Type; - getBaseTypes(): ObjectType[]; + getBaseTypes(): BaseType[]; getNonNullableType(): Type; } interface Signature { diff --git a/lib/typescript.js b/lib/typescript.js index bae2811e4de7e..9a642bdb1df29 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -173,193 +173,194 @@ var ts; SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 130] = "ReadonlyKeyword"; SyntaxKind[SyntaxKind["RequireKeyword"] = 131] = "RequireKeyword"; SyntaxKind[SyntaxKind["NumberKeyword"] = 132] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 133] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 134] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 135] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 136] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 137] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 138] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 139] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 140] = "OfKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 133] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 134] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 135] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 136] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 137] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 138] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 139] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 140] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 141] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 141] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 142] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 142] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 143] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 143] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 144] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 145] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 144] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 145] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 146] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 146] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 147] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 148] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 149] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 150] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 151] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 152] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 153] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 154] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 155] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 147] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 148] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 149] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 150] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 151] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 152] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 153] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 154] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 155] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 156] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 156] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 157] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 158] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 159] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 160] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 161] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 162] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 163] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 164] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 165] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 166] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 167] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 168] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 169] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 170] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 171] = "LiteralType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 157] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 158] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 159] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 160] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 161] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 162] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 163] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 164] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 165] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 166] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 167] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 168] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 169] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 170] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 171] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 172] = "LiteralType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 172] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 173] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 174] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 173] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 174] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 175] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 175] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 176] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 177] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 178] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 179] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 180] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 181] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 182] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 183] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 184] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 185] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 186] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 187] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 188] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 189] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 190] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 191] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 192] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 193] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 194] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 195] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 196] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 197] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 198] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 199] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 200] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 201] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 202] = "MetaProperty"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 176] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 177] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 178] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 179] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 180] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 181] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 182] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 183] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 184] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 185] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 186] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 187] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 188] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 189] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 190] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 191] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 192] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 193] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 194] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 195] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 196] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 197] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 198] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 199] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 200] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 201] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 202] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 203] = "MetaProperty"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 203] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 204] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 204] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 205] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 205] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 206] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 207] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 208] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 209] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 210] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 211] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 212] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 213] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 214] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 215] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 216] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 217] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 218] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 219] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 220] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 221] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 222] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 223] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 224] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 225] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 226] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 227] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 228] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 229] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 230] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 231] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 232] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 233] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 234] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 235] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 236] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 237] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 238] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 239] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 240] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 241] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 242] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 243] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 244] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 245] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 206] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 207] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 208] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 209] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 210] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 211] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 212] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 213] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 214] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 215] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 216] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 217] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 218] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 219] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 220] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 221] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 222] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 223] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 224] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 225] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 226] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 227] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 228] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 229] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 230] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 231] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 232] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 233] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 234] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 235] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 236] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 237] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 238] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 239] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 240] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 241] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 242] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 243] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 244] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 245] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 246] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 246] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 247] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 247] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 248] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 249] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 250] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 251] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 252] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 253] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 248] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 249] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 250] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 251] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 252] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 253] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 254] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 254] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 255] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 256] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 257] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 255] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 256] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 257] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 258] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 258] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 259] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 260] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 259] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 260] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 261] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 261] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 262] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 262] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 263] = "SourceFile"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 263] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 264] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 264] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 265] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 265] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 266] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 267] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 268] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 269] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 270] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 271] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 272] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 273] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 274] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 275] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 276] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 277] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 278] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 279] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 280] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 281] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 282] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 283] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 284] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 285] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 286] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 287] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 288] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocLiteralType"] = 289] = "JSDocLiteralType"; - SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 290] = "JSDocNullKeyword"; - SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 291] = "JSDocUndefinedKeyword"; - SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 292] = "JSDocNeverKeyword"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 266] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 267] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 268] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 269] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 270] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 271] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 272] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 273] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 274] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 275] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 276] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 277] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 278] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 279] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 280] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 281] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 282] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 283] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 284] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 285] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 286] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 287] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 288] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 289] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocLiteralType"] = 290] = "JSDocLiteralType"; + SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 291] = "JSDocNullKeyword"; + SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 292] = "JSDocUndefinedKeyword"; + SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 293] = "JSDocNeverKeyword"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 294] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 296] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 297] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 295] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 296] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 297] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 298] = "EndOfDeclarationMarker"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 298] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 299] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment"; @@ -368,15 +369,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 71] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 106] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 71] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 140] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 141] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 107] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 115] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 156] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 171] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 157] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 172] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 16] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 69] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 140] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 141] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -385,11 +386,11 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 15] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 263] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 289] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 279] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 142] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 264] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 293] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 280] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 293] = "LastJSDocTagNode"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -702,6 +703,7 @@ var ts; TypeFlags[TypeFlags["ContainsObjectLiteral"] = 4194304] = "ContainsObjectLiteral"; /* @internal */ TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; + TypeFlags[TypeFlags["NonPrimitive"] = 16777216] = "NonPrimitive"; /* @internal */ TypeFlags[TypeFlags["Nullable"] = 6144] = "Nullable"; TypeFlags[TypeFlags["Literal"] = 480] = "Literal"; @@ -710,7 +712,7 @@ var ts; TypeFlags[TypeFlags["DefinitelyFalsy"] = 7392] = "DefinitelyFalsy"; TypeFlags[TypeFlags["PossiblyFalsy"] = 7406] = "PossiblyFalsy"; /* @internal */ - TypeFlags[TypeFlags["Intrinsic"] = 16015] = "Intrinsic"; + TypeFlags[TypeFlags["Intrinsic"] = 16793231] = "Intrinsic"; /* @internal */ TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive"; TypeFlags[TypeFlags["StringLike"] = 262178] = "StringLike"; @@ -719,12 +721,12 @@ var ts; TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike"; TypeFlags[TypeFlags["UnionOrIntersection"] = 196608] = "UnionOrIntersection"; TypeFlags[TypeFlags["StructuredType"] = 229376] = "StructuredType"; - TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 507904] = "StructuredOrTypeParameter"; + TypeFlags[TypeFlags["StructuredOrTypeVariable"] = 1032192] = "StructuredOrTypeVariable"; TypeFlags[TypeFlags["TypeVariable"] = 540672] = "TypeVariable"; // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never - TypeFlags[TypeFlags["Narrowable"] = 1033215] = "Narrowable"; - TypeFlags[TypeFlags["NotUnionOrUnit"] = 33281] = "NotUnionOrUnit"; + TypeFlags[TypeFlags["Narrowable"] = 17810431] = "Narrowable"; + TypeFlags[TypeFlags["NotUnionOrUnit"] = 16810497] = "NotUnionOrUnit"; /* @internal */ TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening"; /* @internal */ @@ -742,6 +744,7 @@ var ts; ObjectFlags[ObjectFlags["ObjectLiteral"] = 128] = "ObjectLiteral"; ObjectFlags[ObjectFlags["EvolvingArray"] = 256] = "EvolvingArray"; ObjectFlags[ObjectFlags["ObjectLiteralPatternWithComputedProperties"] = 512] = "ObjectLiteralPatternWithComputedProperties"; + ObjectFlags[ObjectFlags["NonPrimitive"] = 1024] = "NonPrimitive"; ObjectFlags[ObjectFlags["ClassOrInterface"] = 3] = "ClassOrInterface"; })(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {})); var SignatureKind; @@ -792,6 +795,7 @@ var ts; JsxEmit[JsxEmit["None"] = 0] = "None"; JsxEmit[JsxEmit["Preserve"] = 1] = "Preserve"; JsxEmit[JsxEmit["React"] = 2] = "React"; + JsxEmit[JsxEmit["ReactNative"] = 3] = "ReactNative"; })(JsxEmit = ts.JsxEmit || (ts.JsxEmit = {})); var NewLineKind; (function (NewLineKind) { @@ -1121,8 +1125,8 @@ var ts; */ function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } @@ -1138,9 +1142,9 @@ var ts; */ function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; @@ -1150,7 +1154,7 @@ var ts; * @param markName The name of the mark. */ function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; /** @@ -1159,7 +1163,7 @@ var ts; * @param measureName The name of the measure whose durations should be accumulated. */ function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; /** @@ -1168,9 +1172,9 @@ var ts; * @param cb The action to perform for each measure */ function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; /** Enables (and resets) performance measurements for the compiler. */ @@ -1213,25 +1217,106 @@ var ts; Ternary[Ternary["Maybe"] = 1] = "Maybe"; Ternary[Ternary["True"] = -1] = "True"; })(Ternary = ts.Ternary || (ts.Ternary = {})); - var createObject = Object.create; // More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times. - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); // tslint:disable-line:no-null-keyword + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(/*locales*/ undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + // Intl is missing in Safari, and node 0.10 treats "a" as greater than "B". + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + /** Create a MapLike with good performance. */ + function createDictionaryObject() { + var map = Object.create(null); // tslint:disable-line:no-null-keyword // Using 'delete' on an object causes V8 to put the object in dictionary mode. // This disables creation of hidden classes, which are expensive when an object is // constantly changing shape. map["__"] = undefined; delete map["__"]; + return map; + } + /** Create a new map. If a template object is provided, the map will copy entries from it. */ + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); // Copies keys/values from template. Note that for..in will not throw if // template is undefined, and instead will just exit the loop. for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + // Internet Explorer's Map doesn't support iteration, so don't use it. + // tslint:disable-next-line:no-in-operator + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + // Keep the class inside a function so it doesn't get compiled if it's not used. + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + // tslint:disable-next-line:no-in-operator + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -1244,33 +1329,28 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } // path should already be well-formed so it does not need to be normalized function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -1290,6 +1370,10 @@ var ts; Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; })(Comparison = ts.Comparison || (ts.Comparison = {})); + function length(array) { + return array ? array.length : 0; + } + ts.length = length; /** * Iterates through 'array' by index and performs the callback on each element of array until the callback * returns a truthy value, then returns that value. @@ -1341,6 +1425,16 @@ var ts; return undefined; } ts.find = find; + /** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */ + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; /** * Returns the first truthy result of `callback`, or else fails. * This is like `forEach`, but never returns undefined. @@ -1589,21 +1683,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -1921,9 +2012,6 @@ var ts; /** * Indicates whether a map-like contains an own property with the specified key. * - * NOTE: This is intended for use only with MapLike objects. For Map objects, use - * the 'in' operator. - * * @param map A map-like. * @param key A property key. */ @@ -1934,9 +2022,6 @@ var ts; /** * Gets the value of an owned property in a map-like. * - * NOTE: This is intended for use only with MapLike objects. For Map objects, use - * an indexer. - * * @param map A map-like. * @param key A property key. */ @@ -1961,56 +2046,53 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - /** - * Enumerates the properties of a Map, invoking a callback and returning the first truthy result. - * - * @param map A map for which properties should be enumerated. - * @param callback A callback to invoke for each property. - */ - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + /** Shims `Array.from`. */ + function arrayFrom(iterator) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; + ts.arrayFrom = arrayFrom; /** - * Returns true if a Map has some matching property. - * - * @param map A map whose properties should be tested. - * @param predicate An optional callback used to test each property. + * Calls `callback` for each entry in the map, returning the first truthy result. + * Use `map.forEach` instead for normal iteration. */ - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } } - return false; + return undefined; + var _b; } - ts.someProperties = someProperties; - /** - * Performs a shallow copy of the properties from a source Map to a target MapLike - * - * @param source A map from which properties should be copied. - * @param target A map to which properties should be copied. - */ - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; - } - } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachEntry = forEachEntry; + /** `forEachEntry` for just keys. */ + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } + } + return undefined; + var _b; } - ts.appendProperty = appendProperty; + ts.forEachKey = forEachKey; + /** Copy entries from `source` to `target`. */ + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); + } + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -2026,24 +2108,6 @@ var ts; return t; } ts.assign = assign; - /** - * Reduce the properties of a map. - * - * NOTE: This is intended for use with Map objects. For MapLike objects, use - * reduceOwnProperties instead as it offers better runtime safety. - * - * @param map The map to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; /** * Performs a shallow equality comparison of the contents of two map-likes. * @@ -2074,23 +2138,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -2117,36 +2172,32 @@ var ts; return result; } ts.extend = extend; - /** - * Adds the value to an array of values associated with the key, and returns the array. - * Creates the array if it does not already exist. - */ - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - /** - * Removes a value from an array of values associated with the key. - * Does not preserve the order of those values. - * Does nothing if `key` is not in `map`, or `value` is not in `map[key]`. - */ - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; /** * Tests whether a value is an array. */ @@ -2330,9 +2381,12 @@ var ts; if (b === undefined) return 1 /* GreaterThan */; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - // accent means a ≠ b, a ≠ á, a = A - var result = a.localeCompare(b, /*locales*/ undefined, { usage: "sort", sensitivity: "accent" }); + // Checking if "collator exists indicates that Intl is available. + // We still have to check if "collator.compare" is correct. If it is not, use "String.localeComapre" + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, /*locales*/ undefined, { usage: "sort", sensitivity: "accent" }); // accent means a ≠ b, a ≠ á, a = A return result < 0 ? -1 /* LessThan */ : result > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */; } a = a.toUpperCase(); @@ -2777,6 +2831,17 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + // If excluding, match "foo/bar/baz...", but if including, only allow "foo". + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } @@ -2787,31 +2852,10 @@ var ts; * files or directories, does not match subdirectories that start with a . character */ var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - // If excluding, match "foo/bar/baz...", but if including, only allow "foo". - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; /** * An "includes" path "foo" is implicitly a glob "foo/** /*" (without the space) if its last component has no extension, * and does not contain any glob characters itself. @@ -2890,6 +2934,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -2902,34 +2947,50 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + // Associate an array of results with each include regex. This keeps results in order of the "include" order. + // If there are no "includes", then just put everything in results[0]. + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } + } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -2954,7 +3015,7 @@ var ts; } // Sort the offsets array using either the literal or canonical path representations. includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } @@ -2963,7 +3024,7 @@ var ts; // subpath of an existing base path for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -3489,32 +3550,32 @@ var ts; function createWatchedFileSet() { var dirWatchers = ts.createMap(); // One file can have multiple watchers - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -3526,7 +3587,7 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined" @@ -3534,10 +3595,13 @@ var ts; ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); // Some applications save a working file via rename operations - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } @@ -3613,10 +3677,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -4312,6 +4376,7 @@ var ts; Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -4322,6 +4387,7 @@ 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_2607", message: "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_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other 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_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -4370,6 +4436,7 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, @@ -4494,7 +4561,7 @@ var ts; Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'" }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -4509,6 +4576,7 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, @@ -4542,7 +4610,7 @@ var ts; Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'" }, File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, @@ -4676,9 +4744,10 @@ var ts; Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: {0}" }, Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, @@ -4697,7 +4766,7 @@ var ts; return token >= 70 /* Identifier */; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ + var textToToken = ts.createMapFromTemplate({ "abstract": 116 /* AbstractKeyword */, "any": 118 /* AnyKeyword */, "as": 117 /* AsKeyword */, @@ -4721,7 +4790,7 @@ var ts; "false": 85 /* FalseKeyword */, "finally": 86 /* FinallyKeyword */, "for": 87 /* ForKeyword */, - "from": 138 /* FromKeyword */, + "from": 139 /* FromKeyword */, "function": 88 /* FunctionKeyword */, "get": 124 /* GetKeyword */, "if": 89 /* IfKeyword */, @@ -4739,27 +4808,28 @@ var ts; "new": 93 /* NewKeyword */, "null": 94 /* NullKeyword */, "number": 132 /* NumberKeyword */, + "object": 133 /* ObjectKeyword */, "package": 110 /* PackageKeyword */, "private": 111 /* PrivateKeyword */, "protected": 112 /* ProtectedKeyword */, "public": 113 /* PublicKeyword */, "readonly": 130 /* ReadonlyKeyword */, "require": 131 /* RequireKeyword */, - "global": 139 /* GlobalKeyword */, + "global": 140 /* GlobalKeyword */, "return": 95 /* ReturnKeyword */, - "set": 133 /* SetKeyword */, + "set": 134 /* SetKeyword */, "static": 114 /* StaticKeyword */, - "string": 134 /* StringKeyword */, + "string": 135 /* StringKeyword */, "super": 96 /* SuperKeyword */, "switch": 97 /* SwitchKeyword */, - "symbol": 135 /* SymbolKeyword */, + "symbol": 136 /* SymbolKeyword */, "this": 98 /* ThisKeyword */, "throw": 99 /* ThrowKeyword */, "true": 100 /* TrueKeyword */, "try": 101 /* TryKeyword */, - "type": 136 /* TypeKeyword */, + "type": 137 /* TypeKeyword */, "typeof": 102 /* TypeOfKeyword */, - "undefined": 137 /* UndefinedKeyword */, + "undefined": 138 /* UndefinedKeyword */, "var": 103 /* VarKeyword */, "void": 104 /* VoidKeyword */, "while": 105 /* WhileKeyword */, @@ -4767,7 +4837,7 @@ var ts; "yield": 115 /* YieldKeyword */, "async": 119 /* AsyncKeyword */, "await": 120 /* AwaitKeyword */, - "of": 140 /* OfKeyword */, + "of": 141 /* OfKeyword */, "{": 16 /* OpenBraceToken */, "}": 17 /* CloseBraceToken */, "(": 18 /* OpenParenToken */, @@ -4907,9 +4977,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; - } + source.forEach(function (value, name) { + result[value] = name; + }); return result; } var tokenStrings = makeReverseMap(textToToken); @@ -4919,7 +4989,7 @@ var ts; ts.tokenToString = tokenToString; /* @internal */ function stringToToken(s) { - return textToToken[s]; + return textToToken.get(s); } ts.stringToToken = stringToToken; /* @internal */ @@ -4993,7 +5063,6 @@ var ts; return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -5736,8 +5805,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= 97 /* a */ && ch <= 122 /* z */) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = 70 /* Identifier */; @@ -6469,25 +6541,25 @@ var ts; } ts.getFullWidth = getFullWidth; function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); } ts.hasResolvedModule = hasResolvedModule; function getResolvedModule(sourceFile, moduleNameText) { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; } ts.getResolvedModule = getResolvedModule; function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = ts.createMap(); } - sourceFile.resolvedModules[moduleNameText] = resolvedModule; + sourceFile.resolvedModules.set(moduleNameText, resolvedModule); } ts.setResolvedModule = setResolvedModule; function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { if (!sourceFile.resolvedTypeReferenceDirectiveNames) { sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap(); } - sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective); } ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; /* @internal */ @@ -6509,7 +6581,7 @@ var ts; } for (var i = 0; i < names.length; i++) { var newResolution = newResolutions[i]; - var oldResolution = oldResolutions && oldResolutions[names[i]]; + var oldResolution = oldResolutions && oldResolutions.get(names[i]); var changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; @@ -6544,7 +6616,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 262 /* SourceFile */) { + while (node && node.kind !== 263 /* SourceFile */) { node = node.parent; } return node; @@ -6552,11 +6624,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 205 /* Block */: - case 233 /* CaseBlock */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return true; } return false; @@ -6647,18 +6719,18 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 293 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 294 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 263 /* FirstJSDocNode */ && node.kind <= 289 /* LastJSDocNode */; + return node.kind >= 264 /* FirstJSDocNode */ && node.kind <= 293 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 279 /* FirstJSDocTagNode */ && node.kind <= 292 /* LastJSDocTagNode */; + return node.kind >= 280 /* FirstJSDocTagNode */ && node.kind <= 293 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -6724,18 +6796,52 @@ var ts; } ts.getLiteralText = getLiteralText; function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { + return node.kind === 8 /* NumericLiteral */ + && (getNumericLiteralFlags(text, /*hint*/ 6 /* BinaryOrOctal */) & 6 /* BinaryOrOctal */) !== 0; + } + ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; + var NumericLiteralFlags; + (function (NumericLiteralFlags) { + NumericLiteralFlags[NumericLiteralFlags["None"] = 0] = "None"; + NumericLiteralFlags[NumericLiteralFlags["Hexadecimal"] = 1] = "Hexadecimal"; + NumericLiteralFlags[NumericLiteralFlags["Binary"] = 2] = "Binary"; + NumericLiteralFlags[NumericLiteralFlags["Octal"] = 4] = "Octal"; + NumericLiteralFlags[NumericLiteralFlags["Scientific"] = 8] = "Scientific"; + NumericLiteralFlags[NumericLiteralFlags["BinaryOrOctal"] = 6] = "BinaryOrOctal"; + NumericLiteralFlags[NumericLiteralFlags["BinaryOrOctalOrHexadecimal"] = 7] = "BinaryOrOctalOrHexadecimal"; + NumericLiteralFlags[NumericLiteralFlags["All"] = 15] = "All"; + })(NumericLiteralFlags = ts.NumericLiteralFlags || (ts.NumericLiteralFlags = {})); + /** + * Scans a numeric literal string to determine the form of the number. + * @param text Numeric literal text + * @param hint If `Scientific` or `All` is specified, performs a more expensive check to scan for scientific notation. + */ + function getNumericLiteralFlags(text, hint) { + if (text.length > 1) { switch (text.charCodeAt(1)) { case 98 /* b */: case 66 /* B */: + return 2 /* Binary */; case 111 /* o */: case 79 /* O */: - return true; + return 4 /* Octal */; + case 120 /* x */: + case 88 /* X */: + return 1 /* Hexadecimal */; + } + if (hint & 8 /* Scientific */) { + for (var i = text.length - 1; i >= 0; i--) { + switch (text.charCodeAt(i)) { + case 101 /* e */: + case 69 /* E */: + return 8 /* Scientific */; + } + } } } - return false; + return 0 /* None */; } - ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; + ts.getNumericLiteralFlags = getNumericLiteralFlags; function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; } @@ -6762,11 +6868,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 224 /* VariableDeclaration */ && node.parent.kind === 257 /* CatchClause */; + return node.kind === 225 /* VariableDeclaration */ && node.parent.kind === 258 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 231 /* ModuleDeclaration */ && + return node && node.kind === 232 /* ModuleDeclaration */ && (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -6777,11 +6883,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return node.kind === 231 /* ModuleDeclaration */ && (!node.body); + return node && node.kind === 232 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 262 /* SourceFile */ || - node.kind === 231 /* ModuleDeclaration */ || + return node.kind === 263 /* SourceFile */ || + node.kind === 232 /* ModuleDeclaration */ || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -6797,9 +6903,9 @@ var ts; return false; } switch (node.parent.kind) { - case 262 /* SourceFile */: + case 263 /* SourceFile */: return ts.isExternalModule(node.parent); - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -6811,22 +6917,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 262 /* SourceFile */: - case 233 /* CaseBlock */: - case 257 /* CatchClause */: - case 231 /* ModuleDeclaration */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 263 /* SourceFile */: + case 234 /* CaseBlock */: + case 258 /* CatchClause */: + case 232 /* ModuleDeclaration */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return true; - case 205 /* Block */: + case 206 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return parentNode && !isFunctionLike(parentNode); @@ -6860,7 +6966,7 @@ var ts; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: return name.text; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } @@ -6872,9 +6978,9 @@ var ts; switch (name.kind) { case 70 /* Identifier */: return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name); - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -6911,7 +7017,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 205 /* Block */) { + if (node.body && node.body.kind === 206 /* Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -6925,7 +7031,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 262 /* SourceFile */: + case 263 /* 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 @@ -6934,23 +7040,23 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 224 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 231 /* ModuleDeclaration */: - case 230 /* EnumDeclaration */: - case 261 /* EnumMember */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 229 /* TypeAliasDeclaration */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 262 /* EnumMember */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 230 /* TypeAliasDeclaration */: errorNode = node.name; break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -6973,7 +7079,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 230 /* EnumDeclaration */ && isConst(node); + return node.kind === 231 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -6986,11 +7092,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 179 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */; + return n.kind === 180 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 208 /* ExpressionStatement */ + return node.kind === 209 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -7003,10 +7109,10 @@ var ts; } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 144 /* Parameter */ || - node.kind === 143 /* TypeParameter */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 185 /* ArrowFunction */) ? + var commentRanges = (node.kind === 145 /* Parameter */ || + node.kind === 144 /* TypeParameter */ || + node.kind === 185 /* FunctionExpression */ || + node.kind === 186 /* ArrowFunction */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); // True if the comment starts with '/**' but not if it is '/**/' @@ -7021,39 +7127,39 @@ var ts; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (156 /* FirstTypeNode */ <= node.kind && node.kind <= 171 /* LastTypeNode */) { + if (157 /* FirstTypeNode */ <= node.kind && node.kind <= 172 /* LastTypeNode */) { return true; } switch (node.kind) { case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: - case 137 /* UndefinedKeyword */: + case 136 /* SymbolKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: return true; case 104 /* VoidKeyword */: - return node.parent.kind !== 188 /* VoidExpression */; - case 199 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 189 /* VoidExpression */; + case 200 /* 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 70 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 141 /* QualifiedName */: - case 177 /* PropertyAccessExpression */: + ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 142 /* QualifiedName */ || node.kind === 178 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 142 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: case 98 /* ThisKeyword */: - var parent_1 = node.parent; - if (parent_1.kind === 160 /* TypeQuery */) { + var parent = node.parent; + if (parent.kind === 161 /* TypeQuery */) { return false; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -7062,38 +7168,38 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (156 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 171 /* LastTypeNode */) { + if (157 /* FirstTypeNode */ <= parent.kind && parent.kind <= 172 /* LastTypeNode */) { return true; } - switch (parent_1.kind) { - case 199 /* ExpressionWithTypeArguments */: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 143 /* TypeParameter */: - return node === parent_1.constraint; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 144 /* Parameter */: - case 224 /* VariableDeclaration */: - return node === parent_1.type; - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - return node === parent_1.type; - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - return node === parent_1.type; - case 182 /* TypeAssertionExpression */: - return node === parent_1.type; - case 179 /* CallExpression */: - case 180 /* NewExpression */: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 181 /* TaggedTemplateExpression */: + switch (parent.kind) { + case 200 /* ExpressionWithTypeArguments */: + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); + case 144 /* TypeParameter */: + return node === parent.constraint; + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 145 /* Parameter */: + case 225 /* VariableDeclaration */: + return node === parent.type; + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return node === parent.type; + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + return node === parent.type; + case 183 /* TypeAssertionExpression */: + return node === parent.type; + case 180 /* CallExpression */: + case 181 /* NewExpression */: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 182 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -7112,7 +7218,7 @@ var ts; } ts.isChildOfNodeWithKind = isChildOfNodeWithKind; function isPrefixUnaryExpression(node) { - return node.kind === 190 /* PrefixUnaryExpression */; + return node.kind === 191 /* PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; // Warning: This has the same semantics as the forEach family of functions, @@ -7121,23 +7227,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitor(node); - case 233 /* CaseBlock */: - case 205 /* Block */: - case 209 /* IfStatement */: - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 218 /* WithStatement */: - case 219 /* SwitchStatement */: - case 254 /* CaseClause */: - case 255 /* DefaultClause */: - case 220 /* LabeledStatement */: - case 222 /* TryStatement */: - case 257 /* CatchClause */: + case 234 /* CaseBlock */: + case 206 /* Block */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 219 /* WithStatement */: + case 220 /* SwitchStatement */: + case 255 /* CaseClause */: + case 256 /* DefaultClause */: + case 221 /* LabeledStatement */: + case 223 /* TryStatement */: + case 258 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -7147,29 +7253,29 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 230 /* EnumDeclaration */: - case 228 /* InterfaceDeclaration */: - case 231 /* ModuleDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 231 /* EnumDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* 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. return; default: if (isFunctionLike(node)) { - var name_5 = node.name; - if (name_5 && name_5.kind === 142 /* ComputedPropertyName */) { + var name = node.name; + if (name && name.kind === 143 /* 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); + traverse(name.expression); return; } } @@ -7189,10 +7295,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 162 /* ArrayType */) { + if (node && node.kind === 163 /* ArrayType */) { return node.elementType; } - else if (node && node.kind === 157 /* TypeReference */) { + else if (node && node.kind === 158 /* TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -7203,14 +7309,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 174 /* BindingElement */: - case 261 /* EnumMember */: - case 144 /* Parameter */: - case 258 /* PropertyAssignment */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 259 /* ShorthandPropertyAssignment */: - case 224 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 262 /* EnumMember */: + case 145 /* Parameter */: + case 259 /* PropertyAssignment */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 260 /* ShorthandPropertyAssignment */: + case 225 /* VariableDeclaration */: return true; } } @@ -7218,11 +7324,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */); + return node && (node.kind === 152 /* GetAccessor */ || node.kind === 153 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 227 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */); + return node && (node.kind === 228 /* ClassDeclaration */ || node.kind === 198 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -7231,19 +7337,19 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return true; } return false; @@ -7251,13 +7357,13 @@ var ts; ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return true; } return false; @@ -7265,13 +7371,13 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 210 /* DoStatement */: - case 211 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: return true; - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -7282,7 +7388,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 220 /* LabeledStatement */) { + if (node.statement.kind !== 221 /* LabeledStatement */) { return node.statement; } node = node.statement; @@ -7290,17 +7396,17 @@ var ts; } ts.unwrapInnermostStatmentOfLabel = unwrapInnermostStatmentOfLabel; function isFunctionBlock(node) { - return node && node.kind === 205 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 206 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 149 /* MethodDeclaration */ && node.parent.kind === 176 /* ObjectLiteralExpression */; + return node && node.kind === 150 /* MethodDeclaration */ && node.parent.kind === 177 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { - return node.kind === 149 /* MethodDeclaration */ && - (node.parent.kind === 176 /* ObjectLiteralExpression */ || - node.parent.kind === 197 /* ClassExpression */); + return node.kind === 150 /* MethodDeclaration */ && + (node.parent.kind === 177 /* ObjectLiteralExpression */ || + node.parent.kind === 198 /* ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -7336,7 +7442,7 @@ var ts; return undefined; } switch (node.kind) { - case 142 /* ComputedPropertyName */: + case 143 /* 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 @@ -7351,9 +7457,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 145 /* 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; @@ -7364,26 +7470,26 @@ var ts; node = node.parent; } break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 231 /* ModuleDeclaration */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 230 /* EnumDeclaration */: - case 262 /* SourceFile */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 232 /* ModuleDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 231 /* EnumDeclaration */: + case 263 /* SourceFile */: return node; } } @@ -7393,9 +7499,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 150 /* Constructor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return container; } } @@ -7417,26 +7523,26 @@ var ts; return node; } switch (node.kind) { - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: node = node.parent; break; - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: if (!stopOnFunctions) { continue; } - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return node; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 145 /* 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; @@ -7452,15 +7558,15 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */) { + if (func.kind === 185 /* FunctionExpression */ || func.kind === 186 /* ArrowFunction */) { var prev = func; - var parent_2 = func.parent; - while (parent_2.kind === 183 /* ParenthesizedExpression */) { - prev = parent_2; - parent_2 = parent_2.parent; + var parent = func.parent; + while (parent.kind === 184 /* ParenthesizedExpression */) { + prev = parent; + parent = parent.parent; } - if (parent_2.kind === 179 /* CallExpression */ && parent_2.expression === prev) { - return parent_2; + if (parent.kind === 180 /* CallExpression */ && parent.expression === prev) { + return parent; } } } @@ -7470,21 +7576,21 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 177 /* PropertyAccessExpression */ || kind === 178 /* ElementAccessExpression */) + return (kind === 178 /* PropertyAccessExpression */ || kind === 179 /* ElementAccessExpression */) && node.expression.kind === 96 /* SuperKeyword */; } ts.isSuperProperty = isSuperProperty; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 157 /* TypeReference */: - case 273 /* JSDocTypeReference */: + case 158 /* TypeReference */: + case 274 /* JSDocTypeReference */: return node.typeName; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; case 70 /* Identifier */: - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return node; } return undefined; @@ -7492,10 +7598,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function isCallLikeExpression(node) { switch (node.kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 181 /* TaggedTemplateExpression */: - case 145 /* Decorator */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 182 /* TaggedTemplateExpression */: + case 146 /* Decorator */: return true; default: return false; @@ -7503,7 +7609,7 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function getInvokedExpression(node) { - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression, NewExpression, or Decorator. @@ -7512,25 +7618,25 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: // classes are valid targets return true; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 227 /* ClassDeclaration */; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: + return node.parent.kind === 228 /* ClassDeclaration */; + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && node.parent.kind === 227 /* ClassDeclaration */; - case 144 /* Parameter */: + && node.parent.kind === 228 /* ClassDeclaration */; + case 145 /* 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 !== undefined - && (node.parent.kind === 150 /* Constructor */ - || node.parent.kind === 149 /* MethodDeclaration */ - || node.parent.kind === 152 /* SetAccessor */) - && node.parent.parent.kind === 227 /* ClassDeclaration */; + && (node.parent.kind === 151 /* Constructor */ + || node.parent.kind === 150 /* MethodDeclaration */ + || node.parent.kind === 153 /* SetAccessor */) + && node.parent.parent.kind === 228 /* ClassDeclaration */; } return false; } @@ -7546,19 +7652,19 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 149 /* MethodDeclaration */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 153 /* SetAccessor */: return ts.forEach(node.parameters, nodeIsDecorated); } } ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 249 /* JsxOpeningElement */ || - parent.kind === 248 /* JsxSelfClosingElement */ || - parent.kind === 250 /* JsxClosingElement */) { + if (parent.kind === 250 /* JsxOpeningElement */ || + parent.kind === 249 /* JsxSelfClosingElement */ || + parent.kind === 251 /* JsxClosingElement */) { return parent.tagName === node; } return false; @@ -7572,97 +7678,97 @@ var ts; case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: case 11 /* RegularExpressionLiteral */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 181 /* TaggedTemplateExpression */: - case 200 /* AsExpression */: - case 182 /* TypeAssertionExpression */: - case 201 /* NonNullExpression */: - case 183 /* ParenthesizedExpression */: - case 184 /* FunctionExpression */: - case 197 /* ClassExpression */: - case 185 /* ArrowFunction */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 187 /* TypeOfExpression */: - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: - case 192 /* BinaryExpression */: - case 193 /* ConditionalExpression */: - case 196 /* SpreadElement */: - case 194 /* TemplateExpression */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 182 /* TaggedTemplateExpression */: + case 201 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 202 /* NonNullExpression */: + case 184 /* ParenthesizedExpression */: + case 185 /* FunctionExpression */: + case 198 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 188 /* TypeOfExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: + case 193 /* BinaryExpression */: + case 194 /* ConditionalExpression */: + case 197 /* SpreadElement */: + case 195 /* TemplateExpression */: case 12 /* NoSubstitutionTemplateLiteral */: - case 198 /* OmittedExpression */: - case 247 /* JsxElement */: - case 248 /* JsxSelfClosingElement */: - case 195 /* YieldExpression */: - case 189 /* AwaitExpression */: - case 202 /* MetaProperty */: + case 199 /* OmittedExpression */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: + case 196 /* YieldExpression */: + case 190 /* AwaitExpression */: + case 203 /* MetaProperty */: return true; - case 141 /* QualifiedName */: - while (node.parent.kind === 141 /* QualifiedName */) { + case 142 /* QualifiedName */: + while (node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node); + return node.parent.kind === 161 /* TypeQuery */ || isJSXTagName(node); case 70 /* Identifier */: - if (node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node)) { + if (node.parent.kind === 161 /* TypeQuery */ || isJSXTagName(node)) { return true; } // fall through case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 98 /* ThisKeyword */: - var parent_3 = node.parent; - switch (parent_3.kind) { - case 224 /* VariableDeclaration */: - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 261 /* EnumMember */: - case 258 /* PropertyAssignment */: - case 174 /* BindingElement */: - return parent_3.initializer === node; - case 208 /* ExpressionStatement */: - case 209 /* IfStatement */: - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - case 217 /* ReturnStatement */: - case 218 /* WithStatement */: - case 219 /* SwitchStatement */: - case 254 /* CaseClause */: - case 221 /* ThrowStatement */: - case 219 /* SwitchStatement */: - return parent_3.expression === node; - case 212 /* ForStatement */: - var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 225 /* VariableDeclarationList */) || + var parent = node.parent; + switch (parent.kind) { + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 262 /* EnumMember */: + case 259 /* PropertyAssignment */: + case 175 /* BindingElement */: + return parent.initializer === node; + case 209 /* ExpressionStatement */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 218 /* ReturnStatement */: + case 219 /* WithStatement */: + case 220 /* SwitchStatement */: + case 255 /* CaseClause */: + case 222 /* ThrowStatement */: + case 220 /* SwitchStatement */: + return parent.expression === node; + case 213 /* ForStatement */: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 226 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 225 /* VariableDeclarationList */) || + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 226 /* VariableDeclarationList */) || forInStatement.expression === node; - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: - return node === parent_3.expression; - case 203 /* TemplateSpan */: - return node === parent_3.expression; - case 142 /* ComputedPropertyName */: - return node === parent_3.expression; - case 145 /* Decorator */: - case 253 /* JsxExpression */: - case 252 /* JsxSpreadAttribute */: - case 260 /* SpreadAssignment */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: + return node === parent.expression; + case 204 /* TemplateSpan */: + return node === parent.expression; + case 143 /* ComputedPropertyName */: + return node === parent.expression; + case 146 /* Decorator */: + case 254 /* JsxExpression */: + case 253 /* JsxSpreadAttribute */: + case 261 /* SpreadAssignment */: return true; - case 199 /* ExpressionWithTypeArguments */: - return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); + case 200 /* ExpressionWithTypeArguments */: + return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: - if (isPartOfExpression(parent_3)) { + if (isPartOfExpression(parent)) { return true; } } @@ -7677,7 +7783,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 246 /* ExternalModuleReference */; + return node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 247 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7686,7 +7792,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 246 /* ExternalModuleReference */; + return node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 247 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7704,7 +7810,7 @@ var ts; */ function isRequireCall(expression, checkArgumentIsStringLiteral) { // of the form 'require("name")' - var isRequire = expression.kind === 179 /* CallExpression */ && + var isRequire = expression.kind === 180 /* CallExpression */ && expression.expression.kind === 70 /* Identifier */ && expression.expression.text === "require" && expression.arguments.length === 1; @@ -7720,9 +7826,9 @@ var ts; * This function does not test if the node is in a JavaScript file or not. */ function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 224 /* VariableDeclaration */) { + if (s.valueDeclaration && s.valueDeclaration.kind === 225 /* VariableDeclaration */) { var declaration = s.valueDeclaration; - return declaration.initializer && declaration.initializer.kind === 184 /* FunctionExpression */; + return declaration.initializer && declaration.initializer.kind === 185 /* FunctionExpression */; } return false; } @@ -7733,11 +7839,11 @@ var ts; if (!isInJavaScriptFile(expression)) { return 0 /* None */; } - if (expression.kind !== 192 /* BinaryExpression */) { + if (expression.kind !== 193 /* BinaryExpression */) { return 0 /* None */; } var expr = expression; - if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 177 /* PropertyAccessExpression */) { + if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 178 /* PropertyAccessExpression */) { return 0 /* None */; } var lhs = expr.left; @@ -7755,7 +7861,7 @@ var ts; else if (lhs.expression.kind === 98 /* ThisKeyword */) { return 4 /* ThisProperty */; } - else if (lhs.expression.kind === 177 /* PropertyAccessExpression */) { + else if (lhs.expression.kind === 178 /* PropertyAccessExpression */) { // chained dot, e.g. x.y.z = expr; this var is the 'x.y' part var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 70 /* Identifier */) { @@ -7773,35 +7879,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 236 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 235 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 246 /* ExternalModuleReference */) { + if (reference.kind === 247 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 242 /* ExportDeclaration */) { + if (node.kind === 243 /* ExportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 231 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + if (node.kind === 232 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 235 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 238 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 239 /* NamespaceImport */) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 236 /* ImportDeclaration */ + return node.kind === 237 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } @@ -7809,13 +7915,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 144 /* Parameter */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 259 /* ShorthandPropertyAssignment */: - case 258 /* PropertyAssignment */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 145 /* Parameter */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 260 /* ShorthandPropertyAssignment */: + case 259 /* PropertyAssignment */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -7823,9 +7929,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 275 /* JSDocFunctionType */ && + return node.kind === 276 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 277 /* JSDocConstructorType */; + node.parameters[0].type.kind === 278 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { @@ -7838,7 +7944,7 @@ var ts; var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 282 /* JSDocParameterTag */) { + if (doc.kind === 283 /* JSDocParameterTag */) { if (doc.kind === kind) { result.push(doc); } @@ -7870,9 +7976,9 @@ var ts; // var x = function(name) { return name.length; } var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 206 /* VariableStatement */; + parent.parent.parent.kind === 207 /* VariableStatement */; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 206 /* VariableStatement */; + parent.parent.kind === 207 /* VariableStatement */; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -7881,20 +7987,20 @@ var ts; } // Also recognize when the node is the RHS of an assignment expression var isSourceOfAssignmentExpressionStatement = parent && parent.parent && - parent.kind === 192 /* BinaryExpression */ && + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && - parent.parent.kind === 208 /* ExpressionStatement */; + parent.parent.kind === 209 /* ExpressionStatement */; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 231 /* ModuleDeclaration */ && - parent && parent.kind === 231 /* ModuleDeclaration */; - var isPropertyAssignmentExpression = parent && parent.kind === 258 /* PropertyAssignment */; + var isModuleDeclaration = node.kind === 232 /* ModuleDeclaration */ && + parent && parent.kind === 232 /* ModuleDeclaration */; + var isPropertyAssignmentExpression = parent && parent.kind === 259 /* PropertyAssignment */; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } // Pull parameter comments from declaring function as well - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { cache = ts.concatenate(cache, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { @@ -7908,18 +8014,18 @@ var ts; return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 282 /* JSDocParameterTag */); + var tags = getJSDocTags(func, 283 /* JSDocParameterTag */); if (!param.name) { // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 282 /* JSDocParameterTag */; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 283 /* JSDocParameterTag */; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70 /* Identifier */) { - var name_6 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 282 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); + var name_1 = param.name.text; + return ts.filter(tags, function (tag) { return tag.kind === 283 /* JSDocParameterTag */ && tag.parameterName.text === name_1; }); } else { // TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines @@ -7929,8 +8035,8 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 284 /* JSDocTypeTag */); - if (!tag && node.kind === 144 /* Parameter */) { + var tag = getFirstJSDocTag(node, 285 /* JSDocTypeTag */); + if (!tag && node.kind === 145 /* Parameter */) { var paramTags = getJSDocParameterTags(node); if (paramTags) { tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); @@ -7940,15 +8046,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 281 /* JSDocAugmentsTag */); + return getFirstJSDocTag(node, 282 /* JSDocAugmentsTag */); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 283 /* JSDocReturnTag */); + return getFirstJSDocTag(node, 284 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 285 /* JSDocTemplateTag */); + return getFirstJSDocTag(node, 286 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -7961,8 +8067,8 @@ var ts; ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { if (node && (node.flags & 65536 /* JavaScriptFile */)) { - if (node.type && node.type.kind === 276 /* JSDocVariadicType */ || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 276 /* JSDocVariadicType */; })) { + if (node.type && node.type.kind === 277 /* JSDocVariadicType */ || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 277 /* JSDocVariadicType */; })) { return true; } } @@ -7983,29 +8089,33 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 57 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 42 /* PlusPlusToken */ || unaryOperator === 43 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return parent.initializer === node ? 1 /* Definite */ : 0 /* None */; - case 183 /* ParenthesizedExpression */: - case 175 /* ArrayLiteralExpression */: - case 196 /* SpreadElement */: + case 184 /* ParenthesizedExpression */: + case 176 /* ArrayLiteralExpression */: + case 197 /* SpreadElement */: node = parent; break; - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } - // Fall through - case 258 /* PropertyAssignment */: + node = parent.parent; + break; + case 259 /* PropertyAssignment */: + if (parent.name === node) { + return 0 /* None */; + } node = parent.parent; break; default: @@ -8017,21 +8127,22 @@ var ts; ts.getAssignmentTargetKind = getAssignmentTargetKind; // 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'. + // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ a }] = xxx'. + // (Note that `p` is not a target in the above examples, only `a`.) function isAssignmentTarget(node) { return getAssignmentTargetKind(node) !== 0 /* None */; } ts.isAssignmentTarget = isAssignmentTarget; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 177 /* PropertyAccessExpression */ && node.kind !== 178 /* ElementAccessExpression */) { + if (node.kind !== 178 /* PropertyAccessExpression */ && node.kind !== 179 /* ElementAccessExpression */) { return false; } node = node.parent; - while (node && node.kind === 183 /* ParenthesizedExpression */) { + while (node && node.kind === 184 /* ParenthesizedExpression */) { node = node.parent; } - return node && node.kind === 186 /* DeleteExpression */; + return node && node.kind === 187 /* DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -8045,7 +8156,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2 /* Ambient */) || (node.kind === 262 /* SourceFile */ && node.isDeclarationFile)) { + if (hasModifier(node, 2 /* Ambient */) || (node.kind === 263 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -8059,7 +8170,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 240 /* ImportSpecifier */ || parent.kind === 244 /* ExportSpecifier */) { + if (parent.kind === 241 /* ImportSpecifier */ || parent.kind === 245 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -8072,7 +8183,7 @@ var ts; ts.isDeclarationName = isDeclarationName; function isLiteralComputedPropertyDeclarationName(node) { return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - node.parent.kind === 142 /* ComputedPropertyName */ && + node.parent.kind === 143 /* ComputedPropertyName */ && isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -8080,31 +8191,31 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 261 /* EnumMember */: - case 258 /* PropertyAssignment */: - case 177 /* PropertyAccessExpression */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 262 /* EnumMember */: + case 259 /* PropertyAssignment */: + case 178 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 141 /* QualifiedName */) { + while (parent.kind === 142 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 160 /* TypeQuery */; + return parent.kind === 161 /* TypeQuery */; } return false; - case 174 /* BindingElement */: - case 240 /* ImportSpecifier */: + case 175 /* BindingElement */: + case 241 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 244 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -8120,13 +8231,13 @@ var ts; // export = // export default function isAliasSymbolDeclaration(node) { - return node.kind === 235 /* ImportEqualsDeclaration */ || - node.kind === 234 /* NamespaceExportDeclaration */ || - node.kind === 237 /* ImportClause */ && !!node.name || - node.kind === 238 /* NamespaceImport */ || - node.kind === 240 /* ImportSpecifier */ || - node.kind === 244 /* ExportSpecifier */ || - node.kind === 241 /* ExportAssignment */ && exportAssignmentIsAlias(node); + return node.kind === 236 /* ImportEqualsDeclaration */ || + node.kind === 235 /* NamespaceExportDeclaration */ || + node.kind === 238 /* ImportClause */ && !!node.name || + node.kind === 239 /* NamespaceImport */ || + node.kind === 241 /* ImportSpecifier */ || + node.kind === 245 /* ExportSpecifier */ || + node.kind === 242 /* ExportAssignment */ && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8212,7 +8323,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 71 /* FirstKeyword */ <= token && token <= 140 /* LastKeyword */; + return 71 /* FirstKeyword */ <= token && token <= 141 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -8241,7 +8352,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 142 /* ComputedPropertyName */ && + return name.kind === 143 /* ComputedPropertyName */ && !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } @@ -8256,10 +8367,10 @@ var ts; } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 144 /* Parameter */) { + if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 145 /* Parameter */) { return name.text; } - if (name.kind === 142 /* ComputedPropertyName */) { + if (name.kind === 143 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -8307,11 +8418,11 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 144 /* Parameter */; + return root.kind === 145 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 174 /* BindingElement */) { + while (node.kind === 175 /* BindingElement */) { node = node.parent.parent; } return node; @@ -8319,15 +8430,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 150 /* Constructor */ - || kind === 184 /* FunctionExpression */ - || kind === 226 /* FunctionDeclaration */ - || kind === 185 /* ArrowFunction */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 231 /* ModuleDeclaration */ - || kind === 262 /* SourceFile */; + return kind === 151 /* Constructor */ + || kind === 185 /* FunctionExpression */ + || kind === 227 /* FunctionDeclaration */ + || kind === 186 /* ArrowFunction */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 232 /* ModuleDeclaration */ + || kind === 263 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -8388,23 +8499,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 /* NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 180 /* NewExpression */: + case 181 /* NewExpression */: return hasArguments ? 0 /* Left */ : 1 /* Right */; - case 190 /* PrefixUnaryExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 189 /* AwaitExpression */: - case 193 /* ConditionalExpression */: - case 195 /* YieldExpression */: + case 191 /* PrefixUnaryExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 190 /* AwaitExpression */: + case 194 /* ConditionalExpression */: + case 196 /* YieldExpression */: return 1 /* Right */; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (operator) { case 39 /* AsteriskAsteriskToken */: case 57 /* EqualsToken */: @@ -8428,15 +8539,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 /* NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 192 /* BinaryExpression */) { + if (expression.kind === 193 /* BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 190 /* PrefixUnaryExpression */ || expression.kind === 191 /* PostfixUnaryExpression */) { + else if (expression.kind === 191 /* PrefixUnaryExpression */ || expression.kind === 192 /* PostfixUnaryExpression */) { return expression.operator; } else { @@ -8454,36 +8565,36 @@ var ts; case 85 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 197 /* ClassExpression */: - case 247 /* JsxElement */: - case 248 /* JsxSelfClosingElement */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 198 /* ClassExpression */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: case 11 /* RegularExpressionLiteral */: case 12 /* NoSubstitutionTemplateLiteral */: - case 194 /* TemplateExpression */: - case 183 /* ParenthesizedExpression */: - case 198 /* OmittedExpression */: + case 195 /* TemplateExpression */: + case 184 /* ParenthesizedExpression */: + case 199 /* OmittedExpression */: return 19; - case 181 /* TaggedTemplateExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 182 /* TaggedTemplateExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: return 18; - case 180 /* NewExpression */: + case 181 /* NewExpression */: return hasArguments ? 18 : 17; - case 179 /* CallExpression */: + case 180 /* CallExpression */: return 17; - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return 16; - case 190 /* PrefixUnaryExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 189 /* AwaitExpression */: + case 191 /* PrefixUnaryExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 190 /* AwaitExpression */: return 15; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (operatorKind) { case 50 /* ExclamationToken */: case 51 /* TildeToken */: @@ -8541,11 +8652,11 @@ var ts; default: return -1; } - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return 4; - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return 2; - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return 1; default: return -1; @@ -8568,21 +8679,15 @@ var ts; return modificationCount; } function reattachFileDiagnostics(newFile) { - if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { - return; - } - for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { - var diagnostic = _a[_i]; - diagnostic.file = newFile; - } + ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } function add(diagnostic) { var diagnostics; if (diagnostic.file) { - diagnostics = fileDiagnostics[diagnostic.file.fileName]; + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); if (!diagnostics) { diagnostics = []; - fileDiagnostics[diagnostic.file.fileName] = diagnostics; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); } } else { @@ -8599,16 +8704,16 @@ var ts; function getDiagnostics(fileName) { sortAndDeduplicate(); if (fileName) { - return fileDiagnostics[fileName] || []; + return fileDiagnostics.get(fileName) || []; } var allDiagnostics = []; function pushDiagnostic(d) { allDiagnostics.push(d); } ts.forEach(nonFileDiagnostics, pushDiagnostic); - for (var key in fileDiagnostics) { - ts.forEach(fileDiagnostics[key], pushDiagnostic); - } + fileDiagnostics.forEach(function (diagnostics) { + ts.forEach(diagnostics, pushDiagnostic); + }); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function sortAndDeduplicate() { @@ -8617,9 +8722,9 @@ var ts; } diagnosticsModified = false; nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (var key in fileDiagnostics) { - fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); - } + fileDiagnostics.forEach(function (diagnostics, key) { + fileDiagnostics.set(key, ts.sortAndDeduplicateDiagnostics(diagnostics)); + }); } } ts.createDiagnosticCollection = createDiagnosticCollection; @@ -8629,7 +8734,7 @@ var ts; // the map below must be updated. Note that this regexp *does not* include the 'delete' character. // There is no reason for this other than that JSON.stringify does not handle it either. var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = ts.createMap({ + var escapedCharsMap = ts.createMapFromTemplate({ "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -8653,7 +8758,7 @@ var ts; } ts.escapeString = escapeString; function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); @@ -8811,168 +8916,77 @@ var ts; */ function getSourceFilesToEmit(host, targetSourceFile) { var options = host.getCompilerOptions(); + var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); }; if (options.outFile || options.out) { var moduleKind = ts.getEmitModuleKind(options); - var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; - var sourceFiles = getAllEmittableSourceFiles(); + var moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; // Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified - return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule); + return ts.filter(host.getSourceFiles(), function (sourceFile) { + return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); + }); } else { - var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile]; - return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); }); - } - function getAllEmittableSourceFiles() { - return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles(); + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); }); } } ts.getSourceFilesToEmit = getSourceFilesToEmit; - /** Don't call this for `--outFile`, just for `--outDir` or plain emit. */ - function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) { - return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); }); - } - ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory; - function isNonDeclarationFile(sourceFile) { - return !isDeclarationFile(sourceFile); - } - /** - * Whether a file should be emitted in a non-`--outFile` case. - * Don't emit if source file is a declaration file, or was located under node_modules - */ - function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) { - return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); - } - function isBundleEmitNonExternalModule(sourceFile) { - return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile); + /** Don't call this for `--outFile`, just for `--outDir` or plain emit. `--outFile` needs additional checks. */ + function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) { + return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !isDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); } + ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted; /** - * Iterates over each source file to emit. The source files are expected to have been - * transformed for use by the pretty printer. - * - * Originally part of `forEachExpectedEmitFile`, this functionality was extracted to support - * transformations. + * Iterates over the source files that are expected to have an emit output. * * @param host An EmitHost. - * @param sourceFiles The transformed source files to emit. * @param action The action to execute. + * @param sourceFilesOrTargetSourceFile + * If an array, the full list of source files to emit. + * Else, calls `getSourceFilesToEmit` with the (optional) target source file to determine the list of source files to emit. */ - function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) { + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { + var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); var options = host.getCompilerOptions(); - // Emit on each source file if (options.outFile || options.out) { - onBundledEmit(sourceFiles); + if (sourceFiles.length) { + var jsFilePath = options.outFile || options.out; + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFiles, /*isBundledEmit*/ true, emitOnlyDtsFiles); + } } else { for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { var sourceFile = sourceFiles_2[_i]; - // Don't emit if source file is a declaration file, or was located under node_modules - if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { - onSingleFileEmit(host, sourceFile); - } - } - } - function onSingleFileEmit(host, sourceFile) { - // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. - // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. - // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve - var extension = ".js"; - if (options.jsx === 1 /* Preserve */) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1 /* JSX */) { - // TypeScript source file preserving JSX syntax - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], /*isBundledEmit*/ false); - } - function onBundledEmit(sourceFiles) { - if (sourceFiles.length) { - var jsFilePath = options.outFile || options.out; + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, /*isBundledEmit*/ true); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, [sourceFile], /*isBundledEmit*/ false, emitOnlyDtsFiles); } } } - ts.forEachTransformedEmitFile = forEachTransformedEmitFile; + ts.forEachEmittedFile = forEachEmittedFile; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - /** - * Iterates over the source files that are expected to have an emit output. This function - * is used by the legacy emitter and the declaration emitter and should not be used by - * the tree transforming emitter. - * - * @param host An EmitHost. - * @param action The action to execute. - * @param targetSourceFile An optional target source file to emit. - */ - function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) { - var options = host.getCompilerOptions(); - // Emit on each source file - if (options.outFile || options.out) { - onBundledEmit(host); - } - else { - var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile]; - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; - if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) { - onSingleFileEmit(host, sourceFile); + // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. + // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. + // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve + function getOutputExtension(sourceFile, options) { + if (options.jsx === 1 /* Preserve */) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + return ".jsx"; } } - } - function onSingleFileEmit(host, sourceFile) { - // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. - // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. - // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve - var extension = ".js"; - if (options.jsx === 1 /* Preserve */) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1 /* JSX */) { - // TypeScript source file preserving JSX syntax - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: declarationFilePath - }; - action(emitFileNames, [sourceFile], /*isBundledEmit*/ false, emitOnlyDtsFiles); - } - function onBundledEmit(host) { - // Can emit only sources that are not declaration file and are either non module code or module with - // --module or --target es6 specified. Files included by searching under node_modules are also not emitted. - var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) && - !host.isSourceFileFromExternalLibrary(sourceFile) && - (!ts.isExternalModule(sourceFile) || - !!ts.getEmitModuleKind(options)); }); - if (bundledSources.length) { - var jsFilePath = options.outFile || options.out; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined - }; - action(emitFileNames, bundledSources, /*isBundledEmit*/ true, emitOnlyDtsFiles); + else if (sourceFile.languageVariant === 1 /* JSX */) { + // TypeScript source file preserving JSX syntax + return ".jsx"; } } + return ".js"; } - ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); var commonSourceDirectory = host.getCommonSourceDirectory(); @@ -8997,7 +9011,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 150 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 151 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -9039,10 +9053,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 151 /* GetAccessor */) { + if (accessor.kind === 152 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 152 /* SetAccessor */) { + else if (accessor.kind === 153 /* SetAccessor */) { setAccessor = accessor; } else { @@ -9051,7 +9065,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 151 /* GetAccessor */ || member.kind === 152 /* SetAccessor */) + if ((member.kind === 152 /* GetAccessor */ || member.kind === 153 /* SetAccessor */) && hasModifier(member, 32 /* Static */) === hasModifier(accessor, 32 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -9062,10 +9076,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 151 /* GetAccessor */ && !getAccessor) { + if (member.kind === 152 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 152 /* SetAccessor */ && !setAccessor) { + if (member.kind === 153 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -9328,7 +9342,7 @@ var ts; ts.isAssignmentOperator = isAssignmentOperator; /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */ function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 199 /* ExpressionWithTypeArguments */ && + if (node.kind === 200 /* ExpressionWithTypeArguments */ && node.parent.token === 84 /* ExtendsKeyword */ && isClassLike(node.parent.parent)) { return node.parent.parent; @@ -9346,8 +9360,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 176 /* ObjectLiteralExpression */ - || kind === 175 /* ArrayLiteralExpression */; + return kind === 177 /* ObjectLiteralExpression */ + || kind === 176 /* ArrayLiteralExpression */; } return false; } @@ -9375,29 +9389,33 @@ var ts; ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isEntityNameExpression(node) { return node.kind === 70 /* Identifier */ || - node.kind === 177 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression); + node.kind === 178 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression); } ts.isEntityNameExpression = isEntityNameExpression; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 176 /* ObjectLiteralExpression */) { + if (kind === 177 /* ObjectLiteralExpression */) { return expression.properties.length === 0; } - if (kind === 175 /* ArrayLiteralExpression */) { + if (kind === 176 /* ArrayLiteralExpression */) { return expression.elements.length === 0; } return false; } ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; + return isExportDefaultSymbol(symbol) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function isExportDefaultSymbol(symbol) { + return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512 /* Default */); + } + ts.isExportDefaultSymbol = isExportDefaultSymbol; /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTypeScriptExtension(fileName) { return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); @@ -9509,39 +9527,39 @@ var ts; || kind === 94 /* NullKeyword */) { return true; } - else if (kind === 177 /* PropertyAccessExpression */) { + else if (kind === 178 /* PropertyAccessExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 178 /* ElementAccessExpression */) { + else if (kind === 179 /* ElementAccessExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1) && isSimpleExpressionWorker(node.argumentExpression, depth + 1); } - else if (kind === 190 /* PrefixUnaryExpression */ - || kind === 191 /* PostfixUnaryExpression */) { + else if (kind === 191 /* PrefixUnaryExpression */ + || kind === 192 /* PostfixUnaryExpression */) { return isSimpleExpressionWorker(node.operand, depth + 1); } - else if (kind === 192 /* BinaryExpression */) { + else if (kind === 193 /* BinaryExpression */) { return node.operatorToken.kind !== 39 /* AsteriskAsteriskToken */ && isSimpleExpressionWorker(node.left, depth + 1) && isSimpleExpressionWorker(node.right, depth + 1); } - else if (kind === 193 /* ConditionalExpression */) { + else if (kind === 194 /* ConditionalExpression */) { return isSimpleExpressionWorker(node.condition, depth + 1) && isSimpleExpressionWorker(node.whenTrue, depth + 1) && isSimpleExpressionWorker(node.whenFalse, depth + 1); } - else if (kind === 188 /* VoidExpression */ - || kind === 187 /* TypeOfExpression */ - || kind === 186 /* DeleteExpression */) { + else if (kind === 189 /* VoidExpression */ + || kind === 188 /* TypeOfExpression */ + || kind === 187 /* DeleteExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 175 /* ArrayLiteralExpression */) { + else if (kind === 176 /* ArrayLiteralExpression */) { return node.elements.length === 0; } - else if (kind === 176 /* ObjectLiteralExpression */) { + else if (kind === 177 /* ObjectLiteralExpression */) { return node.properties.length === 0; } - else if (kind === 179 /* CallExpression */) { + else if (kind === 180 /* CallExpression */) { if (!isSimpleExpressionWorker(node.expression, depth + 1)) { return false; } @@ -9556,16 +9574,19 @@ var ts; } return false; } - var syntaxKindCache = ts.createMap(); + var syntaxKindCache = []; function formatSyntaxKind(kind) { var syntaxKindEnum = ts.SyntaxKind; if (syntaxKindEnum) { - if (syntaxKindCache[kind]) { - return syntaxKindCache[kind]; + var cached = syntaxKindCache[kind]; + if (cached !== undefined) { + return cached; } - for (var name_7 in syntaxKindEnum) { - if (syntaxKindEnum[name_7] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name_7 + ")"; + for (var name in syntaxKindEnum) { + if (syntaxKindEnum[name] === kind) { + var result = kind + " (" + name + ")"; + syntaxKindCache[kind] = result; + return result; } } } @@ -9708,8 +9729,8 @@ var ts; var parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 230 /* EnumDeclaration */: - case 231 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -9730,7 +9751,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* ClassDeclaration */ && declaration !== node) { + if (declaration.kind === 228 /* ClassDeclaration */ && declaration !== node) { return true; } } @@ -9796,7 +9817,7 @@ var ts; } ts.isIdentifier = isIdentifier; function isVoidExpression(node) { - return node.kind === 188 /* VoidExpression */; + return node.kind === 189 /* VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { @@ -9811,16 +9832,16 @@ var ts; ts.isModifier = isModifier; // Names function isQualifiedName(node) { - return node.kind === 141 /* QualifiedName */; + return node.kind === 142 /* QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 142 /* ComputedPropertyName */; + return node.kind === 143 /* ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; function isEntityName(node) { var kind = node.kind; - return kind === 141 /* QualifiedName */ + return kind === 142 /* QualifiedName */ || kind === 70 /* Identifier */; } ts.isEntityName = isEntityName; @@ -9829,7 +9850,7 @@ var ts; return kind === 70 /* Identifier */ || kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */ - || kind === 142 /* ComputedPropertyName */; + || kind === 143 /* ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isModuleName(node) { @@ -9841,61 +9862,61 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 70 /* Identifier */ - || kind === 172 /* ObjectBindingPattern */ - || kind === 173 /* ArrayBindingPattern */; + || kind === 173 /* ObjectBindingPattern */ + || kind === 174 /* ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Signature elements function isTypeParameter(node) { - return node.kind === 143 /* TypeParameter */; + return node.kind === 144 /* TypeParameter */; } ts.isTypeParameter = isTypeParameter; function isParameter(node) { - return node.kind === 144 /* Parameter */; + return node.kind === 145 /* Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 145 /* Decorator */; + return node.kind === 146 /* Decorator */; } ts.isDecorator = isDecorator; // Type members function isMethodDeclaration(node) { - return node.kind === 149 /* MethodDeclaration */; + return node.kind === 150 /* MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassElement(node) { var kind = node.kind; - return kind === 150 /* Constructor */ - || kind === 147 /* PropertyDeclaration */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 155 /* IndexSignature */ - || kind === 204 /* SemicolonClassElement */; + return kind === 151 /* Constructor */ + || kind === 148 /* PropertyDeclaration */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 156 /* IndexSignature */ + || kind === 205 /* SemicolonClassElement */; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 258 /* PropertyAssignment */ - || kind === 259 /* ShorthandPropertyAssignment */ - || kind === 260 /* SpreadAssignment */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 245 /* MissingDeclaration */; + return kind === 259 /* PropertyAssignment */ + || kind === 260 /* ShorthandPropertyAssignment */ + || kind === 261 /* SpreadAssignment */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 246 /* MissingDeclaration */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type function isTypeNodeKind(kind) { - return (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */) + return (kind >= 157 /* FirstTypeNode */ && kind <= 172 /* LastTypeNode */) || kind === 118 /* AnyKeyword */ || kind === 132 /* NumberKeyword */ || kind === 121 /* BooleanKeyword */ - || kind === 134 /* StringKeyword */ - || kind === 135 /* SymbolKeyword */ + || kind === 135 /* StringKeyword */ + || kind === 136 /* SymbolKeyword */ || kind === 104 /* VoidKeyword */ || kind === 129 /* NeverKeyword */ - || kind === 199 /* ExpressionWithTypeArguments */; + || kind === 200 /* ExpressionWithTypeArguments */; } /** * Node test that determines whether a node is a valid type node. @@ -9908,36 +9929,36 @@ var ts; ts.isTypeNode = isTypeNode; // Binding patterns function isArrayBindingPattern(node) { - return node.kind === 173 /* ArrayBindingPattern */; + return node.kind === 174 /* ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isObjectBindingPattern(node) { - return node.kind === 172 /* ObjectBindingPattern */; + return node.kind === 173 /* ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 173 /* ArrayBindingPattern */ - || kind === 172 /* ObjectBindingPattern */; + return kind === 174 /* ArrayBindingPattern */ + || kind === 173 /* ObjectBindingPattern */; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 175 /* ArrayLiteralExpression */ - || kind === 176 /* ObjectLiteralExpression */; + return kind === 176 /* ArrayLiteralExpression */ + || kind === 177 /* ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { - return node.kind === 174 /* BindingElement */; + return node.kind === 175 /* BindingElement */; } ts.isBindingElement = isBindingElement; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 174 /* BindingElement */ - || kind === 198 /* OmittedExpression */; + return kind === 175 /* BindingElement */ + || kind === 199 /* OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -9945,9 +9966,9 @@ var ts; */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 224 /* VariableDeclaration */: - case 144 /* Parameter */: - case 174 /* BindingElement */: + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 175 /* BindingElement */: return true; } return false; @@ -9966,8 +9987,8 @@ var ts; */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 172 /* ObjectBindingPattern */: - case 176 /* ObjectLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 177 /* ObjectLiteralExpression */: return true; } return false; @@ -9978,8 +9999,8 @@ var ts; */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: return true; } return false; @@ -9987,86 +10008,86 @@ var ts; ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; // Expression function isArrayLiteralExpression(node) { - return node.kind === 175 /* ArrayLiteralExpression */; + return node.kind === 176 /* ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 176 /* ObjectLiteralExpression */; + return node.kind === 177 /* ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 177 /* PropertyAccessExpression */; + return node.kind === 178 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 178 /* ElementAccessExpression */; + return node.kind === 179 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isBinaryExpression(node) { - return node.kind === 192 /* BinaryExpression */; + return node.kind === 193 /* BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 193 /* ConditionalExpression */; + return node.kind === 194 /* ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isCallExpression(node) { - return node.kind === 179 /* CallExpression */; + return node.kind === 180 /* CallExpression */; } ts.isCallExpression = isCallExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 194 /* TemplateExpression */ + return kind === 195 /* TemplateExpression */ || kind === 12 /* NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; function isSpreadExpression(node) { - return node.kind === 196 /* SpreadElement */; + return node.kind === 197 /* SpreadElement */; } ts.isSpreadExpression = isSpreadExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 199 /* ExpressionWithTypeArguments */; + return node.kind === 200 /* ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isLeftHandSideExpressionKind(kind) { - return kind === 177 /* PropertyAccessExpression */ - || kind === 178 /* ElementAccessExpression */ - || kind === 180 /* NewExpression */ - || kind === 179 /* CallExpression */ - || kind === 247 /* JsxElement */ - || kind === 248 /* JsxSelfClosingElement */ - || kind === 181 /* TaggedTemplateExpression */ - || kind === 175 /* ArrayLiteralExpression */ - || kind === 183 /* ParenthesizedExpression */ - || kind === 176 /* ObjectLiteralExpression */ - || kind === 197 /* ClassExpression */ - || kind === 184 /* FunctionExpression */ + return kind === 178 /* PropertyAccessExpression */ + || kind === 179 /* ElementAccessExpression */ + || kind === 181 /* NewExpression */ + || kind === 180 /* CallExpression */ + || kind === 248 /* JsxElement */ + || kind === 249 /* JsxSelfClosingElement */ + || kind === 182 /* TaggedTemplateExpression */ + || kind === 176 /* ArrayLiteralExpression */ + || kind === 184 /* ParenthesizedExpression */ + || kind === 177 /* ObjectLiteralExpression */ + || kind === 198 /* ClassExpression */ + || kind === 185 /* FunctionExpression */ || kind === 70 /* Identifier */ || kind === 11 /* RegularExpressionLiteral */ || kind === 8 /* NumericLiteral */ || kind === 9 /* StringLiteral */ || kind === 12 /* NoSubstitutionTemplateLiteral */ - || kind === 194 /* TemplateExpression */ + || kind === 195 /* TemplateExpression */ || kind === 85 /* FalseKeyword */ || kind === 94 /* NullKeyword */ || kind === 98 /* ThisKeyword */ || kind === 100 /* TrueKeyword */ || kind === 96 /* SuperKeyword */ - || kind === 201 /* NonNullExpression */ - || kind === 202 /* MetaProperty */; + || kind === 202 /* NonNullExpression */ + || kind === 203 /* MetaProperty */; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isUnaryExpressionKind(kind) { - return kind === 190 /* PrefixUnaryExpression */ - || kind === 191 /* PostfixUnaryExpression */ - || kind === 186 /* DeleteExpression */ - || kind === 187 /* TypeOfExpression */ - || kind === 188 /* VoidExpression */ - || kind === 189 /* AwaitExpression */ - || kind === 182 /* TypeAssertionExpression */ + return kind === 191 /* PrefixUnaryExpression */ + || kind === 192 /* PostfixUnaryExpression */ + || kind === 187 /* DeleteExpression */ + || kind === 188 /* TypeOfExpression */ + || kind === 189 /* VoidExpression */ + || kind === 190 /* AwaitExpression */ + || kind === 183 /* TypeAssertionExpression */ || isLeftHandSideExpressionKind(kind); } function isUnaryExpression(node) { @@ -10074,13 +10095,13 @@ var ts; } ts.isUnaryExpression = isUnaryExpression; function isExpressionKind(kind) { - return kind === 193 /* ConditionalExpression */ - || kind === 195 /* YieldExpression */ - || kind === 185 /* ArrowFunction */ - || kind === 192 /* BinaryExpression */ - || kind === 196 /* SpreadElement */ - || kind === 200 /* AsExpression */ - || kind === 198 /* OmittedExpression */ + return kind === 194 /* ConditionalExpression */ + || kind === 196 /* YieldExpression */ + || kind === 186 /* ArrowFunction */ + || kind === 193 /* BinaryExpression */ + || kind === 197 /* SpreadElement */ + || kind === 201 /* AsExpression */ + || kind === 199 /* OmittedExpression */ || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10089,16 +10110,16 @@ var ts; ts.isExpression = isExpression; function isAssertionExpression(node) { var kind = node.kind; - return kind === 182 /* TypeAssertionExpression */ - || kind === 200 /* AsExpression */; + return kind === 183 /* TypeAssertionExpression */ + || kind === 201 /* AsExpression */; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 295 /* PartiallyEmittedExpression */; + return node.kind === 296 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 294 /* NotEmittedStatement */; + return node.kind === 295 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10107,17 +10128,17 @@ var ts; } ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isOmittedExpression(node) { - return node.kind === 198 /* OmittedExpression */; + return node.kind === 199 /* OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; // Misc function isTemplateSpan(node) { - return node.kind === 203 /* TemplateSpan */; + return node.kind === 204 /* TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; // Element function isBlock(node) { - return node.kind === 205 /* Block */; + return node.kind === 206 /* Block */; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -10135,121 +10156,121 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 224 /* VariableDeclaration */; + return node.kind === 225 /* VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 225 /* VariableDeclarationList */; + return node.kind === 226 /* VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 233 /* CaseBlock */; + return node.kind === 234 /* CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 232 /* ModuleBlock */ - || kind === 231 /* ModuleDeclaration */; + return kind === 233 /* ModuleBlock */ + || kind === 232 /* ModuleDeclaration */; } ts.isModuleBody = isModuleBody; function isImportEqualsDeclaration(node) { - return node.kind === 235 /* ImportEqualsDeclaration */; + return node.kind === 236 /* ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 237 /* ImportClause */; + return node.kind === 238 /* ImportClause */; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 239 /* NamedImports */ - || kind === 238 /* NamespaceImport */; + return kind === 240 /* NamedImports */ + || kind === 239 /* NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 240 /* ImportSpecifier */; + return node.kind === 241 /* ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 243 /* NamedExports */; + return node.kind === 244 /* NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 244 /* ExportSpecifier */; + return node.kind === 245 /* ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 231 /* ModuleDeclaration */ || node.kind === 230 /* EnumDeclaration */; + return node.kind === 232 /* ModuleDeclaration */ || node.kind === 231 /* EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 185 /* ArrowFunction */ - || kind === 174 /* BindingElement */ - || kind === 227 /* ClassDeclaration */ - || kind === 197 /* ClassExpression */ - || kind === 150 /* Constructor */ - || kind === 230 /* EnumDeclaration */ - || kind === 261 /* EnumMember */ - || kind === 244 /* ExportSpecifier */ - || kind === 226 /* FunctionDeclaration */ - || kind === 184 /* FunctionExpression */ - || kind === 151 /* GetAccessor */ - || kind === 237 /* ImportClause */ - || kind === 235 /* ImportEqualsDeclaration */ - || kind === 240 /* ImportSpecifier */ - || kind === 228 /* InterfaceDeclaration */ - || kind === 149 /* MethodDeclaration */ - || kind === 148 /* MethodSignature */ - || kind === 231 /* ModuleDeclaration */ - || kind === 234 /* NamespaceExportDeclaration */ - || kind === 238 /* NamespaceImport */ - || kind === 144 /* Parameter */ - || kind === 258 /* PropertyAssignment */ - || kind === 147 /* PropertyDeclaration */ - || kind === 146 /* PropertySignature */ - || kind === 152 /* SetAccessor */ - || kind === 259 /* ShorthandPropertyAssignment */ - || kind === 229 /* TypeAliasDeclaration */ - || kind === 143 /* TypeParameter */ - || kind === 224 /* VariableDeclaration */ - || kind === 286 /* JSDocTypedefTag */; + return kind === 186 /* ArrowFunction */ + || kind === 175 /* BindingElement */ + || kind === 228 /* ClassDeclaration */ + || kind === 198 /* ClassExpression */ + || kind === 151 /* Constructor */ + || kind === 231 /* EnumDeclaration */ + || kind === 262 /* EnumMember */ + || kind === 245 /* ExportSpecifier */ + || kind === 227 /* FunctionDeclaration */ + || kind === 185 /* FunctionExpression */ + || kind === 152 /* GetAccessor */ + || kind === 238 /* ImportClause */ + || kind === 236 /* ImportEqualsDeclaration */ + || kind === 241 /* ImportSpecifier */ + || kind === 229 /* InterfaceDeclaration */ + || kind === 150 /* MethodDeclaration */ + || kind === 149 /* MethodSignature */ + || kind === 232 /* ModuleDeclaration */ + || kind === 235 /* NamespaceExportDeclaration */ + || kind === 239 /* NamespaceImport */ + || kind === 145 /* Parameter */ + || kind === 259 /* PropertyAssignment */ + || kind === 148 /* PropertyDeclaration */ + || kind === 147 /* PropertySignature */ + || kind === 153 /* SetAccessor */ + || kind === 260 /* ShorthandPropertyAssignment */ + || kind === 230 /* TypeAliasDeclaration */ + || kind === 144 /* TypeParameter */ + || kind === 225 /* VariableDeclaration */ + || kind === 287 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { - return kind === 226 /* FunctionDeclaration */ - || kind === 245 /* MissingDeclaration */ - || kind === 227 /* ClassDeclaration */ - || kind === 228 /* InterfaceDeclaration */ - || kind === 229 /* TypeAliasDeclaration */ - || kind === 230 /* EnumDeclaration */ - || kind === 231 /* ModuleDeclaration */ - || kind === 236 /* ImportDeclaration */ - || kind === 235 /* ImportEqualsDeclaration */ - || kind === 242 /* ExportDeclaration */ - || kind === 241 /* ExportAssignment */ - || kind === 234 /* NamespaceExportDeclaration */; + return kind === 227 /* FunctionDeclaration */ + || kind === 246 /* MissingDeclaration */ + || kind === 228 /* ClassDeclaration */ + || kind === 229 /* InterfaceDeclaration */ + || kind === 230 /* TypeAliasDeclaration */ + || kind === 231 /* EnumDeclaration */ + || kind === 232 /* ModuleDeclaration */ + || kind === 237 /* ImportDeclaration */ + || kind === 236 /* ImportEqualsDeclaration */ + || kind === 243 /* ExportDeclaration */ + || kind === 242 /* ExportAssignment */ + || kind === 235 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 216 /* BreakStatement */ - || kind === 215 /* ContinueStatement */ - || kind === 223 /* DebuggerStatement */ - || kind === 210 /* DoStatement */ - || kind === 208 /* ExpressionStatement */ - || kind === 207 /* EmptyStatement */ - || kind === 213 /* ForInStatement */ - || kind === 214 /* ForOfStatement */ - || kind === 212 /* ForStatement */ - || kind === 209 /* IfStatement */ - || kind === 220 /* LabeledStatement */ - || kind === 217 /* ReturnStatement */ - || kind === 219 /* SwitchStatement */ - || kind === 221 /* ThrowStatement */ - || kind === 222 /* TryStatement */ - || kind === 206 /* VariableStatement */ - || kind === 211 /* WhileStatement */ - || kind === 218 /* WithStatement */ - || kind === 294 /* NotEmittedStatement */ - || kind === 297 /* EndOfDeclarationMarker */ - || kind === 296 /* MergeDeclarationMarker */; + return kind === 217 /* BreakStatement */ + || kind === 216 /* ContinueStatement */ + || kind === 224 /* DebuggerStatement */ + || kind === 211 /* DoStatement */ + || kind === 209 /* ExpressionStatement */ + || kind === 208 /* EmptyStatement */ + || kind === 214 /* ForInStatement */ + || kind === 215 /* ForOfStatement */ + || kind === 213 /* ForStatement */ + || kind === 210 /* IfStatement */ + || kind === 221 /* LabeledStatement */ + || kind === 218 /* ReturnStatement */ + || kind === 220 /* SwitchStatement */ + || kind === 222 /* ThrowStatement */ + || kind === 223 /* TryStatement */ + || kind === 207 /* VariableStatement */ + || kind === 212 /* WhileStatement */ + || kind === 219 /* WithStatement */ + || kind === 295 /* NotEmittedStatement */ + || kind === 298 /* EndOfDeclarationMarker */ + || kind === 297 /* MergeDeclarationMarker */; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10270,93 +10291,93 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 205 /* Block */; + || kind === 206 /* Block */; } ts.isStatement = isStatement; // Module references function isModuleReference(node) { var kind = node.kind; - return kind === 246 /* ExternalModuleReference */ - || kind === 141 /* QualifiedName */ + return kind === 247 /* ExternalModuleReference */ + || kind === 142 /* QualifiedName */ || kind === 70 /* Identifier */; } ts.isModuleReference = isModuleReference; // JSX function isJsxOpeningElement(node) { - return node.kind === 249 /* JsxOpeningElement */; + return node.kind === 250 /* JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 250 /* JsxClosingElement */; + return node.kind === 251 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { var kind = node.kind; return kind === 98 /* ThisKeyword */ || kind === 70 /* Identifier */ - || kind === 177 /* PropertyAccessExpression */; + || kind === 178 /* PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 247 /* JsxElement */ - || kind === 253 /* JsxExpression */ - || kind === 248 /* JsxSelfClosingElement */ + return kind === 248 /* JsxElement */ + || kind === 254 /* JsxExpression */ + || kind === 249 /* JsxSelfClosingElement */ || kind === 10 /* JsxText */; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 251 /* JsxAttribute */ - || kind === 252 /* JsxSpreadAttribute */; + return kind === 252 /* JsxAttribute */ + || kind === 253 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 252 /* JsxSpreadAttribute */; + return node.kind === 253 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 251 /* JsxAttribute */; + return node.kind === 252 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 253 /* JsxExpression */; + || kind === 254 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 254 /* CaseClause */ - || kind === 255 /* DefaultClause */; + return kind === 255 /* CaseClause */ + || kind === 256 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 256 /* HeritageClause */; + return node.kind === 257 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 257 /* CatchClause */; + return node.kind === 258 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 258 /* PropertyAssignment */; + return node.kind === 259 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 259 /* ShorthandPropertyAssignment */; + return node.kind === 260 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; // Enum function isEnumMember(node) { - return node.kind === 261 /* EnumMember */; + return node.kind === 262 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 262 /* SourceFile */; + return node.kind === 263 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -10586,9 +10607,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 143 /* TypeParameter */) { + if (d && d.kind === 144 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 228 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 229 /* InterfaceDeclaration */) { return current; } } @@ -10596,11 +10617,11 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 150 /* Constructor */ && ts.isClassLike(node.parent.parent); + return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 151 /* Constructor */ && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 174 /* BindingElement */ || ts.isBindingPattern(node))) { + while (node && (node.kind === 175 /* BindingElement */ || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -10608,14 +10629,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 224 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 225 /* VariableDeclarationList */) { + if (node && node.kind === 226 /* VariableDeclarationList */) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 206 /* VariableStatement */) { + if (node && node.kind === 207 /* VariableStatement */) { flags |= ts.getModifierFlags(node); } return flags; @@ -10631,14 +10652,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 224 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 225 /* VariableDeclarationList */) { + if (node && node.kind === 226 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 206 /* VariableStatement */) { + if (node && node.kind === 207 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -10707,7 +10728,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, location, flags) { - var ConstructorForKind = kind === 262 /* SourceFile */ + var ConstructorForKind = kind === 263 /* SourceFile */ ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); var node = location @@ -10890,7 +10911,7 @@ var ts; ts.createNull = createNull; // Names function createComputedPropertyName(expression, location) { - var node = createNode(142 /* ComputedPropertyName */, location); + var node = createNode(143 /* ComputedPropertyName */, location); node.expression = expression; return node; } @@ -10904,7 +10925,7 @@ var ts; ts.updateComputedPropertyName = updateComputedPropertyName; // Signature elements function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) { - var node = createNode(144 /* Parameter */, location, flags); + var node = createNode(145 /* Parameter */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.dotDotDotToken = dotDotDotToken; @@ -10924,7 +10945,7 @@ var ts; ts.updateParameter = updateParameter; // Type members function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) { - var node = createNode(147 /* PropertyDeclaration */, location); + var node = createNode(148 /* PropertyDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10942,7 +10963,7 @@ var ts; } ts.updateProperty = updateProperty; function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(149 /* MethodDeclaration */, location, flags); + var node = createNode(150 /* MethodDeclaration */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -10962,7 +10983,7 @@ var ts; } ts.updateMethod = updateMethod; function createConstructor(decorators, modifiers, parameters, body, location, flags) { - var node = createNode(150 /* Constructor */, location, flags); + var node = createNode(151 /* Constructor */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.typeParameters = undefined; @@ -10980,7 +11001,7 @@ var ts; } ts.updateConstructor = updateConstructor; function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) { - var node = createNode(151 /* GetAccessor */, location, flags); + var node = createNode(152 /* GetAccessor */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10999,7 +11020,7 @@ var ts; } ts.updateGetAccessor = updateGetAccessor; function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) { - var node = createNode(152 /* SetAccessor */, location, flags); + var node = createNode(153 /* SetAccessor */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -11018,7 +11039,7 @@ var ts; ts.updateSetAccessor = updateSetAccessor; // Binding Patterns function createObjectBindingPattern(elements, location) { - var node = createNode(172 /* ObjectBindingPattern */, location); + var node = createNode(173 /* ObjectBindingPattern */, location); node.elements = createNodeArray(elements); return node; } @@ -11031,7 +11052,7 @@ var ts; } ts.updateObjectBindingPattern = updateObjectBindingPattern; function createArrayBindingPattern(elements, location) { - var node = createNode(173 /* ArrayBindingPattern */, location); + var node = createNode(174 /* ArrayBindingPattern */, location); node.elements = createNodeArray(elements); return node; } @@ -11044,7 +11065,7 @@ var ts; } ts.updateArrayBindingPattern = updateArrayBindingPattern; function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) { - var node = createNode(174 /* BindingElement */, location); + var node = createNode(175 /* BindingElement */, location); node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; node.dotDotDotToken = dotDotDotToken; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -11061,7 +11082,7 @@ var ts; ts.updateBindingElement = updateBindingElement; // Expression function createArrayLiteral(elements, location, multiLine) { - var node = createNode(175 /* ArrayLiteralExpression */, location); + var node = createNode(176 /* ArrayLiteralExpression */, location); node.elements = parenthesizeListElements(createNodeArray(elements)); if (multiLine) { node.multiLine = true; @@ -11077,7 +11098,7 @@ var ts; } ts.updateArrayLiteral = updateArrayLiteral; function createObjectLiteral(properties, location, multiLine) { - var node = createNode(176 /* ObjectLiteralExpression */, location); + var node = createNode(177 /* ObjectLiteralExpression */, location); node.properties = createNodeArray(properties); if (multiLine) { node.multiLine = true; @@ -11093,7 +11114,7 @@ var ts; } ts.updateObjectLiteral = updateObjectLiteral; function createPropertyAccess(expression, name, location, flags) { - var node = createNode(177 /* PropertyAccessExpression */, location, flags); + var node = createNode(178 /* PropertyAccessExpression */, location, flags); node.expression = parenthesizeForAccess(expression); (node.emitNode || (node.emitNode = {})).flags |= 65536 /* NoIndentation */; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -11111,7 +11132,7 @@ var ts; } ts.updatePropertyAccess = updatePropertyAccess; function createElementAccess(expression, index, location) { - var node = createNode(178 /* ElementAccessExpression */, location); + var node = createNode(179 /* ElementAccessExpression */, location); node.expression = parenthesizeForAccess(expression); node.argumentExpression = typeof index === "number" ? createLiteral(index) : index; return node; @@ -11125,7 +11146,7 @@ var ts; } ts.updateElementAccess = updateElementAccess; function createCall(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(179 /* CallExpression */, location, flags); + var node = createNode(180 /* CallExpression */, location, flags); node.expression = parenthesizeForAccess(expression); if (typeArguments) { node.typeArguments = createNodeArray(typeArguments); @@ -11142,7 +11163,7 @@ var ts; } ts.updateCall = updateCall; function createNew(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(180 /* NewExpression */, location, flags); + var node = createNode(181 /* NewExpression */, location, flags); node.expression = parenthesizeForNew(expression); node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; @@ -11157,7 +11178,7 @@ var ts; } ts.updateNew = updateNew; function createTaggedTemplate(tag, template, location) { - var node = createNode(181 /* TaggedTemplateExpression */, location); + var node = createNode(182 /* TaggedTemplateExpression */, location); node.tag = parenthesizeForAccess(tag); node.template = template; return node; @@ -11171,7 +11192,7 @@ var ts; } ts.updateTaggedTemplate = updateTaggedTemplate; function createParen(expression, location) { - var node = createNode(183 /* ParenthesizedExpression */, location); + var node = createNode(184 /* ParenthesizedExpression */, location); node.expression = expression; return node; } @@ -11184,7 +11205,7 @@ var ts; } ts.updateParen = updateParen; function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(184 /* FunctionExpression */, location, flags); + var node = createNode(185 /* FunctionExpression */, location, flags); node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -11203,7 +11224,7 @@ var ts; } ts.updateFunctionExpression = updateFunctionExpression; function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) { - var node = createNode(185 /* ArrowFunction */, location, flags); + var node = createNode(186 /* ArrowFunction */, location, flags); node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; node.parameters = createNodeArray(parameters); @@ -11221,7 +11242,7 @@ var ts; } ts.updateArrowFunction = updateArrowFunction; function createDelete(expression, location) { - var node = createNode(186 /* DeleteExpression */, location); + var node = createNode(187 /* DeleteExpression */, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11234,7 +11255,7 @@ var ts; } ts.updateDelete = updateDelete; function createTypeOf(expression, location) { - var node = createNode(187 /* TypeOfExpression */, location); + var node = createNode(188 /* TypeOfExpression */, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11247,7 +11268,7 @@ var ts; } ts.updateTypeOf = updateTypeOf; function createVoid(expression, location) { - var node = createNode(188 /* VoidExpression */, location); + var node = createNode(189 /* VoidExpression */, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11260,7 +11281,7 @@ var ts; } ts.updateVoid = updateVoid; function createAwait(expression, location) { - var node = createNode(189 /* AwaitExpression */, location); + var node = createNode(190 /* AwaitExpression */, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11273,7 +11294,7 @@ var ts; } ts.updateAwait = updateAwait; function createPrefix(operator, operand, location) { - var node = createNode(190 /* PrefixUnaryExpression */, location); + var node = createNode(191 /* PrefixUnaryExpression */, location); node.operator = operator; node.operand = parenthesizePrefixOperand(operand); return node; @@ -11287,7 +11308,7 @@ var ts; } ts.updatePrefix = updatePrefix; function createPostfix(operand, operator, location) { - var node = createNode(191 /* PostfixUnaryExpression */, location); + var node = createNode(192 /* PostfixUnaryExpression */, location); node.operand = parenthesizePostfixOperand(operand); node.operator = operator; return node; @@ -11303,7 +11324,7 @@ var ts; function createBinary(left, operator, right, location) { var operatorToken = typeof operator === "number" ? createToken(operator) : operator; var operatorKind = operatorToken.kind; - var node = createNode(192 /* BinaryExpression */, location); + var node = createNode(193 /* BinaryExpression */, location); node.left = parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined); node.operatorToken = operatorToken; node.right = parenthesizeBinaryOperand(operatorKind, right, /*isLeftSideOfBinary*/ false, node.left); @@ -11318,7 +11339,7 @@ var ts; } ts.updateBinary = updateBinary; function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { - var node = createNode(193 /* ConditionalExpression */, whenFalse ? location : colonTokenOrLocation); + var node = createNode(194 /* ConditionalExpression */, whenFalse ? location : colonTokenOrLocation); node.condition = parenthesizeForConditionalHead(condition); if (whenFalse) { // second overload @@ -11345,7 +11366,7 @@ var ts; } ts.updateConditional = updateConditional; function createTemplateExpression(head, templateSpans, location) { - var node = createNode(194 /* TemplateExpression */, location); + var node = createNode(195 /* TemplateExpression */, location); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; @@ -11359,7 +11380,7 @@ var ts; } ts.updateTemplateExpression = updateTemplateExpression; function createYield(asteriskToken, expression, location) { - var node = createNode(195 /* YieldExpression */, location); + var node = createNode(196 /* YieldExpression */, location); node.asteriskToken = asteriskToken; node.expression = expression; return node; @@ -11373,7 +11394,7 @@ var ts; } ts.updateYield = updateYield; function createSpread(expression, location) { - var node = createNode(196 /* SpreadElement */, location); + var node = createNode(197 /* SpreadElement */, location); node.expression = parenthesizeExpressionForList(expression); return node; } @@ -11386,7 +11407,7 @@ var ts; } ts.updateSpread = updateSpread; function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(197 /* ClassExpression */, location); + var node = createNode(198 /* ClassExpression */, location); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11404,12 +11425,12 @@ var ts; } ts.updateClassExpression = updateClassExpression; function createOmittedExpression(location) { - var node = createNode(198 /* OmittedExpression */, location); + var node = createNode(199 /* OmittedExpression */, location); return node; } ts.createOmittedExpression = createOmittedExpression; function createExpressionWithTypeArguments(typeArguments, expression, location) { - var node = createNode(199 /* ExpressionWithTypeArguments */, location); + var node = createNode(200 /* ExpressionWithTypeArguments */, location); node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; node.expression = parenthesizeForAccess(expression); return node; @@ -11424,7 +11445,7 @@ var ts; ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; // Misc function createTemplateSpan(expression, literal, location) { - var node = createNode(203 /* TemplateSpan */, location); + var node = createNode(204 /* TemplateSpan */, location); node.expression = expression; node.literal = literal; return node; @@ -11439,7 +11460,7 @@ var ts; ts.updateTemplateSpan = updateTemplateSpan; // Element function createBlock(statements, location, multiLine, flags) { - var block = createNode(205 /* Block */, location, flags); + var block = createNode(206 /* Block */, location, flags); block.statements = createNodeArray(statements); if (multiLine) { block.multiLine = true; @@ -11455,7 +11476,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(206 /* VariableStatement */, location, flags); + var node = createNode(207 /* VariableStatement */, location, flags); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -11470,7 +11491,7 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(225 /* VariableDeclarationList */, location, flags); + var node = createNode(226 /* VariableDeclarationList */, location, flags); node.declarations = createNodeArray(declarations); return node; } @@ -11483,7 +11504,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(224 /* VariableDeclaration */, location, flags); + var node = createNode(225 /* VariableDeclaration */, location, flags); node.name = typeof name === "string" ? createIdentifier(name) : name; node.type = type; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11498,11 +11519,11 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createEmptyStatement(location) { - return createNode(207 /* EmptyStatement */, location); + return createNode(208 /* EmptyStatement */, location); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression, location, flags) { - var node = createNode(208 /* ExpressionStatement */, location, flags); + var node = createNode(209 /* ExpressionStatement */, location, flags); node.expression = parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -11515,7 +11536,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(209 /* IfStatement */, location); + var node = createNode(210 /* IfStatement */, location); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11530,7 +11551,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression, location) { - var node = createNode(210 /* DoStatement */, location); + var node = createNode(211 /* DoStatement */, location); node.statement = statement; node.expression = expression; return node; @@ -11544,7 +11565,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement, location) { - var node = createNode(211 /* WhileStatement */, location); + var node = createNode(212 /* WhileStatement */, location); node.expression = expression; node.statement = statement; return node; @@ -11558,7 +11579,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(212 /* ForStatement */, location, /*flags*/ undefined); + var node = createNode(213 /* ForStatement */, location, /*flags*/ undefined); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11574,7 +11595,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement, location) { - var node = createNode(213 /* ForInStatement */, location); + var node = createNode(214 /* ForInStatement */, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11589,7 +11610,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(initializer, expression, statement, location) { - var node = createNode(214 /* ForOfStatement */, location); + var node = createNode(215 /* ForOfStatement */, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11604,7 +11625,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label, location) { - var node = createNode(215 /* ContinueStatement */, location); + var node = createNode(216 /* ContinueStatement */, location); if (label) { node.label = label; } @@ -11619,7 +11640,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label, location) { - var node = createNode(216 /* BreakStatement */, location); + var node = createNode(217 /* BreakStatement */, location); if (label) { node.label = label; } @@ -11634,7 +11655,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression, location) { - var node = createNode(217 /* ReturnStatement */, location); + var node = createNode(218 /* ReturnStatement */, location); node.expression = expression; return node; } @@ -11647,7 +11668,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement, location) { - var node = createNode(218 /* WithStatement */, location); + var node = createNode(219 /* WithStatement */, location); node.expression = expression; node.statement = statement; return node; @@ -11661,7 +11682,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock, location) { - var node = createNode(219 /* SwitchStatement */, location); + var node = createNode(220 /* SwitchStatement */, location); node.expression = parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -11675,7 +11696,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement, location) { - var node = createNode(220 /* LabeledStatement */, location); + var node = createNode(221 /* LabeledStatement */, location); node.label = typeof label === "string" ? createIdentifier(label) : label; node.statement = statement; return node; @@ -11689,7 +11710,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression, location) { - var node = createNode(221 /* ThrowStatement */, location); + var node = createNode(222 /* ThrowStatement */, location); node.expression = expression; return node; } @@ -11702,7 +11723,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(222 /* TryStatement */, location); + var node = createNode(223 /* TryStatement */, location); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11717,7 +11738,7 @@ var ts; } ts.updateTry = updateTry; function createCaseBlock(clauses, location) { - var node = createNode(233 /* CaseBlock */, location); + var node = createNode(234 /* CaseBlock */, location); node.clauses = createNodeArray(clauses); return node; } @@ -11730,7 +11751,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(226 /* FunctionDeclaration */, location, flags); + var node = createNode(227 /* FunctionDeclaration */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -11750,7 +11771,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(227 /* ClassDeclaration */, location); + var node = createNode(228 /* ClassDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11768,7 +11789,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(236 /* ImportDeclaration */, location); + var node = createNode(237 /* ImportDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.importClause = importClause; @@ -11784,7 +11805,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings, location) { - var node = createNode(237 /* ImportClause */, location); + var node = createNode(238 /* ImportClause */, location); node.name = name; node.namedBindings = namedBindings; return node; @@ -11798,7 +11819,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name, location) { - var node = createNode(238 /* NamespaceImport */, location); + var node = createNode(239 /* NamespaceImport */, location); node.name = name; return node; } @@ -11811,7 +11832,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements, location) { - var node = createNode(239 /* NamedImports */, location); + var node = createNode(240 /* NamedImports */, location); node.elements = createNodeArray(elements); return node; } @@ -11824,7 +11845,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name, location) { - var node = createNode(240 /* ImportSpecifier */, location); + var node = createNode(241 /* ImportSpecifier */, location); node.propertyName = propertyName; node.name = name; return node; @@ -11838,7 +11859,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(241 /* ExportAssignment */, location); + var node = createNode(242 /* ExportAssignment */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.isExportEquals = isExportEquals; @@ -11854,7 +11875,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(242 /* ExportDeclaration */, location); + var node = createNode(243 /* ExportDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.exportClause = exportClause; @@ -11870,7 +11891,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements, location) { - var node = createNode(243 /* NamedExports */, location); + var node = createNode(244 /* NamedExports */, location); node.elements = createNodeArray(elements); return node; } @@ -11883,7 +11904,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(name, propertyName, location) { - var node = createNode(244 /* ExportSpecifier */, location); + var node = createNode(245 /* ExportSpecifier */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; return node; @@ -11898,7 +11919,7 @@ var ts; ts.updateExportSpecifier = updateExportSpecifier; // JSX function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(247 /* JsxElement */, location); + var node = createNode(248 /* JsxElement */, location); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11913,7 +11934,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(248 /* JsxSelfClosingElement */, location); + var node = createNode(249 /* JsxSelfClosingElement */, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11927,7 +11948,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(249 /* JsxOpeningElement */, location); + var node = createNode(250 /* JsxOpeningElement */, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11941,7 +11962,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName, location) { - var node = createNode(250 /* JsxClosingElement */, location); + var node = createNode(251 /* JsxClosingElement */, location); node.tagName = tagName; return node; } @@ -11954,7 +11975,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxAttribute(name, initializer, location) { - var node = createNode(251 /* JsxAttribute */, location); + var node = createNode(252 /* JsxAttribute */, location); node.name = name; node.initializer = initializer; return node; @@ -11968,7 +11989,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxSpreadAttribute(expression, location) { - var node = createNode(252 /* JsxSpreadAttribute */, location); + var node = createNode(253 /* JsxSpreadAttribute */, location); node.expression = expression; return node; } @@ -11981,7 +12002,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(expression, dotDotDotToken, location) { - var node = createNode(253 /* JsxExpression */, location); + var node = createNode(254 /* JsxExpression */, location); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -11996,7 +12017,7 @@ var ts; ts.updateJsxExpression = updateJsxExpression; // Clauses function createHeritageClause(token, types, location) { - var node = createNode(256 /* HeritageClause */, location); + var node = createNode(257 /* HeritageClause */, location); node.token = token; node.types = createNodeArray(types); return node; @@ -12010,7 +12031,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCaseClause(expression, statements, location) { - var node = createNode(254 /* CaseClause */, location); + var node = createNode(255 /* CaseClause */, location); node.expression = parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -12024,7 +12045,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements, location) { - var node = createNode(255 /* DefaultClause */, location); + var node = createNode(256 /* DefaultClause */, location); node.statements = createNodeArray(statements); return node; } @@ -12037,7 +12058,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createCatchClause(variableDeclaration, block, location) { - var node = createNode(257 /* CatchClause */, location); + var node = createNode(258 /* CatchClause */, location); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -12052,7 +12073,7 @@ var ts; ts.updateCatchClause = updateCatchClause; // Property assignments function createPropertyAssignment(name, initializer, location) { - var node = createNode(258 /* PropertyAssignment */, location); + var node = createNode(259 /* PropertyAssignment */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.questionToken = undefined; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -12067,14 +12088,14 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(259 /* ShorthandPropertyAssignment */, location); + var node = createNode(260 /* ShorthandPropertyAssignment */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; function createSpreadAssignment(expression, location) { - var node = createNode(260 /* SpreadAssignment */, location); + var node = createNode(261 /* SpreadAssignment */, location); node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; return node; } @@ -12096,7 +12117,7 @@ var ts; // Top-level nodes function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(262 /* SourceFile */, /*location*/ node, node.flags); + var updated = createNode(263 /* SourceFile */, /*location*/ node, node.flags); updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -12163,7 +12184,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createNode(294 /* NotEmittedStatement */, /*location*/ original); + var node = createNode(295 /* NotEmittedStatement */, /*location*/ original); node.original = original; return node; } @@ -12173,7 +12194,7 @@ var ts; * order to properly emit exports. */ function createEndOfDeclarationMarker(original) { - var node = createNode(297 /* EndOfDeclarationMarker */); + var node = createNode(298 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12184,7 +12205,7 @@ var ts; * order to properly emit exports. */ function createMergeDeclarationMarker(original) { - var node = createNode(296 /* MergeDeclarationMarker */); + var node = createNode(297 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12199,7 +12220,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(295 /* PartiallyEmittedExpression */, /*location*/ location || original); + var node = createNode(296 /* PartiallyEmittedExpression */, /*location*/ location || original); node.expression = expression; node.original = original; return node; @@ -12392,7 +12413,7 @@ var ts; if (!outermostLabeledStatement) { return node; } - var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 220 /* LabeledStatement */ + var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 221 /* LabeledStatement */ ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); if (afterRestoreLabelCallback) { @@ -12410,13 +12431,13 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return false; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -12436,7 +12457,7 @@ var ts; } else { switch (callee.kind) { - case 177 /* PropertyAccessExpression */: { + case 178 /* PropertyAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a.b()` target is `(_a = a).b` and thisArg is `_a` thisArg = createTempVariable(recordTempVariable); @@ -12450,7 +12471,7 @@ var ts; } break; } - case 178 /* ElementAccessExpression */: { + case 179 /* ElementAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a` thisArg = createTempVariable(recordTempVariable); @@ -12504,14 +12525,14 @@ var ts; ts.createExpressionForPropertyName = createExpressionForPropertyName; function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); } } @@ -12631,15 +12652,15 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_8 = getMutableClone(node.name); + var name = getMutableClone(node.name); emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) emitFlags |= 48 /* NoSourceMap */; if (!allowComments) emitFlags |= 1536 /* NoComments */; if (emitFlags) - setEmitFlags(name_8, emitFlags); - return name_8; + setEmitFlags(name, emitFlags); + return name; } return getGeneratedNameForNode(node); } @@ -12779,7 +12800,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 183 /* ParenthesizedExpression */) { + if (skipped.kind === 184 /* ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -12813,8 +12834,8 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(192 /* BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(193 /* BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(193 /* BinaryExpression */, binaryOperator); var emittedOperand = skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { @@ -12823,7 +12844,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ - && operand.kind === 195 /* YieldExpression */) { + && operand.kind === 196 /* YieldExpression */) { return false; } return true; @@ -12911,7 +12932,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) { + if (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -12926,7 +12947,7 @@ var ts; return 0 /* Unknown */; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(193 /* ConditionalExpression */, 54 /* QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(194 /* ConditionalExpression */, 54 /* QuestionToken */); var emittedCondition = skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { @@ -12939,7 +12960,7 @@ var ts; // per ES grammar both 'whenTrue' and 'whenFalse' parts of conditional expression are assignment expressions // so in case when comma expression is introduced as a part of previous transformations // if should be wrapped in parens since comma operator has the lowest precedence - return e.kind === 192 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */ + return e.kind === 193 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */ ? createParen(e) : e; } @@ -12952,9 +12973,9 @@ var ts; function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { - case 179 /* CallExpression */: + case 180 /* CallExpression */: return createParen(expression); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return emittedExpression.arguments ? expression : createParen(expression); @@ -12979,7 +13000,7 @@ var ts; // var emittedExpression = skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 180 /* NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 181 /* NewExpression */ || emittedExpression.arguments) && emittedExpression.kind !== 8 /* NumericLiteral */) { return expression; } @@ -13017,7 +13038,7 @@ var ts; function parenthesizeExpressionForList(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, 25 /* CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(193 /* BinaryExpression */, 25 /* CommaToken */); return expressionPrecedence > commaPrecedence ? expression : createParen(expression, /*location*/ expression); @@ -13028,7 +13049,7 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 184 /* FunctionExpression */ || kind === 185 /* ArrowFunction */) { + if (kind === 185 /* FunctionExpression */ || kind === 186 /* ArrowFunction */) { var mutableCall = getMutableClone(emittedExpression); mutableCall.expression = createParen(callee, /*location*/ callee); return recreatePartiallyEmittedExpressions(expression, mutableCall); @@ -13036,7 +13057,7 @@ var ts; } else { var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; - if (leftmostExpressionKind === 176 /* ObjectLiteralExpression */ || leftmostExpressionKind === 184 /* FunctionExpression */) { + if (leftmostExpressionKind === 177 /* ObjectLiteralExpression */ || leftmostExpressionKind === 185 /* FunctionExpression */) { return createParen(expression, /*location*/ expression); } } @@ -13060,21 +13081,21 @@ var ts; function getLeftmostExpression(node) { while (true) { switch (node.kind) { - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: node = node.operand; continue; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: node = node.left; continue; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: node = node.condition; continue; - case 179 /* CallExpression */: - case 178 /* ElementAccessExpression */: - case 177 /* PropertyAccessExpression */: + case 180 /* CallExpression */: + case 179 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: node = node.expression; continue; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -13083,7 +13104,7 @@ var ts; } function parenthesizeConciseBody(body) { var emittedBody = skipPartiallyEmittedExpressions(body); - if (emittedBody.kind === 176 /* ObjectLiteralExpression */) { + if (emittedBody.kind === 177 /* ObjectLiteralExpression */) { return createParen(body, /*location*/ body); } return body; @@ -13115,7 +13136,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipParentheses(node) { - while (node.kind === 183 /* ParenthesizedExpression */) { + while (node.kind === 184 /* ParenthesizedExpression */) { node = node.expression; } return node; @@ -13129,7 +13150,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 295 /* PartiallyEmittedExpression */) { + while (node.kind === 296 /* PartiallyEmittedExpression */) { node = node.expression; } return node; @@ -13170,8 +13191,10 @@ var ts; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { if (!destRanges) - destRanges = ts.createMap(); - ts.copyProperties(sourceRanges, destRanges); + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } return destRanges; } /** @@ -13208,7 +13231,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 262 /* SourceFile */) { + if (node.kind === 263 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -13282,7 +13305,7 @@ var ts; */ function setTokenSourceMapRange(node, token, range) { var emitNode = getOrCreateEmitNode(node); - var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); tokenSourceMapRanges[token] = range; return node; } @@ -13463,13 +13486,13 @@ var ts; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_9 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name) ? name : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 236 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 237 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 242 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 243 /* ExportDeclaration */ && node.moduleSpecifier) { return getGeneratedNameForNode(node); } return undefined; @@ -13498,10 +13521,8 @@ var ts; * Here we check if alternative name was provided for a given moduleName and return it if possible. */ function tryRenameExternalModule(moduleName, sourceFile) { - if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) { - return createLiteral(sourceFile.renamedDependencies[moduleName.text]); - } - return undefined; + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && createLiteral(rename); } /** * Get the name of a module as should be written in the emitted output. @@ -13589,7 +13610,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -13601,11 +13622,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -13637,12 +13658,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 144 /* Parameter */: - case 174 /* BindingElement */: + case 145 /* Parameter */: + case 175 /* BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 196 /* SpreadElement */: - case 260 /* SpreadAssignment */: + case 197 /* SpreadElement */: + case 261 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -13654,7 +13675,7 @@ var ts; */ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 174 /* BindingElement */: + case 175 /* BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -13666,7 +13687,7 @@ var ts; : propertyName; } break; - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -13678,7 +13699,7 @@ var ts; : propertyName; } break; - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -13696,13 +13717,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -13740,11 +13761,11 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 172 /* ObjectBindingPattern */: - case 176 /* ObjectLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 177 /* ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -13775,8 +13796,8 @@ var ts; ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); + var exportSpecifiers = ts.createMultiMap(); + var exportedBindings = []; var uniqueExports = ts.createMap(); var exportedNames; var hasExportDefault = false; @@ -13792,20 +13813,20 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" // import { x, y } from "mod" externalImports.push(node); break; - case 235 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 246 /* ExternalModuleReference */) { + case 236 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 247 /* ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -13821,27 +13842,27 @@ var ts; // export { x, y } for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_10 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_10.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_10) - || resolver.getReferencedValueDeclaration(name_10); + if (!uniqueExports.get(specifier.name.text)) { + var name = specifier.propertyName || specifier.name; + exportSpecifiers.add(name.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); if (decl) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); } - uniqueExports[specifier.name.text] = true; + uniqueExports.set(specifier.name.text, true); exportedNames = ts.append(exportedNames, specifier.name); } } } break; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: if (ts.hasModifier(node, 1 /* Export */)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13849,42 +13870,42 @@ var ts; } } break; - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default function() { } if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { // export function x() { } - var name_11 = node.name; - if (!uniqueExports[name_11.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11); - uniqueExports[name_11.text] = true; - exportedNames = ts.append(exportedNames, name_11); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } break; - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default class { } if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { // export class x { } - var name_12 = node.name; - if (!uniqueExports[name_12.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12); - uniqueExports[name_12.text] = true; - exportedNames = ts.append(exportedNames, name_12); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } @@ -13904,13 +13925,24 @@ var ts; } } else if (!ts.isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = true; + if (!uniqueExports.get(decl.name.text)) { + uniqueExports.set(decl.name.text, true); exportedNames = ts.append(exportedNames, decl.name); } } return exportedNames; } + /** Use a sparse array as a multi-map. */ + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } })(ts || (ts = {})); /// /// @@ -13922,13 +13954,13 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 262 /* SourceFile */) { + if (kind === 263 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70 /* Identifier */) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } - else if (kind < 141 /* FirstNode */) { + else if (kind < 142 /* FirstNode */) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end); } else { @@ -13971,28 +14003,28 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: return visitNode(cbNode, node.expression); - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 258 /* PropertyAssignment */: - case 224 /* VariableDeclaration */: - case 174 /* BindingElement */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 259 /* PropertyAssignment */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -14001,24 +14033,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -14029,323 +14061,323 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 163 /* TupleType */: + case 164 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 166 /* ParenthesizedType */: - case 168 /* TypeOperator */: + case 167 /* ParenthesizedType */: + case 169 /* TypeOperator */: return visitNode(cbNode, node.type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); - case 170 /* MappedType */: + case 171 /* MappedType */: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return visitNode(cbNode, node.literal); - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 200 /* AsExpression */: + case 201 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return visitNode(cbNode, node.expression); - case 202 /* MetaProperty */: + case 203 /* MetaProperty */: return visitNode(cbNode, node.name); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return visitNode(cbNode, node.expression); - case 205 /* Block */: - case 232 /* ModuleBlock */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 262 /* SourceFile */: + case 263 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 209 /* IfStatement */: + case 210 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 215 /* ContinueStatement */: - case 216 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: return visitNode(cbNode, node.label); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 254 /* CaseClause */: + case 255 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 255 /* DefaultClause */: + case 256 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 145 /* Decorator */: + case 146 /* Decorator */: return visitNode(cbNode, node.expression); - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* 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 228 /* InterfaceDeclaration */: + case 229 /* 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 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 261 /* EnumMember */: + case 262 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 237 /* ImportClause */: + case 238 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 234 /* NamespaceExportDeclaration */: + case 235 /* NamespaceExportDeclaration */: return visitNode(cbNode, node.name); - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 239 /* NamedImports */: - case 243 /* NamedExports */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 240 /* ImportSpecifier */: - case 244 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 203 /* TemplateSpan */: + case 204 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 246 /* ExternalModuleReference */: + case 247 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 245 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 247 /* JsxElement */: + case 248 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 248 /* JsxSelfClosingElement */: - case 249 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 251 /* JsxAttribute */: + case 252 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 252 /* JsxSpreadAttribute */: + case 253 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 250 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 263 /* JSDocTypeExpression */: + case 264 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 267 /* JSDocUnionType */: + case 268 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 268 /* JSDocTupleType */: + case 269 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 266 /* JSDocArrayType */: + case 267 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 270 /* JSDocNonNullableType */: + case 271 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 269 /* JSDocNullableType */: + case 270 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 271 /* JSDocRecordType */: + case 272 /* JSDocRecordType */: return visitNode(cbNode, node.literal); - case 273 /* JSDocTypeReference */: + case 274 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 274 /* JSDocOptionalType */: + case 275 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 275 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 276 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 277 /* JSDocConstructorType */: + case 278 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 278 /* JSDocThisType */: + case 279 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 272 /* JSDocRecordMember */: + case 273 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 279 /* JSDocComment */: + case 280 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 282 /* JSDocParameterTag */: + case 283 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 283 /* JSDocReturnTag */: + case 284 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 284 /* JSDocTypeTag */: + case 285 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 281 /* JSDocAugmentsTag */: + case 282 /* JSDocAugmentsTag */: return visitNode(cbNode, node.typeExpression); - case 285 /* JSDocTemplateTag */: + case 286 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 288 /* JSDocTypeLiteral */: + case 289 /* JSDocTypeLiteral */: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 287 /* JSDocPropertyTag */: + case 288 /* JSDocPropertyTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); - case 289 /* JSDocLiteralType */: + case 290 /* JSDocLiteralType */: return visitNode(cbNode, node.literal); } } @@ -14617,7 +14649,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(262 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(263 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -14901,7 +14933,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return kind >= 141 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) : + return kind >= 142 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) : kind === 70 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) : new TokenConstructor(kind, pos, pos); } @@ -14941,7 +14973,11 @@ var ts; } function internIdentifier(text) { text = ts.escapeIdentifier(text); - return identifiers[text] || (identifiers[text] = text); + var identifier = identifiers.get(text); + if (identifier === undefined) { + identifiers.set(text, identifier = text); + } + return identifier; } // An identifier that starts with two underscores has an extra underscore character prepended to it to avoid issues // with magic property names like '__proto__'. The 'identifiers' object is used to share a single string instance for @@ -14993,7 +15029,7 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(142 /* ComputedPropertyName */); + var node = createNode(143 /* ComputedPropertyName */); parseExpected(20 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -15400,14 +15436,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 150 /* Constructor */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 147 /* PropertyDeclaration */: - case 204 /* SemicolonClassElement */: + case 151 /* Constructor */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 205 /* SemicolonClassElement */: return true; - case 149 /* MethodDeclaration */: + case 150 /* 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. @@ -15422,8 +15458,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 254 /* CaseClause */: - case 255 /* DefaultClause */: + case 255 /* CaseClause */: + case 256 /* DefaultClause */: return true; } } @@ -15432,58 +15468,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: - case 206 /* VariableStatement */: - case 205 /* Block */: - case 209 /* IfStatement */: - case 208 /* ExpressionStatement */: - case 221 /* ThrowStatement */: - case 217 /* ReturnStatement */: - case 219 /* SwitchStatement */: - case 216 /* BreakStatement */: - case 215 /* ContinueStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 212 /* ForStatement */: - case 211 /* WhileStatement */: - case 218 /* WithStatement */: - case 207 /* EmptyStatement */: - case 222 /* TryStatement */: - case 220 /* LabeledStatement */: - case 210 /* DoStatement */: - case 223 /* DebuggerStatement */: - case 236 /* ImportDeclaration */: - case 235 /* ImportEqualsDeclaration */: - case 242 /* ExportDeclaration */: - case 241 /* ExportAssignment */: - case 231 /* ModuleDeclaration */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 229 /* TypeAliasDeclaration */: + case 227 /* FunctionDeclaration */: + case 207 /* VariableStatement */: + case 206 /* Block */: + case 210 /* IfStatement */: + case 209 /* ExpressionStatement */: + case 222 /* ThrowStatement */: + case 218 /* ReturnStatement */: + case 220 /* SwitchStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 213 /* ForStatement */: + case 212 /* WhileStatement */: + case 219 /* WithStatement */: + case 208 /* EmptyStatement */: + case 223 /* TryStatement */: + case 221 /* LabeledStatement */: + case 211 /* DoStatement */: + case 224 /* DebuggerStatement */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 230 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 261 /* EnumMember */; + return node.kind === 262 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 154 /* ConstructSignature */: - case 148 /* MethodSignature */: - case 155 /* IndexSignature */: - case 146 /* PropertySignature */: - case 153 /* CallSignature */: + case 155 /* ConstructSignature */: + case 149 /* MethodSignature */: + case 156 /* IndexSignature */: + case 147 /* PropertySignature */: + case 154 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 224 /* VariableDeclaration */) { + if (node.kind !== 225 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -15504,7 +15540,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 144 /* Parameter */) { + if (node.kind !== 145 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -15617,7 +15653,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(22 /* DotToken */)) { - var node = createNode(141 /* QualifiedName */, entity.pos); // !!! + var node = createNode(142 /* QualifiedName */, entity.pos); // !!! node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -15656,7 +15692,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(194 /* TemplateExpression */); + var template = createNode(195 /* TemplateExpression */); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 13 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = createNodeArray(); @@ -15668,7 +15704,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(203 /* TemplateSpan */); + var span = createNode(204 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17 /* CloseBraceToken */) { @@ -15723,7 +15759,7 @@ var ts; // TYPES function parseTypeReference() { var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); - var node = createNode(157 /* TypeReference */, typeName.pos); + var node = createNode(158 /* TypeReference */, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token() === 26 /* LessThanToken */) { node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */); @@ -15732,24 +15768,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(156 /* TypePredicate */, lhs.pos); + var node = createNode(157 /* TypePredicate */, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(167 /* ThisType */); + var node = createNode(168 /* ThisType */); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(160 /* TypeQuery */); + var node = createNode(161 /* TypeQuery */); parseExpected(102 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(143 /* TypeParameter */); + var node = createNode(144 /* TypeParameter */); node.name = parseIdentifier(); if (parseOptional(84 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the @@ -15787,7 +15823,7 @@ var ts; return token() === 23 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 /* AtToken */ || token() === 98 /* ThisKeyword */; } function parseParameter() { - var node = createNode(144 /* Parameter */); + var node = createNode(145 /* Parameter */); if (token() === 98 /* ThisKeyword */) { node.name = createIdentifier(/*isIdentifier*/ true, undefined); node.type = parseParameterType(); @@ -15886,7 +15922,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 154 /* ConstructSignature */) { + if (kind === 155 /* ConstructSignature */) { parseExpected(93 /* NewKeyword */); } fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -15950,7 +15986,7 @@ var ts; return token() === 55 /* ColonToken */ || token() === 25 /* CommaToken */ || token() === 21 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(155 /* IndexSignature */, fullStart); + var node = createNode(156 /* IndexSignature */, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */); @@ -15962,7 +15998,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(54 /* QuestionToken */); if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { - var method = createNode(148 /* MethodSignature */, fullStart); + var method = createNode(149 /* MethodSignature */, fullStart); method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; @@ -15973,7 +16009,7 @@ var ts; return addJSDocComment(finishNode(method)); } else { - var property = createNode(146 /* PropertySignature */, fullStart); + var property = createNode(147 /* PropertySignature */, fullStart); property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; @@ -16022,10 +16058,10 @@ var ts; } function parseTypeMember() { if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { - return parseSignatureMember(153 /* CallSignature */); + return parseSignatureMember(154 /* CallSignature */); } if (token() === 93 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(154 /* ConstructSignature */); + return parseSignatureMember(155 /* ConstructSignature */); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -16039,7 +16075,7 @@ var ts; return token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(161 /* TypeLiteral */); + var node = createNode(162 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -16062,14 +16098,14 @@ var ts; return token() === 20 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 91 /* InKeyword */; } function parseMappedTypeParameter() { - var node = createNode(143 /* TypeParameter */); + var node = createNode(144 /* TypeParameter */); node.name = parseIdentifier(); parseExpected(91 /* InKeyword */); node.constraint = parseType(); return finishNode(node); } function parseMappedType() { - var node = createNode(170 /* MappedType */); + var node = createNode(171 /* MappedType */); parseExpected(16 /* OpenBraceToken */); node.readonlyToken = parseOptionalToken(130 /* ReadonlyKeyword */); parseExpected(20 /* OpenBracketToken */); @@ -16082,12 +16118,12 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(163 /* TupleType */); + var node = createNode(164 /* TupleType */); node.elementTypes = parseBracketedList(20 /* TupleElementTypes */, parseType, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(166 /* ParenthesizedType */); + var node = createNode(167 /* ParenthesizedType */); parseExpected(18 /* OpenParenToken */); node.type = parseType(); parseExpected(19 /* CloseParenToken */); @@ -16095,7 +16131,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 159 /* ConstructorType */) { + if (kind === 160 /* ConstructorType */) { parseExpected(93 /* NewKeyword */); } fillSignature(35 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -16106,7 +16142,7 @@ var ts; return token() === 22 /* DotToken */ ? undefined : node; } function parseLiteralTypeNode() { - var node = createNode(171 /* LiteralType */); + var node = createNode(172 /* LiteralType */); node.literal = parseSimpleUnaryExpression(); finishNode(node); return node; @@ -16117,12 +16153,13 @@ var ts; function parseNonArrayType() { switch (token()) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: - case 137 /* UndefinedKeyword */: + case 136 /* SymbolKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: + case 133 /* ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); @@ -16160,12 +16197,12 @@ var ts; function isStartOfType() { switch (token()) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 98 /* ThisKeyword */: case 102 /* TypeOfKeyword */: @@ -16180,6 +16217,7 @@ var ts; case 8 /* NumericLiteral */: case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: + case 133 /* ObjectKeyword */: return true; case 37 /* MinusToken */: return lookAhead(nextTokenIsNumericLiteral); @@ -16199,14 +16237,14 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(20 /* OpenBracketToken */)) { if (isStartOfType()) { - var node = createNode(169 /* IndexedAccessType */, type.pos); + var node = createNode(170 /* IndexedAccessType */, type.pos); node.objectType = type; node.indexType = parseType(); parseExpected(21 /* CloseBracketToken */); type = finishNode(node); } else { - var node = createNode(162 /* ArrayType */, type.pos); + var node = createNode(163 /* ArrayType */, type.pos); node.elementType = type; parseExpected(21 /* CloseBracketToken */); type = finishNode(node); @@ -16215,7 +16253,7 @@ var ts; return type; } function parseTypeOperator(operator) { - var node = createNode(168 /* TypeOperator */); + var node = createNode(169 /* TypeOperator */); parseExpected(operator); node.operator = operator; node.type = parseTypeOperatorOrHigher(); @@ -16244,10 +16282,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(165 /* IntersectionType */, parseTypeOperatorOrHigher, 47 /* AmpersandToken */); + return parseUnionOrIntersectionType(166 /* IntersectionType */, parseTypeOperatorOrHigher, 47 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(164 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */); + return parseUnionOrIntersectionType(165 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */); } function isStartOfFunctionType() { if (token() === 26 /* LessThanToken */) { @@ -16304,7 +16342,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(156 /* TypePredicate */, typePredicateVariable.pos); + var node = createNode(157 /* TypePredicate */, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -16327,10 +16365,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(158 /* FunctionType */); + return parseFunctionOrConstructorType(159 /* FunctionType */); } if (token() === 93 /* NewKeyword */) { - return parseFunctionOrConstructorType(159 /* ConstructorType */); + return parseFunctionOrConstructorType(160 /* ConstructorType */); } return parseUnionTypeOrHigher(); } @@ -16531,7 +16569,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(195 /* YieldExpression */); + var node = createNode(196 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -16553,13 +16591,13 @@ var ts; ts.Debug.assert(token() === 35 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(185 /* ArrowFunction */, asyncModifier.pos); + node = createNode(186 /* ArrowFunction */, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(185 /* ArrowFunction */, identifier.pos); + node = createNode(186 /* ArrowFunction */, identifier.pos); } - var parameter = createNode(144 /* Parameter */, identifier.pos); + var parameter = createNode(145 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = createNodeArray([parameter], parameter.pos); @@ -16741,7 +16779,7 @@ var ts; return 0 /* False */; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(185 /* ArrowFunction */); + var node = createNode(186 /* ArrowFunction */); node.modifiers = parseModifiersForArrowFunction(); var isAsync = !!(ts.getModifierFlags(node) & 256 /* Async */); // Arrow functions are never generators. @@ -16807,7 +16845,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(193 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(194 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -16820,7 +16858,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 91 /* InKeyword */ || t === 140 /* OfKeyword */; + return t === 91 /* InKeyword */ || t === 141 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -16928,39 +16966,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(192 /* BinaryExpression */, left.pos); + var node = createNode(193 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(200 /* AsExpression */, left.pos); + var node = createNode(201 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(190 /* PrefixUnaryExpression */); + var node = createNode(191 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(186 /* DeleteExpression */); + var node = createNode(187 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(187 /* TypeOfExpression */); + var node = createNode(188 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(188 /* VoidExpression */); + var node = createNode(189 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -16976,7 +17014,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(189 /* AwaitExpression */); + var node = createNode(190 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -17019,7 +17057,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token() === 39 /* AsteriskAsteriskToken */) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 182 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 183 /* TypeAssertionExpression */) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -17115,7 +17153,7 @@ var ts; */ function parseIncrementExpression() { if (token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) { - var node = createNode(190 /* PrefixUnaryExpression */); + var node = createNode(191 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -17128,7 +17166,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(191 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(192 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -17232,7 +17270,7 @@ var ts; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(177 /* PropertyAccessExpression */, expression.pos); + var node = createNode(178 /* PropertyAccessExpression */, expression.pos); node.expression = expression; parseExpectedToken(22 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -17257,8 +17295,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 249 /* JsxOpeningElement */) { - var node = createNode(247 /* JsxElement */, opening.pos); + if (opening.kind === 250 /* JsxOpeningElement */) { + var node = createNode(248 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -17268,7 +17306,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 248 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 249 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -17283,7 +17321,7 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(192 /* BinaryExpression */, result.pos); + var badNode = createNode(193 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -17342,7 +17380,7 @@ var ts; // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(249 /* JsxOpeningElement */, fullStart); + node = createNode(250 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -17354,7 +17392,7 @@ var ts; parseExpected(28 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(248 /* JsxSelfClosingElement */, fullStart); + node = createNode(249 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -17370,7 +17408,7 @@ var ts; var expression = token() === 98 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName(); while (parseOptional(22 /* DotToken */)) { - var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(178 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -17378,7 +17416,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(253 /* JsxExpression */); + var node = createNode(254 /* JsxExpression */); parseExpected(16 /* OpenBraceToken */); if (token() !== 17 /* CloseBraceToken */) { node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); @@ -17398,7 +17436,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(251 /* JsxAttribute */); + var node = createNode(252 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 57 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -17413,7 +17451,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(252 /* JsxSpreadAttribute */); + var node = createNode(253 /* JsxSpreadAttribute */); parseExpected(16 /* OpenBraceToken */); parseExpected(23 /* DotDotDotToken */); node.expression = parseExpression(); @@ -17421,7 +17459,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(250 /* JsxClosingElement */); + var node = createNode(251 /* JsxClosingElement */); parseExpected(27 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -17434,7 +17472,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(182 /* TypeAssertionExpression */); + var node = createNode(183 /* TypeAssertionExpression */); parseExpected(26 /* LessThanToken */); node.type = parseType(); parseExpected(28 /* GreaterThanToken */); @@ -17445,7 +17483,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(22 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(178 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -17453,14 +17491,14 @@ var ts; } if (token() === 50 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(201 /* NonNullExpression */, expression.pos); + var nonNullExpression = createNode(202 /* NonNullExpression */, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(20 /* OpenBracketToken */)) { - var indexedAccess = createNode(178 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(179 /* 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. @@ -17476,7 +17514,7 @@ var ts; continue; } if (token() === 12 /* NoSubstitutionTemplateLiteral */ || token() === 13 /* TemplateHead */) { - var tagExpression = createNode(181 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(182 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 12 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -17499,7 +17537,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(179 /* CallExpression */, expression.pos); + var callExpr = createNode(180 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -17507,7 +17545,7 @@ var ts; continue; } else if (token() === 18 /* OpenParenToken */) { - var callExpr = createNode(179 /* CallExpression */, expression.pos); + var callExpr = createNode(180 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -17617,28 +17655,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(183 /* ParenthesizedExpression */); + var node = createNode(184 /* ParenthesizedExpression */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(196 /* SpreadElement */); + var node = createNode(197 /* SpreadElement */); parseExpected(23 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 23 /* DotDotDotToken */ ? parseSpreadElement() : - token() === 25 /* CommaToken */ ? createNode(198 /* OmittedExpression */) : + token() === 25 /* CommaToken */ ? createNode(199 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(175 /* ArrayLiteralExpression */); + var node = createNode(176 /* ArrayLiteralExpression */); parseExpected(20 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17649,10 +17687,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(124 /* GetKeyword */)) { - return parseAccessorDeclaration(151 /* GetAccessor */, fullStart, decorators, modifiers); + return parseAccessorDeclaration(152 /* GetAccessor */, fullStart, decorators, modifiers); } - else if (parseContextualModifier(133 /* SetKeyword */)) { - return parseAccessorDeclaration(152 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(134 /* SetKeyword */)) { + return parseAccessorDeclaration(153 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -17660,7 +17698,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); if (dotDotDotToken) { - var spreadElement = createNode(260 /* SpreadAssignment */, fullStart); + var spreadElement = createNode(261 /* SpreadAssignment */, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -17685,7 +17723,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 /* CommaToken */ || token() === 17 /* CloseBraceToken */ || token() === 57 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(259 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(260 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57 /* EqualsToken */); @@ -17696,7 +17734,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(258 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(259 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -17706,7 +17744,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(176 /* ObjectLiteralExpression */); + var node = createNode(177 /* ObjectLiteralExpression */); parseExpected(16 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17725,7 +17763,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(/*val*/ false); } - var node = createNode(184 /* FunctionExpression */); + var node = createNode(185 /* FunctionExpression */); node.modifiers = parseModifiers(); parseExpected(88 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(38 /* AsteriskToken */); @@ -17750,12 +17788,12 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(93 /* NewKeyword */); if (parseOptional(22 /* DotToken */)) { - var node_1 = createNode(202 /* MetaProperty */, fullStart); + var node_1 = createNode(203 /* MetaProperty */, fullStart); node_1.keywordToken = 93 /* NewKeyword */; node_1.name = parseIdentifierName(); return finishNode(node_1); } - var node = createNode(180 /* NewExpression */, fullStart); + var node = createNode(181 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18 /* OpenParenToken */) { @@ -17765,7 +17803,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(205 /* Block */); + var node = createNode(206 /* Block */); if (parseExpected(16 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17798,12 +17836,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(207 /* EmptyStatement */); + var node = createNode(208 /* EmptyStatement */); parseExpected(24 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(209 /* IfStatement */); + var node = createNode(210 /* IfStatement */); parseExpected(89 /* IfKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17813,7 +17851,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(210 /* DoStatement */); + var node = createNode(211 /* DoStatement */); parseExpected(80 /* DoKeyword */); node.statement = parseStatement(); parseExpected(105 /* WhileKeyword */); @@ -17828,7 +17866,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(211 /* WhileStatement */); + var node = createNode(212 /* WhileStatement */); parseExpected(105 /* WhileKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17851,21 +17889,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(91 /* InKeyword */)) { - var forInStatement = createNode(213 /* ForInStatement */, pos); + var forInStatement = createNode(214 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(140 /* OfKeyword */)) { - var forOfStatement = createNode(214 /* ForOfStatement */, pos); + else if (parseOptional(141 /* OfKeyword */)) { + var forOfStatement = createNode(215 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(212 /* ForStatement */, pos); + var forStatement = createNode(213 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(24 /* SemicolonToken */); if (token() !== 24 /* SemicolonToken */ && token() !== 19 /* CloseParenToken */) { @@ -17883,7 +17921,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 216 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); + parseExpected(kind === 217 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -17891,7 +17929,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(217 /* ReturnStatement */); + var node = createNode(218 /* ReturnStatement */); parseExpected(95 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -17900,7 +17938,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(218 /* WithStatement */); + var node = createNode(219 /* WithStatement */); parseExpected(106 /* WithKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17909,7 +17947,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(254 /* CaseClause */); + var node = createNode(255 /* CaseClause */); parseExpected(72 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(55 /* ColonToken */); @@ -17917,7 +17955,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(255 /* DefaultClause */); + var node = createNode(256 /* DefaultClause */); parseExpected(78 /* DefaultKeyword */); parseExpected(55 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -17927,12 +17965,12 @@ var ts; return token() === 72 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(219 /* SwitchStatement */); + var node = createNode(220 /* SwitchStatement */); parseExpected(97 /* SwitchKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); - var caseBlock = createNode(233 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(234 /* CaseBlock */, scanner.getStartPos()); parseExpected(16 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(17 /* CloseBraceToken */); @@ -17947,7 +17985,7 @@ 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(221 /* ThrowStatement */); + var node = createNode(222 /* ThrowStatement */); parseExpected(99 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -17955,7 +17993,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(222 /* TryStatement */); + var node = createNode(223 /* TryStatement */); parseExpected(101 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token() === 73 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -17968,7 +18006,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(257 /* CatchClause */); + var result = createNode(258 /* CatchClause */); parseExpected(73 /* CatchKeyword */); if (parseExpected(18 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -17978,7 +18016,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(223 /* DebuggerStatement */); + var node = createNode(224 /* DebuggerStatement */); parseExpected(77 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -17990,13 +18028,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 /* Identifier */ && parseOptional(55 /* ColonToken */)) { - var labeledStatement = createNode(220 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(221 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(208 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(209 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -18046,7 +18084,7 @@ var ts; // // could be legal, it would add complexity for very little gain. case 108 /* InterfaceKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: @@ -18064,7 +18102,7 @@ var ts; return false; } continue; - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: nextToken(); return token() === 16 /* OpenBraceToken */ || token() === 70 /* Identifier */ || token() === 83 /* ExportKeyword */; case 90 /* ImportKeyword */: @@ -18126,8 +18164,8 @@ var ts; case 108 /* InterfaceKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: - case 136 /* TypeKeyword */: - case 139 /* GlobalKeyword */: + case 137 /* TypeKeyword */: + case 140 /* GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; case 113 /* PublicKeyword */: @@ -18177,9 +18215,9 @@ var ts; case 87 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 76 /* ContinueKeyword */: - return parseBreakOrContinueStatement(215 /* ContinueStatement */); + return parseBreakOrContinueStatement(216 /* ContinueStatement */); case 71 /* BreakKeyword */: - return parseBreakOrContinueStatement(216 /* BreakStatement */); + return parseBreakOrContinueStatement(217 /* BreakStatement */); case 95 /* ReturnKeyword */: return parseReturnStatement(); case 106 /* WithKeyword */: @@ -18199,7 +18237,7 @@ var ts; return parseDeclaration(); case 119 /* AsyncKeyword */: case 108 /* InterfaceKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: case 123 /* DeclareKeyword */: @@ -18213,7 +18251,7 @@ var ts; case 116 /* AbstractKeyword */: case 114 /* StaticKeyword */: case 130 /* ReadonlyKeyword */: - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -18236,11 +18274,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 108 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 82 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -18261,7 +18299,7 @@ var ts; 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(245 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(246 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -18283,16 +18321,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token() === 25 /* CommaToken */) { - return createNode(198 /* OmittedExpression */); + return createNode(199 /* OmittedExpression */); } - var node = createNode(174 /* BindingElement */); + var node = createNode(175 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(174 /* BindingElement */); + var node = createNode(175 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -18308,14 +18346,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(172 /* ObjectBindingPattern */); + var node = createNode(173 /* ObjectBindingPattern */); parseExpected(16 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(17 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(173 /* ArrayBindingPattern */); + var node = createNode(174 /* ArrayBindingPattern */); parseExpected(20 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(21 /* CloseBracketToken */); @@ -18334,7 +18372,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(224 /* VariableDeclaration */); + var node = createNode(225 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -18343,7 +18381,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(225 /* VariableDeclarationList */); + var node = createNode(226 /* VariableDeclarationList */); switch (token()) { case 103 /* VarKeyword */: break; @@ -18366,7 +18404,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() === 140 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 141 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -18381,7 +18419,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(206 /* VariableStatement */, fullStart); + var node = createNode(207 /* VariableStatement */, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); @@ -18389,7 +18427,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(226 /* FunctionDeclaration */, fullStart); + var node = createNode(227 /* FunctionDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88 /* FunctionKeyword */); @@ -18402,7 +18440,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(150 /* Constructor */, pos); + var node = createNode(151 /* Constructor */, pos); node.decorators = decorators; node.modifiers = modifiers; parseExpected(122 /* ConstructorKeyword */); @@ -18411,7 +18449,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(149 /* MethodDeclaration */, fullStart); + var method = createNode(150 /* MethodDeclaration */, fullStart); method.decorators = decorators; method.modifiers = modifiers; method.asteriskToken = asteriskToken; @@ -18424,7 +18462,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(147 /* PropertyDeclaration */, fullStart); + var property = createNode(148 /* PropertyDeclaration */, fullStart); property.decorators = decorators; property.modifiers = modifiers; property.name = name; @@ -18517,7 +18555,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 133 /* SetKeyword */ || idToken === 124 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 134 /* SetKeyword */ || idToken === 124 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -18547,7 +18585,7 @@ var ts; if (!parseOptional(56 /* AtToken */)) { break; } - var decorator = createNode(145 /* Decorator */, decoratorStart); + var decorator = createNode(146 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); finishNode(decorator); if (!decorators) { @@ -18613,7 +18651,7 @@ var ts; } function parseClassElement() { if (token() === 24 /* SemicolonToken */) { - var result = createNode(204 /* SemicolonClassElement */); + var result = createNode(205 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -18641,8 +18679,8 @@ var ts; } if (decorators || modifiers) { // treat this as a property declaration with a missing name. - var name_13 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, /*questionToken*/ undefined); + var name = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, /*questionToken*/ undefined); } // 'isClassMemberStart' should have hinted not to attempt parsing. ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -18651,10 +18689,10 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 197 /* ClassExpression */); + /*modifiers*/ undefined, 198 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 227 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 228 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -18698,7 +18736,7 @@ var ts; } function parseHeritageClause() { if (token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */) { - var node = createNode(256 /* HeritageClause */); + var node = createNode(257 /* HeritageClause */); node.token = token(); nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -18707,7 +18745,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(199 /* ExpressionWithTypeArguments */); + var node = createNode(200 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token() === 26 /* LessThanToken */) { node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */); @@ -18721,7 +18759,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228 /* InterfaceDeclaration */, fullStart); + var node = createNode(229 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108 /* InterfaceKeyword */); @@ -18732,10 +18770,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229 /* TypeAliasDeclaration */, fullStart); + var node = createNode(230 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; - parseExpected(136 /* TypeKeyword */); + parseExpected(137 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(57 /* EqualsToken */); @@ -18748,13 +18786,13 @@ 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(261 /* EnumMember */, scanner.getStartPos()); + var node = createNode(262 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230 /* EnumDeclaration */, fullStart); + var node = createNode(231 /* EnumDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82 /* EnumKeyword */); @@ -18769,7 +18807,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(232 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(233 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(16 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(17 /* CloseBraceToken */); @@ -18780,7 +18818,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(231 /* ModuleDeclaration */, fullStart); + var node = createNode(232 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 16 /* Namespace */; @@ -18794,10 +18832,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(231 /* ModuleDeclaration */, fullStart); + var node = createNode(232 /* ModuleDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; - if (token() === 139 /* GlobalKeyword */) { + if (token() === 140 /* GlobalKeyword */) { // parse 'global' as name of global scope augmentation node.name = parseIdentifier(); node.flags |= 512 /* GlobalAugmentation */; @@ -18815,7 +18853,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = 0; - if (token() === 139 /* GlobalKeyword */) { + if (token() === 140 /* GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -18841,7 +18879,7 @@ var ts; return nextToken() === 40 /* SlashToken */; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(234 /* NamespaceExportDeclaration */, fullStart); + var exportDeclaration = createNode(235 /* NamespaceExportDeclaration */, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117 /* AsKeyword */); @@ -18856,11 +18894,11 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 25 /* CommaToken */ && token() !== 138 /* FromKeyword */) { + if (token() !== 25 /* CommaToken */ && token() !== 139 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(235 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(236 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; importEqualsDeclaration.modifiers = modifiers; importEqualsDeclaration.name = identifier; @@ -18871,7 +18909,7 @@ var ts; } } // Import statement - var importDeclaration = createNode(236 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(237 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; // ImportDeclaration: @@ -18881,7 +18919,7 @@ var ts; token() === 38 /* AsteriskToken */ || token() === 16 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(138 /* FromKeyword */); + parseExpected(139 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -18894,7 +18932,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(237 /* ImportClause */, fullStart); + var importClause = createNode(238 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -18904,7 +18942,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(25 /* CommaToken */)) { - importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(239 /* NamedImports */); + importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(240 /* NamedImports */); } return finishNode(importClause); } @@ -18914,7 +18952,7 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(246 /* ExternalModuleReference */); + var node = createNode(247 /* ExternalModuleReference */); parseExpected(131 /* RequireKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = parseModuleSpecifier(); @@ -18937,7 +18975,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(238 /* NamespaceImport */); + var namespaceImport = createNode(239 /* NamespaceImport */); parseExpected(38 /* AsteriskToken */); parseExpected(117 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -18952,14 +18990,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 239 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); + node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 240 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(244 /* ExportSpecifier */); + return parseImportOrExportSpecifier(245 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(240 /* ImportSpecifier */); + return parseImportOrExportSpecifier(241 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -18984,27 +19022,27 @@ var ts; else { node.name = identifierName; } - if (kind === 240 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 241 /* 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(242 /* ExportDeclaration */, fullStart); + var node = createNode(243 /* ExportDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38 /* AsteriskToken */)) { - parseExpected(138 /* FromKeyword */); + parseExpected(139 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(243 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(244 /* 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() === 138 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(138 /* FromKeyword */); + if (token() === 139 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(139 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -19012,7 +19050,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(241 /* ExportAssignment */, fullStart); + var node = createNode(242 /* ExportAssignment */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57 /* EqualsToken */)) { @@ -19094,10 +19132,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1 /* Export */) - || node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 246 /* ExternalModuleReference */ - || node.kind === 236 /* ImportDeclaration */ - || node.kind === 241 /* ExportAssignment */ - || node.kind === 242 /* ExportDeclaration */ + || node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 247 /* ExternalModuleReference */ + || node.kind === 237 /* ImportDeclaration */ + || node.kind === 242 /* ExportAssignment */ + || node.kind === 243 /* ExportDeclaration */ ? node : undefined; }); @@ -19172,7 +19210,7 @@ var ts; // Parses out a JSDoc type expression. /* @internal */ function parseJSDocTypeExpression() { - var result = createNode(263 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(264 /* JSDocTypeExpression */, scanner.getTokenPos()); parseExpected(16 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(17 /* CloseBraceToken */); @@ -19183,12 +19221,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48 /* BarToken */) { - var unionType = createNode(267 /* JSDocUnionType */, type.pos); + var unionType = createNode(268 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57 /* EqualsToken */) { - var optionalType = createNode(274 /* JSDocOptionalType */, type.pos); + var optionalType = createNode(275 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -19199,20 +19237,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20 /* OpenBracketToken */) { - var arrayType = createNode(266 /* JSDocArrayType */, type.pos); + var arrayType = createNode(267 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21 /* CloseBracketToken */); type = finishNode(arrayType); } else if (token() === 54 /* QuestionToken */) { - var nullableType = createNode(269 /* JSDocNullableType */, type.pos); + var nullableType = createNode(270 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50 /* ExclamationToken */) { - var nonNullableType = createNode(270 /* JSDocNonNullableType */, type.pos); + var nonNullableType = createNode(271 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -19246,14 +19284,15 @@ var ts; case 98 /* ThisKeyword */: return parseJSDocThisType(); case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: case 94 /* NullKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: + case 133 /* ObjectKeyword */: return parseTokenNode(); case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -19264,27 +19303,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(278 /* JSDocThisType */); + var result = createNode(279 /* JSDocThisType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(277 /* JSDocConstructorType */); + var result = createNode(278 /* JSDocConstructorType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(276 /* JSDocVariadicType */); + var result = createNode(277 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(275 /* JSDocFunctionType */); + var result = createNode(276 /* JSDocFunctionType */); nextToken(); parseExpected(18 /* OpenParenToken */); result.parameters = parseDelimitedList(23 /* JSDocFunctionParameters */, parseJSDocParameter); @@ -19297,7 +19336,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(144 /* Parameter */); + var parameter = createNode(145 /* Parameter */); parameter.type = parseJSDocType(); if (parseOptional(57 /* EqualsToken */)) { // TODO(rbuckton): Can this be changed to SyntaxKind.QuestionToken? @@ -19306,7 +19345,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(273 /* JSDocTypeReference */); + var result = createNode(274 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); if (token() === 26 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); @@ -19341,24 +19380,24 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(141 /* QualifiedName */, left.pos); + var result = createNode(142 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(271 /* JSDocRecordType */); + var result = createNode(272 /* JSDocRecordType */); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(270 /* JSDocNonNullableType */); + var result = createNode(271 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(268 /* JSDocTupleType */); + var result = createNode(269 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(26 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -19372,7 +19411,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(267 /* JSDocUnionType */); + var result = createNode(268 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19 /* CloseParenToken */); @@ -19388,12 +19427,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(264 /* JSDocAllType */); + var result = createNode(265 /* JSDocAllType */); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(289 /* JSDocLiteralType */); + var result = createNode(290 /* JSDocLiteralType */); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -19416,11 +19455,11 @@ var ts; token() === 28 /* GreaterThanToken */ || token() === 57 /* EqualsToken */ || token() === 48 /* BarToken */) { - var result = createNode(265 /* JSDocUnknownType */, pos); + var result = createNode(266 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(269 /* JSDocNullableType */, pos); + var result = createNode(270 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -19585,7 +19624,7 @@ var ts; content.charCodeAt(start + 3) !== 42 /* asterisk */; } function createJSDocComment() { - var result = createNode(279 /* JSDocComment */, start); + var result = createNode(280 /* JSDocComment */, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -19701,7 +19740,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(280 /* JSDocTag */, atToken.pos); + var result = createNode(281 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -19758,7 +19797,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(282 /* JSDocParameterTag */, atToken.pos); + var result = createNode(283 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -19769,20 +19808,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283 /* JSDocReturnTag */, atToken.pos); + var result = createNode(284 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(284 /* JSDocTypeTag */, atToken.pos); + var result = createNode(285 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -19797,7 +19836,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(287 /* JSDocPropertyTag */, atToken.pos); + var result = createNode(288 /* JSDocPropertyTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -19806,7 +19845,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(281 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(282 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -19815,25 +19854,30 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(286 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(287 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); if (typedefTag.fullName) { var rightNode = typedefTag.fullName; - while (rightNode.kind !== 70 /* Identifier */) { + while (true) { + if (rightNode.kind === 70 /* Identifier */ || !rightNode.body) { + // if node is identifier - use it as name + // otherwise use name of the rightmost part that we were able to parse + typedefTag.name = rightNode.kind === 70 /* Identifier */ ? rightNode : rightNode.name; + break; + } rightNode = rightNode.body; } - typedefTag.name = rightNode; } typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 273 /* JSDocTypeReference */) { + if (typeExpression.type.kind === 274 /* JSDocTypeReference */) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70 /* Identifier */) { - var name_14 = jsDocTypeReference.name; - if (name_14.text === "Object") { + var name = jsDocTypeReference.name; + if (name.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -19847,7 +19891,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(288 /* JSDocTypeLiteral */, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(289 /* JSDocTypeLiteral */, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -19888,7 +19932,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22 /* DotToken */)) { - var jsDocNamespaceNode = createNode(231 /* ModuleDeclaration */, pos); + var jsDocNamespaceNode = createNode(232 /* ModuleDeclaration */, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */); @@ -19934,20 +19978,20 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 285 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 286 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } // Type parameter list looks like '@template T,U,V' var typeParameters = createNodeArray(); while (true) { - var name_15 = parseJSDocIdentifierName(); + var name = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_15) { + if (!name) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143 /* TypeParameter */, name_15.pos); - typeParameter.name = name_15; + var typeParameter = createNode(144 /* TypeParameter */, name.pos); + typeParameter.name = name; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25 /* CommaToken */) { @@ -19958,7 +20002,7 @@ var ts; break; } } - var result = createNode(285 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(286 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -20478,16 +20522,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 228 /* InterfaceDeclaration */ || node.kind === 229 /* TypeAliasDeclaration */) { + if (node.kind === 229 /* InterfaceDeclaration */ || node.kind === 230 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 236 /* ImportDeclaration */ || node.kind === 235 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { + else if ((node.kind === 237 /* ImportDeclaration */ || node.kind === 236 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { return 0 /* NonInstantiated */; } - else if (node.kind === 232 /* ModuleBlock */) { + else if (node.kind === 233 /* ModuleBlock */) { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -20506,7 +20550,7 @@ var ts; }); return state_1; } - else if (node.kind === 231 /* ModuleDeclaration */) { + else if (node.kind === 232 /* ModuleDeclaration */) { var body = node.body; return body ? getModuleInstanceState(body) : 1 /* Instantiated */; } @@ -20647,7 +20691,7 @@ var ts; if (symbolFlags & 107455 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 231 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 232 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -20660,7 +20704,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { var nameExpression = node.name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteral(nameExpression)) { @@ -20672,21 +20716,21 @@ var ts; return node.name.text; } switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: return "__constructor"; - case 158 /* FunctionType */: - case 153 /* CallSignature */: + case 159 /* FunctionType */: + case 154 /* CallSignature */: return "__call"; - case 159 /* ConstructorType */: - case 154 /* ConstructSignature */: + case 160 /* ConstructorType */: + case 155 /* ConstructSignature */: return "__new"; - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return "__index"; - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return "__export"; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2 /* ModuleExports */: // module.exports = ... @@ -20701,22 +20745,22 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 226 /* FunctionDeclaration */: - case 227 /* ClassDeclaration */: + case 227 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: return ts.hasModifier(node, 512 /* Default */) ? "default" : undefined; - case 275 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 144 /* Parameter */: + case 145 /* Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 275 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 276 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 206 /* VariableStatement */) { + if (parentNode && parentNode.kind === 207 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -20771,15 +20815,18 @@ var ts; // Otherwise, we'll be merging into a compatible existing symbol (for example when // you have multiple 'vars' with the same name in the same container). In this case // just add this node into the declarations list of the symbol. - symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0 /* None */, name)); + symbol = symbolTable.get(name); + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(0 /* None */, name)); + } if (name && (includes & 788448 /* Classifiable */)) { - classifiableNames[name] = name; + classifiableNames.set(name, name); } if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { // Javascript constructor-declared symbols can be discarded in favor of // prototype symbols like methods. - symbol = symbolTable[name] = createSymbol(0 /* None */, name); + symbolTable.set(name, symbol = createSymbol(0 /* None */, name)); } else { if (node.name) { @@ -20803,7 +20850,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 241 /* ExportAssignment */ && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 242 /* ExportAssignment */ && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -20823,7 +20870,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 244 /* ExportSpecifier */ || (node.kind === 235 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 245 /* ExportSpecifier */ || (node.kind === 236 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -20846,7 +20893,7 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - var isJSDocTypedefInJSDocNamespace = node.kind === 286 /* JSDocTypedefTag */ && + var isJSDocTypedefInJSDocNamespace = node.kind === 287 /* JSDocTypedefTag */ && node.name && node.name.kind === 70 /* Identifier */ && node.name.isInJSDocNamespace; @@ -20933,7 +20980,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 262 /* SourceFile */) { + if (node.kind === 263 /* SourceFile */) { node.flags |= emitFlags; } if (isIIFE) { @@ -21012,64 +21059,64 @@ var ts; return; } switch (node.kind) { - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: bindWhileStatement(node); break; - case 210 /* DoStatement */: + case 211 /* DoStatement */: bindDoStatement(node); break; - case 212 /* ForStatement */: + case 213 /* ForStatement */: bindForStatement(node); break; - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 209 /* IfStatement */: + case 210 /* IfStatement */: bindIfStatement(node); break; - case 217 /* ReturnStatement */: - case 221 /* ThrowStatement */: + case 218 /* ReturnStatement */: + case 222 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 216 /* BreakStatement */: - case 215 /* ContinueStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 222 /* TryStatement */: + case 223 /* TryStatement */: bindTryStatement(node); break; - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: bindSwitchStatement(node); break; - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: bindCaseBlock(node); break; - case 254 /* CaseClause */: + case 255 /* CaseClause */: bindCaseClause(node); break; - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: bindLabeledStatement(node); break; - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: bindBinaryExpressionFlow(node); break; - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 179 /* CallExpression */: + case 180 /* CallExpression */: bindCallExpressionFlow(node); break; default: @@ -21081,15 +21128,15 @@ var ts; switch (expr.kind) { case 70 /* Identifier */: case 98 /* ThisKeyword */: - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return isNarrowableReference(expr); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return hasNarrowableArgument(expr); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isNarrowingExpression(expr.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return expr.operator === 50 /* ExclamationToken */ && isNarrowingExpression(expr.operand); } return false; @@ -21097,7 +21144,7 @@ var ts; function isNarrowableReference(expr) { return expr.kind === 70 /* Identifier */ || expr.kind === 98 /* ThisKeyword */ || - expr.kind === 177 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); + expr.kind === 178 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -21108,14 +21155,14 @@ var ts; } } } - if (expr.expression.kind === 177 /* PropertyAccessExpression */ && + if (expr.expression.kind === 178 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression.expression)) { return true; } return false; } function isNarrowingTypeofOperands(expr1, expr2) { - return expr1.kind === 187 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */; + return expr1.kind === 188 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { @@ -21136,9 +21183,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (expr.operatorToken.kind) { case 57 /* EqualsToken */: return isNarrowableOperand(expr.left); @@ -21233,33 +21280,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 209 /* IfStatement */: - case 211 /* WhileStatement */: - case 210 /* DoStatement */: + case 210 /* IfStatement */: + case 212 /* WhileStatement */: + case 211 /* DoStatement */: return parent.expression === node; - case 212 /* ForStatement */: - case 193 /* ConditionalExpression */: + case 213 /* ForStatement */: + case 194 /* ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 183 /* ParenthesizedExpression */) { + if (node.kind === 184 /* ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 190 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) { + else if (node.kind === 191 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) { node = node.operand; } else { - return node.kind === 192 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ || + return node.kind === 193 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ || node.operatorToken.kind === 53 /* BarBarToken */); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 183 /* ParenthesizedExpression */ || - node.parent.kind === 190 /* PrefixUnaryExpression */ && + while (node.parent.kind === 184 /* ParenthesizedExpression */ || + node.parent.kind === 191 /* PrefixUnaryExpression */ && node.parent.operator === 50 /* ExclamationToken */) { node = node.parent; } @@ -21301,7 +21348,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 220 /* LabeledStatement */ + var enclosingLabeledStatement = node.parent.kind === 221 /* LabeledStatement */ ? ts.lastOrUndefined(activeLabels) : undefined; // if do statement is wrapped in labeled statement then target labels for break/continue with or without @@ -21338,7 +21385,7 @@ var ts; bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 225 /* VariableDeclarationList */) { + if (node.initializer.kind !== 226 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -21360,7 +21407,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 217 /* ReturnStatement */) { + if (node.kind === 218 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -21380,7 +21427,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 216 /* BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 217 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -21446,7 +21493,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 255 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 256 /* DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -21513,14 +21560,14 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 210 /* DoStatement */) { + if (!node.statement || node.statement.kind !== 211 /* DoStatement */) { // do statement sets current flow inside bindDoStatement addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) { + if (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -21531,10 +21578,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 175 /* ArrayLiteralExpression */) { + else if (node.kind === 176 /* ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 196 /* SpreadElement */) { + if (e.kind === 197 /* SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -21542,16 +21589,16 @@ var ts; } } } - else if (node.kind === 176 /* ObjectLiteralExpression */) { + else if (node.kind === 177 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 258 /* PropertyAssignment */) { + if (p.kind === 259 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 259 /* ShorthandPropertyAssignment */) { + else if (p.kind === 260 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 260 /* SpreadAssignment */) { + else if (p.kind === 261 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -21607,7 +21654,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 57 /* EqualsToken */ && node.left.kind === 178 /* ElementAccessExpression */) { + if (operator === 57 /* EqualsToken */ && node.left.kind === 179 /* ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -21618,7 +21665,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 177 /* PropertyAccessExpression */) { + if (node.expression.kind === 178 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -21651,7 +21698,7 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 213 /* ForInStatement */ || node.parent.parent.kind === 214 /* ForOfStatement */) { + if (node.initializer || node.parent.parent.kind === 214 /* ForInStatement */ || node.parent.parent.kind === 215 /* ForOfStatement */) { bindInitializedVariableFlow(node); } } @@ -21660,10 +21707,10 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = node.expression; - while (expr.kind === 183 /* ParenthesizedExpression */) { + while (expr.kind === 184 /* ParenthesizedExpression */) { expr = expr.expression; } - if (expr.kind === 184 /* FunctionExpression */ || expr.kind === 185 /* ArrowFunction */) { + if (expr.kind === 185 /* FunctionExpression */ || expr.kind === 186 /* ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -21671,7 +21718,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 177 /* PropertyAccessExpression */) { + if (node.expression.kind === 178 /* PropertyAccessExpression */) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -21680,52 +21727,52 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 197 /* ClassExpression */: - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: - case 176 /* ObjectLiteralExpression */: - case 161 /* TypeLiteral */: - case 288 /* JSDocTypeLiteral */: - case 271 /* JSDocRecordType */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 177 /* ObjectLiteralExpression */: + case 162 /* TypeLiteral */: + case 289 /* JSDocTypeLiteral */: + case 272 /* JSDocRecordType */: return 1 /* IsContainer */; - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 275 /* JSDocFunctionType */: - case 231 /* ModuleDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 170 /* MappedType */: + case 276 /* JSDocFunctionType */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 171 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 262 /* SourceFile */: + case 263 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */; } - case 150 /* Constructor */: - case 226 /* FunctionDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 257 /* CatchClause */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 233 /* CaseBlock */: + case 258 /* CatchClause */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 234 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 205 /* Block */: + case 206 /* 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. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -21762,42 +21809,42 @@ 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 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 262 /* SourceFile */: + case 263 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 197 /* ClassExpression */: - case 227 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 161 /* TypeLiteral */: - case 176 /* ObjectLiteralExpression */: - case 228 /* InterfaceDeclaration */: - case 271 /* JSDocRecordType */: - case 288 /* JSDocTypeLiteral */: + case 162 /* TypeLiteral */: + case 177 /* ObjectLiteralExpression */: + case 229 /* InterfaceDeclaration */: + case 272 /* JSDocRecordType */: + case 289 /* JSDocTypeLiteral */: // 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 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 275 /* JSDocFunctionType */: - case 229 /* TypeAliasDeclaration */: - case 170 /* MappedType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 276 /* JSDocFunctionType */: + case 230 /* TypeAliasDeclaration */: + case 171 /* MappedType */: // 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 @@ -21818,11 +21865,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 262 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 262 /* SourceFile */ || body.kind === 232 /* ModuleBlock */)) { + var body = node.kind === 263 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 263 /* SourceFile */ || body.kind === 233 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 242 /* ExportDeclaration */ || stat.kind === 241 /* ExportAssignment */) { + if (stat.kind === 243 /* ExportDeclaration */ || stat.kind === 242 /* ExportAssignment */) { return true; } } @@ -21846,7 +21893,7 @@ var ts; errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (ts.isExternalModuleAugmentation(node)) { - declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); + declareModuleSymbol(node); } else { var pattern = void 0; @@ -21866,12 +21913,8 @@ var ts; } } else { - var state = getModuleInstanceState(node); - if (state === 0 /* NonInstantiated */) { - declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); - } - else { - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + var state = declareModuleSymbol(node); + if (state !== 0 /* NonInstantiated */) { 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 @@ -21891,6 +21934,12 @@ var ts; } } } + function declareModuleSymbol(node) { + var state = getModuleInstanceState(node); + var instantiated = state !== 0 /* NonInstantiated */; + declareSymbolAndAddToSymbolTable(node, instantiated ? 512 /* ValueModule */ : 1024 /* NamespaceModule */, instantiated ? 106639 /* ValueModuleExcludes */ : 0 /* NamespaceModuleExcludes */); + return state; + } function bindFunctionOrConstructorType(node) { // For a given function symbol "<...>(...) => T" we want to generate a symbol identical // to the one we would get for: { <...>(...): T } @@ -21903,7 +21952,7 @@ var ts; var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); typeLiteralSymbol.members = ts.createMap(); - typeLiteralSymbol.members[symbol.name] = symbol; + typeLiteralSymbol.members.set(symbol.name, symbol); } function bindObjectLiteralExpression(node) { var ElementKind; @@ -21915,7 +21964,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 260 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { + if (prop.kind === 261 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { continue; } var identifier = prop.name; @@ -21927,12 +21976,12 @@ 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 === 258 /* PropertyAssignment */ || prop.kind === 259 /* ShorthandPropertyAssignment */ || prop.kind === 149 /* MethodDeclaration */ + var currentKind = prop.kind === 259 /* PropertyAssignment */ || prop.kind === 260 /* ShorthandPropertyAssignment */ || prop.kind === 150 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; - var existingKind = seen[identifier.text]; + var existingKind = seen.get(identifier.text); if (!existingKind) { - seen[identifier.text] = currentKind; + seen.set(identifier.text, currentKind); continue; } if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) { @@ -21949,10 +21998,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 262 /* SourceFile */: + case 263 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -22063,8 +22112,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 262 /* SourceFile */ && - blockScopeContainer.kind !== 231 /* ModuleDeclaration */ && + if (blockScopeContainer.kind !== 263 /* SourceFile */ && + blockScopeContainer.kind !== 232 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -22130,7 +22179,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 140 /* LastToken */) { + if (node.kind > 141 /* LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -22177,23 +22226,23 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 286 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 287 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); break; } case 98 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 259 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 260 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } break; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: if (ts.isInJavaScriptFile(node)) { var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { @@ -22217,48 +22266,48 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return checkStrictModeCatchClause(node); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return checkStrictModeWithStatement(node); - case 167 /* ThisType */: + case 168 /* ThisType */: seenThisKeyword = true; return; - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return checkTypePredicate(node); - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530920 /* TypeParameterExcludes */); - case 144 /* Parameter */: + case 145 /* Parameter */: return bindParameter(node); - case 224 /* VariableDeclaration */: - case 174 /* BindingElement */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 272 /* JSDocRecordMember */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 273 /* JSDocRecordMember */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); - case 287 /* JSDocPropertyTag */: + case 288 /* JSDocPropertyTag */: return bindJSDocProperty(node); - case 258 /* PropertyAssignment */: - case 259 /* ShorthandPropertyAssignment */: + case 259 /* PropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 261 /* EnumMember */: + case 262 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); - case 260 /* SpreadAssignment */: - case 252 /* JsxSpreadAttribute */: + case 261 /* SpreadAssignment */: + case 253 /* JsxSpreadAttribute */: var root = container; var hasRest = false; while (root.parent) { - if (root.kind === 176 /* ObjectLiteralExpression */ && - root.parent.kind === 192 /* BinaryExpression */ && + if (root.kind === 177 /* ObjectLiteralExpression */ && + root.parent.kind === 193 /* BinaryExpression */ && root.parent.operatorToken.kind === 57 /* EqualsToken */ && root.parent.left === root) { hasRest = true; @@ -22267,86 +22316,86 @@ var ts; root = root.parent; } return; - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* 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) ? 0 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return bindFunctionDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 275 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 276 /* JSDocFunctionType */: return bindFunctionOrConstructorType(node); - case 161 /* TypeLiteral */: - case 170 /* MappedType */: - case 288 /* JSDocTypeLiteral */: - case 271 /* JSDocRecordType */: + case 162 /* TypeLiteral */: + case 171 /* MappedType */: + case 289 /* JSDocTypeLiteral */: + case 272 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return bindFunctionExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 197 /* ClassExpression */: - case 227 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */); - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: if (!node.fullName || node.fullName.kind === 70 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); } break; - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Imports and exports - case 235 /* ImportEqualsDeclaration */: - case 238 /* NamespaceImport */: - case 240 /* ImportSpecifier */: - case 244 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 234 /* NamespaceExportDeclaration */: + case 235 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 237 /* ImportClause */: + case 238 /* ImportClause */: return bindImportClause(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return bindExportDeclaration(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return bindExportAssignment(node); - case 262 /* SourceFile */: + case 263 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 205 /* Block */: + case 206 /* Block */: if (!ts.isFunctionLike(node.parent)) { return; } // Fall through - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); } } @@ -22355,7 +22404,7 @@ var ts; if (parameterName && parameterName.kind === 70 /* Identifier */) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 167 /* ThisType */) { + if (parameterName && parameterName.kind === 168 /* ThisType */) { seenThisKeyword = true; } bind(type); @@ -22378,7 +22427,7 @@ var ts; // An export default clause with an expression exports a value // We want to exclude both class and function here, this is necessary to issue an error when there are both // default export-assignment and default export function and class declaration. - var flags = node.kind === 241 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 242 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) ? 8388608 /* Alias */ : 4 /* Property */; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 /* Property */ | 8388608 /* AliasExcludes */ | 32 /* Class */ | 16 /* Function */); @@ -22388,17 +22437,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 262 /* SourceFile */) { + if (node.parent.kind !== 263 /* SourceFile */) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_4 = node.parent; - if (!ts.isExternalModule(parent_4)) { + var parent_1 = node.parent; + if (!ts.isExternalModule(parent_1)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_4.isDeclarationFile) { + if (!parent_1.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -22443,12 +22492,12 @@ var ts; function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); // Declare a 'member' if the container is an ES5 class or ES6 constructor - if (container.kind === 226 /* FunctionDeclaration */ || container.kind === 184 /* FunctionExpression */) { + if (container.kind === 227 /* FunctionDeclaration */ || container.kind === 185 /* FunctionExpression */) { container.symbol.members = container.symbol.members || ts.createMap(); // It's acceptable for multiple 'this' assignments of the same identifier to occur declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */); } - else if (container.kind === 150 /* Constructor */) { + else if (container.kind === 151 /* Constructor */) { // this.foo assignment in a JavaScript class // Bind this property to the containing class var saveContainer = container; @@ -22472,7 +22521,7 @@ var ts; leftSideOfAssignment.parent = node; constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - var funcSymbol = container.locals[constructorFunction.text]; + var funcSymbol = container.locals.get(constructorFunction.text); if (!funcSymbol || !(funcSymbol.flags & 16 /* Function */ || ts.isDeclarationOfFunctionExpression(funcSymbol))) { return; } @@ -22491,7 +22540,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 227 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -22499,7 +22548,7 @@ var ts; bindAnonymousDeclaration(node, 32 /* Class */, bindingName); // Add name of class expression into the map for semantic classifier if (node.name) { - classifiableNames[node.name.text] = node.name.text; + classifiableNames.set(node.name.text, node.name.text); } } var symbol = node.symbol; @@ -22513,13 +22562,14 @@ var ts; // module might have an exported variable called 'prototype'. We can't allow that as // that would clash with the built-in 'prototype' for the class. var prototypeSymbol = createSymbol(4 /* Property */ | 134217728 /* Prototype */, "prototype"); - if (symbol.exports[prototypeSymbol.name]) { + var symbolExport = symbol.exports.get(prototypeSymbol.name); + if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; + symbol.exports.set(prototypeSymbol.name, prototypeSymbol); prototypeSymbol.parent = symbol; } function bindEnumDeclaration(node) { @@ -22627,13 +22677,13 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 207 /* EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 208 /* EmptyStatement */) || // report error on class declarations - node.kind === 227 /* ClassDeclaration */ || + node.kind === 228 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 231 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 232 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 230 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 231 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; // unreachable code is reported if @@ -22647,7 +22697,7 @@ var ts; // On the other side we do want to report errors on non-initialized 'lets' because of TDZ var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 206 /* VariableStatement */ || + (node.kind !== 207 /* VariableStatement */ || ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -22667,56 +22717,56 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 179 /* CallExpression */: + case 180 /* CallExpression */: return computeCallExpression(node, subtreeFlags); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return computeNewExpression(node, subtreeFlags); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return computeModuleDeclaration(node, subtreeFlags); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return computeParenthesizedExpression(node, subtreeFlags); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return computeBinaryExpression(node, subtreeFlags); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return computeExpressionStatement(node, subtreeFlags); - case 144 /* Parameter */: + case 145 /* Parameter */: return computeParameter(node, subtreeFlags); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return computeArrowFunction(node, subtreeFlags); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return computeFunctionExpression(node, subtreeFlags); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return computeFunctionDeclaration(node, subtreeFlags); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return computeVariableDeclaration(node, subtreeFlags); - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return computeVariableDeclarationList(node, subtreeFlags); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return computeVariableStatement(node, subtreeFlags); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return computeLabeledStatement(node, subtreeFlags); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return computeClassDeclaration(node, subtreeFlags); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return computeCatchClause(node, subtreeFlags); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); - case 150 /* Constructor */: + case 151 /* Constructor */: return computeConstructor(node, subtreeFlags); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return computePropertyDeclaration(node, subtreeFlags); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return computeMethod(node, subtreeFlags); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return computeAccessor(node, subtreeFlags); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return computeImportEquals(node, subtreeFlags); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return computePropertyAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -22743,8 +22793,8 @@ var ts; switch (kind) { case 96 /* SuperKeyword */: return true; - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: var expression = node.expression; var expressionKind = expression.kind; return expressionKind === 96 /* SuperKeyword */; @@ -22768,12 +22818,12 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ObjectLiteralExpression */) { + if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 177 /* ObjectLiteralExpression */) { // Destructuring object assignments with are ES2015 syntax // and possibly ESNext if they contain rest transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } - else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 175 /* ArrayLiteralExpression */) { + else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ArrayLiteralExpression */) { // Destructuring assignments are ES2015 syntax. transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } @@ -22823,8 +22873,8 @@ 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 (expressionKind === 200 /* AsExpression */ - || expressionKind === 182 /* TypeAssertionExpression */) { + if (expressionKind === 201 /* AsExpression */ + || expressionKind === 183 /* TypeAssertionExpression */) { transformFlags |= 3 /* AssertTypeScript */; } // If the expression of a ParenthesizedExpression is a destructuring assignment, @@ -23189,7 +23239,7 @@ var ts; var excludeFlags = 536872257 /* NodeExcludes */; switch (kind) { case 119 /* AsyncKeyword */: - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: // async/await is ES2017 syntax transformFlags |= 16 /* AssertES2017 */; break; @@ -23199,27 +23249,27 @@ var ts; case 116 /* AbstractKeyword */: case 123 /* DeclareKeyword */: case 75 /* ConstKeyword */: - case 230 /* EnumDeclaration */: - case 261 /* EnumMember */: - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: - case 201 /* NonNullExpression */: + case 231 /* EnumDeclaration */: + case 262 /* EnumMember */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: + case 202 /* NonNullExpression */: case 130 /* ReadonlyKeyword */: // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; break; - case 247 /* JsxElement */: - case 248 /* JsxSelfClosingElement */: - case 249 /* JsxOpeningElement */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: case 10 /* JsxText */: - case 250 /* JsxClosingElement */: - case 251 /* JsxAttribute */: - case 252 /* JsxSpreadAttribute */: - case 253 /* JsxExpression */: + case 251 /* JsxClosingElement */: + case 252 /* JsxAttribute */: + case 253 /* JsxSpreadAttribute */: + case 254 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: // for-of might be ESNext if it has a rest destructuring transformFlags |= 8 /* AssertESNext */; // FALLTHROUGH @@ -23227,54 +23277,55 @@ var ts; case 13 /* TemplateHead */: case 14 /* TemplateMiddle */: case 15 /* TemplateTail */: - case 194 /* TemplateExpression */: - case 181 /* TaggedTemplateExpression */: - case 259 /* ShorthandPropertyAssignment */: + case 195 /* TemplateExpression */: + case 182 /* TaggedTemplateExpression */: + case 260 /* ShorthandPropertyAssignment */: case 114 /* StaticKeyword */: - case 202 /* MetaProperty */: + case 203 /* MetaProperty */: // These nodes are ES6 syntax. transformFlags |= 192 /* AssertES2015 */; break; - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: // This node is ES6 syntax. transformFlags |= 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; break; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: - case 134 /* StringKeyword */: + case 133 /* ObjectKeyword */: + case 135 /* StringKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 143 /* TypeParameter */: - case 146 /* PropertySignature */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 156 /* TypePredicate */: - case 157 /* TypeReference */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 160 /* TypeQuery */: - case 161 /* TypeLiteral */: - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 167 /* ThisType */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 171 /* LiteralType */: + case 144 /* TypeParameter */: + case 147 /* PropertySignature */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 157 /* TypePredicate */: + case 158 /* TypeReference */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 161 /* TypeQuery */: + case 162 /* TypeLiteral */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* ParenthesizedType */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 168 /* ThisType */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 172 /* LiteralType */: // Types and signatures are TypeScript syntax, and exclude all other facts. transformFlags = 3 /* AssertTypeScript */; excludeFlags = -3 /* TypeExcludes */; break; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: // Even though computed property names are ES6, we don't treat them as such. // This is so that they can flow through PropertyName transforms unaffected. // Instead, we mark the container as ES6, so that it can properly handle the transform. @@ -23291,10 +23342,10 @@ var ts; transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */; } break; - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 96 /* SuperKeyword */: @@ -23305,28 +23356,28 @@ var ts; // Mark this node and its ancestors as containing a lexical `this` keyword. transformFlags |= 16384 /* ContainsLexicalThis */; break; - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; if (subtreeFlags & 524288 /* ContainsRest */) { transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */; } excludeFlags = 537396545 /* BindingPatternExcludes */; break; - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; excludeFlags = 537396545 /* BindingPatternExcludes */; break; - case 174 /* BindingElement */: + case 175 /* BindingElement */: transformFlags |= 192 /* AssertES2015 */; if (node.dotDotDotToken) { transformFlags |= 524288 /* ContainsRest */; } break; - case 145 /* Decorator */: + case 146 /* Decorator */: // This node is TypeScript syntax, and marks its container as also being TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */; break; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: excludeFlags = 540087617 /* ObjectLiteralExcludes */; if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) { // If an ObjectLiteralExpression contains a ComputedPropertyName, then it @@ -23344,8 +23395,8 @@ var ts; transformFlags |= 8 /* AssertESNext */; } break; - case 175 /* ArrayLiteralExpression */: - case 180 /* NewExpression */: + case 176 /* ArrayLiteralExpression */: + case 181 /* NewExpression */: excludeFlags = 537396545 /* ArrayLiteralOrCallOrNewExcludes */; if (subtreeFlags & 524288 /* ContainsSpread */) { // If the this node contains a SpreadExpression, then it is an ES6 @@ -23353,23 +23404,23 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 262 /* SourceFile */: + case 263 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 217 /* ReturnStatement */: - case 215 /* ContinueStatement */: - case 216 /* BreakStatement */: + case 218 /* ReturnStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; break; } @@ -23385,56 +23436,57 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */) { + if (kind >= 157 /* FirstTypeNode */ && kind <= 172 /* LastTypeNode */) { return -3 /* TypeExcludes */; } switch (kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 175 /* ArrayLiteralExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 176 /* ArrayLiteralExpression */: return 537396545 /* ArrayLiteralOrCallOrNewExcludes */; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return 574674241 /* ModuleExcludes */; - case 144 /* Parameter */: + case 145 /* Parameter */: return 536872257 /* ParameterExcludes */; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return 601249089 /* ArrowFunctionExcludes */; - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: return 601281857 /* FunctionExcludes */; - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return 546309441 /* VariableDeclarationListExcludes */; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return 539358529 /* ClassExcludes */; - case 150 /* Constructor */: + case 151 /* Constructor */: return 601015617 /* ConstructorExcludes */; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return 601015617 /* MethodOrAccessorExcludes */; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: + case 133 /* ObjectKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 143 /* TypeParameter */: - case 146 /* PropertySignature */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: + case 144 /* TypeParameter */: + case 147 /* PropertySignature */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: return -3 /* TypeExcludes */; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return 540087617 /* ObjectLiteralExcludes */; - case 257 /* CatchClause */: + case 258 /* CatchClause */: return 537920833 /* CatchClauseExcludes */; - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return 537396545 /* BindingPatternExcludes */; default: return 536872257 /* NodeExcludes */; @@ -23712,9 +23764,10 @@ var ts; if (!moduleHasNonRelativeName(nonRelativeModuleName)) { return undefined; } - var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); if (!perModuleNameCache) { - moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); } return perModuleNameCache; } @@ -23750,12 +23803,12 @@ var ts; var commonPrefix = getCommonPrefix(path, resolvedFileName); var current = path; while (true) { - var parent_5 = ts.getDirectoryPath(current); - if (parent_5 === current || directoryPathMap.contains(parent_5)) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { break; } - directoryPathMap.set(parent_5, result); - current = parent_5; + directoryPathMap.set(parent, result); + current = parent; if (current == commonPrefix) { break; } @@ -23788,7 +23841,7 @@ var ts; } var containingDirectory = ts.getDirectoryPath(containingFile); var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); - var result = perFolderCache && perFolderCache[moduleName]; + var result = perFolderCache && perFolderCache.get(moduleName); if (result) { if (traceEnabled) { trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); @@ -23816,7 +23869,7 @@ var ts; break; } if (perFolderCache) { - perFolderCache[moduleName] = result; + perFolderCache.set(moduleName, result); // put result in per-module name cache var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); if (perModuleNameCache) { @@ -24423,6 +24476,7 @@ var ts; getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, getTypeFromTypeNode: getTypeFromTypeNode, + getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, @@ -24447,6 +24501,7 @@ var ts; getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule, getAmbientModules: getAmbientModules, getJsxElementAttributesType: getJsxElementAttributesType, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, @@ -24484,6 +24539,7 @@ var ts; var voidType = createIntrinsicType(1024 /* Void */, "void"); var neverType = createIntrinsicType(8192 /* Never */, "never"); var silentNeverType = createIntrinsicType(8192 /* Never */, "never"); + var nonPrimitiveType = createIntrinsicType(16777216 /* NonPrimitive */, "object"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */ | 67108864 /* Transient */, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); @@ -24495,6 +24551,7 @@ var ts; // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); @@ -24627,7 +24684,7 @@ var ts; TypeFacts[TypeFacts["UndefinedFacts"] = 2457472] = "UndefinedFacts"; TypeFacts[TypeFacts["NullFacts"] = 2340752] = "NullFacts"; })(TypeFacts || (TypeFacts = {})); - var typeofEQFacts = ts.createMap({ + var typeofEQFacts = ts.createMapFromTemplate({ "string": 1 /* TypeofEQString */, "number": 2 /* TypeofEQNumber */, "boolean": 4 /* TypeofEQBoolean */, @@ -24636,7 +24693,7 @@ var ts; "object": 16 /* TypeofEQObject */, "function": 32 /* TypeofEQFunction */ }); - var typeofNEFacts = ts.createMap({ + var typeofNEFacts = ts.createMapFromTemplate({ "string": 128 /* TypeofNEString */, "number": 256 /* TypeofNENumber */, "boolean": 512 /* TypeofNEBoolean */, @@ -24645,7 +24702,7 @@ var ts; "object": 2048 /* TypeofNEObject */, "function": 4096 /* TypeofNEFunction */ }); - var typeofTypesByName = ts.createMap({ + var typeofTypesByName = ts.createMapFromTemplate({ "string": stringType, "number": numberType, "boolean": booleanType, @@ -24681,7 +24738,7 @@ var ts; TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType"; })(TypeSystemPropertyName || (TypeSystemPropertyName = {})); var builtinGlobals = ts.createMap(); - builtinGlobals[undefinedSymbol.name] = undefinedSymbol; + builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); initializeTypeChecker(); return checker; function getJsxNamespace() { @@ -24782,7 +24839,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 231 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 231 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 232 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 232 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } @@ -24799,6 +24856,9 @@ var ts; } recordMergedSymbol(target, source); } + else if (target.flags & 1024 /* NamespaceModule */) { + error(source.valueDeclaration.name, ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } else { var message_2 = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; @@ -24811,18 +24871,19 @@ var ts; } } function mergeSymbolTable(target, source) { - for (var id in source) { - var targetSymbol = target[id]; + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); if (!targetSymbol) { - target[id] = source[id]; + target.set(id, sourceSymbol); } else { if (!(targetSymbol.flags & 33554432 /* Merged */)) { - target[id] = targetSymbol = cloneSymbol(targetSymbol); + targetSymbol = cloneSymbol(targetSymbol); + target.set(id, targetSymbol); } - mergeSymbol(targetSymbol, source[id]); + mergeSymbol(targetSymbol, sourceSymbol); } - } + }); } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; @@ -24860,15 +24921,16 @@ var ts; } } function addToSymbolTable(target, source, message) { - for (var id in source) { - if (target[id]) { + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); + if (targetSymbol) { // Error on redeclarations - ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); } else { - target[id] = source[id]; + target.set(id, sourceSymbol); } - } + }); function addDeclarationDiagnostic(id, message) { return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; } @@ -24887,11 +24949,11 @@ var ts; return type.flags & 32768 /* Object */ ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 262 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 263 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { - var symbol = symbols[name]; + var symbol = symbols.get(name); if (symbol) { ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { @@ -24943,17 +25005,17 @@ var ts; } if (declaration.pos <= usage.pos) { // declaration is before usage - if (declaration.kind === 174 /* BindingElement */) { + if (declaration.kind === 175 /* BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 174 /* BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 175 /* BindingElement */); if (errorBindingElement) { return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 224 /* VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 225 /* VariableDeclaration */), usage); } - else if (declaration.kind === 224 /* VariableDeclaration */) { + else if (declaration.kind === 225 /* VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -24966,9 +25028,9 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 206 /* VariableStatement */: - case 212 /* ForStatement */: - case 214 /* ForOfStatement */: + case 207 /* VariableStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, container)) { @@ -24977,8 +25039,8 @@ var ts; break; } switch (declaration.parent.parent.kind) { - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: // ForIn/ForOf case - use site should not be used in expression part if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; @@ -24996,7 +25058,7 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 147 /* PropertyDeclaration */ && + current.parent.kind === 148 /* PropertyDeclaration */ && (ts.getModifierFlags(current.parent) & 32 /* Static */) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { @@ -25038,11 +25100,11 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 279 /* JSDocComment */) { + if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 280 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || - lastLocation.kind === 144 /* Parameter */ || - lastLocation.kind === 143 /* TypeParameter */ + lastLocation.kind === 145 /* Parameter */ || + lastLocation.kind === 144 /* TypeParameter */ : false; } if (meaning & 107455 /* Value */ && result.flags & 1 /* FunctionScopedVariable */) { @@ -25051,9 +25113,9 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 144 /* Parameter */ || + lastLocation.kind === 145 /* Parameter */ || (lastLocation === location.type && - result.valueDeclaration.kind === 144 /* Parameter */); + result.valueDeclaration.kind === 145 /* Parameter */); } } if (useResult) { @@ -25065,16 +25127,16 @@ var ts; } } switch (location.kind) { - case 262 /* SourceFile */: + case 263 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 262 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 263 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. - if (result = moduleExports["default"]) { + if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; @@ -25092,9 +25154,10 @@ var ts; // 2. We check === SymbolFlags.Alias in order to check that the symbol is *purely* // an alias. If we used &, we'd be throwing out symbols that have non alias aspects, // which is not the desired behavior. - if (moduleExports[name] && - moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 244 /* ExportSpecifier */)) { + var moduleExport = moduleExports.get(name); + if (moduleExport && + moduleExport.flags === 8388608 /* Alias */ && + ts.getDeclarationOfKind(moduleExport, 245 /* ExportSpecifier */)) { break; } } @@ -25102,13 +25165,13 @@ var ts; break loop; } break; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* 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 @@ -25125,9 +25188,9 @@ var ts; } } break; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064 /* Type */)) { if (lastLocation && ts.getModifierFlags(lastLocation) & 32 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -25138,7 +25201,7 @@ var ts; } break loop; } - if (location.kind === 197 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 198 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -25154,9 +25217,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 228 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 229 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -25164,19 +25227,19 @@ var ts; } } break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -25189,7 +25252,7 @@ var ts; } } break; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -25198,7 +25261,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 === 144 /* Parameter */) { + if (location.parent && location.parent.kind === 145 /* Parameter */) { location = location.parent; } // @@ -25262,7 +25325,7 @@ var ts; // If we're in an external module, we can't reference value symbols created from UMD export declarations if (result && isInExternalModule && (meaning & 107455 /* Value */) === 107455 /* Value */) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 234 /* NamespaceExportDeclaration */) { + if (decls && decls.length === 1 && decls[0].kind === 235 /* NamespaceExportDeclaration */) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } @@ -25316,9 +25379,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: ts.Debug.assert(ts.isEntityNameExpression(node.expression)); return node.expression; default: @@ -25371,10 +25434,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 235 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 236 /* ImportDeclaration */) { + while (node && node.kind !== 237 /* ImportDeclaration */) { node = node.parent; } return node; @@ -25384,7 +25447,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 246 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 247 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); @@ -25392,11 +25455,16 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ? - moduleSymbol : - moduleSymbol.exports["export="] ? - getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : - resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = void 0; + if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } + else { + var exportValue = moduleSymbol.exports.get("export="); + exportDefaultSymbol = exportValue + ? getPropertyOfType(getTypeOfSymbol(exportValue), "default") + : resolveSymbol(moduleSymbol.exports.get("default")); + } if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } @@ -25445,7 +25513,7 @@ var ts; } function getExportOfModule(symbol, name) { if (symbol.flags & 1536 /* Module */) { - var exportedSymbol = getExportsOfSymbol(symbol)[name]; + var exportedSymbol = getExportsOfSymbol(symbol).get(name); if (exportedSymbol) { return resolveSymbol(exportedSymbol); } @@ -25463,31 +25531,31 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_16 = specifier.propertyName || specifier.name; - if (name_16.text) { + var name = specifier.propertyName || specifier.name; + if (name.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; // First check if module was specified with "export=". If so, get the member from the resolved type - if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text); + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); } // if symbolFromVariable is export - get its final target symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_16.text); + var symbolFromModule = getExportOfModule(targetSymbol, name.text); // If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default - if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") { + if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16)); + error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); } return symbol; } @@ -25509,19 +25577,19 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 237 /* ImportClause */: + case 238 /* ImportClause */: return getTargetOfImportClause(node); - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 240 /* ImportSpecifier */: + case 241 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 244 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return getTargetOfExportAssignment(node); - case 234 /* NamespaceExportDeclaration */: + case 235 /* NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node); } } @@ -25568,11 +25636,11 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 241 /* ExportAssignment */) { + if (node.kind === 242 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 244 /* ExportSpecifier */) { + else if (node.kind === 245 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -25594,13 +25662,13 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 141 /* QualifiedName */) { + if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 142 /* QualifiedName */) { return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 235 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 236 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } @@ -25622,9 +25690,9 @@ var ts; return undefined; } } - else if (name.kind === 141 /* QualifiedName */ || name.kind === 177 /* PropertyAccessExpression */) { - var left = name.kind === 141 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 141 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 142 /* QualifiedName */ || name.kind === 178 /* PropertyAccessExpression */) { + var left = name.kind === 142 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 142 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1920 /* Namespace */, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -25723,7 +25791,7 @@ var ts; // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, // and an external module with no 'export =' declaration resolves to the module itself. function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="))) || moduleSymbol; } // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' // references a symbol that is at least declared as a module or a variable. The target of the 'export =' may @@ -25737,15 +25805,23 @@ var ts; return symbol; } function hasExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="] !== undefined; + return moduleSymbol.exports.get("export=") !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function getExportsAndPropertiesOfModule(moduleSymbol) { + var exports = getExportsOfModuleAsArray(moduleSymbol); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + ts.addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))); + } + return exports; + } function tryGetMemberInModuleExports(memberName, moduleSymbol) { var symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { - return symbolTable[memberName]; + return symbolTable.get(memberName); } } function getExportsOfSymbol(symbol) { @@ -25760,24 +25836,28 @@ var ts; * Not passing `lookupTable` and `exportNode` disables this collection, and just extends the tables */ function extendExportSymbols(target, source, lookupTable, exportNode) { - for (var id in source) { - if (id !== "default" && !target[id]) { - target[id] = source[id]; + source && source.forEach(function (sourceSymbol, id) { + if (id === "default") + return; + var targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); if (lookupTable && exportNode) { - lookupTable[id] = { + lookupTable.set(id, { specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) - }; + }); } } - else if (lookupTable && exportNode && id !== "default" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { - if (!lookupTable[id].exportsWithDuplicate) { - lookupTable[id].exportsWithDuplicate = [exportNode]; + else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + var collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; } else { - lookupTable[id].exportsWithDuplicate.push(exportNode); + collisionTracker.exportsWithDuplicate.push(exportNode); } } - } + }); } function getExportsForModule(moduleSymbol) { var visitedSymbols = []; @@ -25793,27 +25873,27 @@ var ts; visitedSymbols.push(symbol); var symbols = ts.cloneMap(symbol.exports); // All export * declarations are collected in an __export symbol by the binder - var exportStars = symbol.exports["__export"]; + var exportStars = symbol.exports.get("__export"); if (exportStars) { var nestedSymbols = ts.createMap(); - var lookupTable = ts.createMap(); + var lookupTable_1 = ts.createMap(); for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); var exportedSymbols = visit(resolvedModule); - extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node); } - for (var id in lookupTable) { - var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; + lookupTable_1.forEach(function (_a, id) { + var exportsWithDuplicate = _a.exportsWithDuplicate; // It's not an error if the file with multiple `export *`s with duplicate names exports a member with that name itself - if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) { - continue; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; } - for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { - var node = exportsWithDuplicate_1[_b]; - diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { + var node = exportsWithDuplicate_1[_i]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, id)); } - } + }); extendExportSymbols(symbols, nestedSymbols); } return symbols; @@ -25854,7 +25934,7 @@ var ts; var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 150 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 151 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -25894,16 +25974,15 @@ var ts; } function getNamedMembers(members) { var result; - for (var id in members) { + members.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { if (!result) result = []; - var symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } } - } + }); return result || emptyArray; } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { @@ -25922,20 +26001,20 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { + for (var location = enclosingDeclaration; location; location = location.parent) { // Locals of a source file are not in scope (because they get merged into the global symbol table) - if (location_1.locals && !isGlobalSourceFile(location_1)) { - if (result = callback(location_1.locals)) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { return result; } } - switch (location_1.kind) { - case 262 /* SourceFile */: - if (!ts.isExternalOrCommonJsModule(location_1)) { + switch (location.kind) { + case 263 /* SourceFile */: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 231 /* ModuleDeclaration */: - if (result = callback(getSymbolOfNode(location_1).exports)) { + case 232 /* ModuleDeclaration */: + if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; @@ -25979,14 +26058,14 @@ var ts; } function trySymbolTable(symbols) { // If symbol is directly available by its name in the symbol table - if (isAccessible(symbols[symbol.name])) { + if (isAccessible(symbols.get(symbol.name))) { return [symbol]; } // Check if symbol is any of the alias - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { + return ts.forEachEntry(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -26015,7 +26094,7 @@ var ts; var qualify = false; forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { // If symbol of this name is not available in the symbol table we are ok - var symbolFromSymbolTable = symbolTable[symbol.name]; + var symbolFromSymbolTable = symbolTable.get(symbol.name); if (!symbolFromSymbolTable) { // Continue to the next symbol table return false; @@ -26026,7 +26105,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, 244 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -26041,10 +26120,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: continue; default: return false; @@ -26125,7 +26204,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 263 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -26166,12 +26245,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 160 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === 161 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 141 /* QualifiedName */ || entityName.kind === 177 /* PropertyAccessExpression */ || - entityName.parent.kind === 235 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 142 /* QualifiedName */ || entityName.kind === 178 /* PropertyAccessExpression */ || + entityName.parent.kind === 236 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* Namespace */; @@ -26267,10 +26346,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 166 /* ParenthesizedType */) { + while (node.kind === 167 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 229 /* TypeAliasDeclaration */) { + if (node.kind === 230 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -26278,29 +26357,29 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 232 /* ModuleBlock */ && + node.parent.kind === 233 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { return type.flags & 32 /* StringLiteral */ ? "\"" + ts.escapeString(type.text) + "\"" : type.text; } - function getSymbolDisplayBuilder() { - function getNameOfSymbol(symbol) { - if (symbol.declarations && symbol.declarations.length) { - var declaration = symbol.declarations[0]; - if (declaration.name) { - return ts.declarationNameToString(declaration.name); - } - switch (declaration.kind) { - case 197 /* ClassExpression */: - return "(Anonymous class)"; - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - return "(Anonymous function)"; - } + function getNameOfSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + switch (declaration.kind) { + case 198 /* ClassExpression */: + return "(Anonymous class)"; + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + return "(Anonymous function)"; } - return symbol.name; } + return symbol.name; + } + function getSymbolDisplayBuilder() { /** * Writes only the name of the symbol out to the writer. Uses the original source text * for the name of the symbol if it is available to match how the user wrote the name. @@ -26370,9 +26449,9 @@ var ts; if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { // Go up and add our parent. - var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_6) { - walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + walkSymbol(parent, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); } } if (accessibleSymbolChain) { @@ -26410,7 +26489,7 @@ var ts; function writeType(type, flags) { var nextFlags = flags & ~512 /* InTypeAlias */; // Write undefined/null type as any - if (type.flags & 16015 /* Intrinsic */) { + if (type.flags & 16793231 /* 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" @@ -26522,14 +26601,14 @@ var ts; while (i < length_1) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); + writeSymbolTypeReference(parent, typeArguments, start, i, flags); writePunctuation(writer, 22 /* DotToken */); } } @@ -26556,7 +26635,8 @@ var ts; var symbol = type.symbol; if (symbol) { // Always use 'typeof T' for type of class, enum, and module objects - if (symbol.flags & (32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { + if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 /* Enum */ | 512 /* ValueModule */)) { writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -26595,7 +26675,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 262 /* SourceFile */ || declaration.parent.kind === 232 /* ModuleBlock */; + return declaration.parent.kind === 263 /* SourceFile */ || declaration.parent.kind === 233 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -26780,12 +26860,12 @@ var ts; } function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { // We have to explicitly emit square bracket and bracket because these tokens are not stored inside the node. - if (bindingPattern.kind === 172 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 173 /* ObjectBindingPattern */) { writePunctuation(writer, 16 /* OpenBraceToken */); buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 17 /* CloseBraceToken */); } - else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 174 /* ArrayBindingPattern */) { writePunctuation(writer, 20 /* OpenBracketToken */); var elements = bindingPattern.elements; buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); @@ -26799,7 +26879,7 @@ var ts; if (ts.isOmittedExpression(bindingElement)) { return; } - ts.Debug.assert(bindingElement.kind === 174 /* BindingElement */); + ts.Debug.assert(bindingElement.kind === 175 /* BindingElement */); if (bindingElement.propertyName) { writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55 /* ColonToken */); @@ -26923,7 +27003,7 @@ var ts; writeKeyword(writer, 132 /* NumberKeyword */); break; case 0 /* String */: - writeKeyword(writer, 134 /* StringKeyword */); + writeKeyword(writer, 135 /* StringKeyword */); break; } writePunctuation(writer, 21 /* CloseBracketToken */); @@ -26959,75 +27039,75 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174 /* BindingElement */: + case 175 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 224 /* VariableDeclaration */: + case 225 /* 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 231 /* ModuleDeclaration */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 226 /* FunctionDeclaration */: - case 230 /* EnumDeclaration */: - case 235 /* ImportEqualsDeclaration */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 227 /* FunctionDeclaration */: + case 231 /* EnumDeclaration */: + case 236 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_8 = getDeclarationContainer(node); + var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 235 /* ImportEqualsDeclaration */ && parent_8.kind !== 262 /* SourceFile */ && ts.isInAmbientContext(parent_8))) { - return isGlobalSourceFile(parent_8); + !(node.kind !== 236 /* ImportEqualsDeclaration */ && parent.kind !== 263 /* SourceFile */ && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_8); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + return isDeclarationVisible(parent); + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.getModifierFlags(node) & (8 /* Private */ | 16 /* Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so const it fall into next case statement - case 150 /* Constructor */: - case 154 /* ConstructSignature */: - case 153 /* CallSignature */: - case 155 /* IndexSignature */: - case 144 /* Parameter */: - case 232 /* ModuleBlock */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 161 /* TypeLiteral */: - case 157 /* TypeReference */: - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: + case 151 /* Constructor */: + case 155 /* ConstructSignature */: + case 154 /* CallSignature */: + case 156 /* IndexSignature */: + case 145 /* Parameter */: + case 233 /* ModuleBlock */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 162 /* TypeLiteral */: + case 158 /* TypeReference */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* 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 237 /* ImportClause */: - case 238 /* NamespaceImport */: - case 240 /* ImportSpecifier */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: return false; // Type parameters are always visible - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: // Source file and namespace export are always visible - case 262 /* SourceFile */: - case 234 /* NamespaceExportDeclaration */: + case 263 /* SourceFile */: + case 235 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return false; default: return false; @@ -27036,10 +27116,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 241 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 242 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 244 /* ExportSpecifier */) { + else if (node.parent.kind === 245 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -27132,12 +27212,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 224 /* VariableDeclaration */: - case 225 /* VariableDeclarationList */: - case 240 /* ImportSpecifier */: - case 239 /* NamedImports */: - case 238 /* NamespaceImport */: - case 237 /* ImportClause */: + case 225 /* VariableDeclaration */: + case 226 /* VariableDeclarationList */: + case 241 /* ImportSpecifier */: + case 240 /* NamedImports */: + case 239 /* NamespaceImport */: + case 238 /* ImportClause */: node = node.parent; break; default: @@ -27168,7 +27248,7 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false); } function isComputedNonLiteralName(name) { - return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression); + return name.kind === 143 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { source = filterType(source, function (t) { return !(t.flags & 6144 /* Nullable */); }); @@ -27181,17 +27261,16 @@ var ts; var members = ts.createMap(); var names = ts.createMap(); for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_17 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_17)] = true; + var name = properties_2[_i]; + names.set(ts.getTextOfPropertyName(name), true); } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; - var inNamesToRemove = prop.name in names; + var inNamesToRemove = names.has(prop.name); var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */); - var isMethod = prop.flags & 8192 /* Method */; var isSetOnlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */); - if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { - members[prop.name] = prop; + if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { + members.set(prop.name, prop); } } var stringIndexInfo = getIndexInfoOfType(source, 0 /* String */); @@ -27216,7 +27295,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 172 /* ObjectBindingPattern */) { + if (pattern.kind === 173 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); @@ -27233,8 +27312,8 @@ var ts; } else { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) - var name_18 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_18)) { + var name = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name)) { // computed properties with non-literal names are treated as 'any' return anyType; } @@ -27243,12 +27322,12 @@ var ts; } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - var text = ts.getTextOfPropertyName(name_18); + var text = ts.getTextOfPropertyName(name); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); if (!type) { - error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } @@ -27301,7 +27380,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 175 /* ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 176 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, optional) { return strictNullChecks && optional ? includeFalsyTypes(type, 2048 /* Undefined */) : type; @@ -27319,11 +27398,11 @@ var ts; } // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (declaration.parent.parent.kind === 213 /* ForInStatement */) { + if (declaration.parent.parent.kind === 214 /* ForInStatement */) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType; } - if (declaration.parent.parent.kind === 214 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 215 /* 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, @@ -27338,7 +27417,7 @@ var ts; return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality); } if ((compilerOptions.noImplicitAny || declaration.flags & 65536 /* JavaScriptFile */) && - declaration.kind === 224 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + declaration.kind === 225 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) { // If --noImplicitAny is on or the declaration is in a Javascript file, // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no @@ -27352,11 +27431,11 @@ var ts; return autoArrayType; } } - if (declaration.kind === 144 /* Parameter */) { + if (declaration.kind === 145 /* 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 === 152 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151 /* GetAccessor */); + if (func.kind === 153 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 152 /* GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -27386,7 +27465,7 @@ var ts; return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 259 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 260 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -27432,7 +27511,7 @@ var ts; var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members[symbol.name] = symbol; + members.set(symbol.name, symbol); }); var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { @@ -27467,7 +27546,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 172 /* ObjectBindingPattern */ + return pattern.kind === 173 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -27489,7 +27568,7 @@ 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. - if (declaration.kind === 258 /* PropertyAssignment */) { + if (declaration.kind === 259 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -27506,7 +27585,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 144 /* Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 145 /* Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol) { @@ -27522,10 +27601,10 @@ var ts; return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 241 /* ExportAssignment */) { + if (declaration.kind === 242 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 287 /* JSDocPropertyTag */ && declaration.typeExpression) { + if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 288 /* JSDocPropertyTag */ && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } // Handle variable, parameter or property @@ -27538,8 +27617,8 @@ var ts; // * exports.p = expr // * this.p = expr // * className.prototype.method = expr - if (declaration.kind === 192 /* BinaryExpression */ || - declaration.kind === 177 /* PropertyAccessExpression */ && declaration.parent.kind === 192 /* BinaryExpression */) { + if (declaration.kind === 193 /* BinaryExpression */ || + declaration.kind === 178 /* PropertyAccessExpression */ && declaration.parent.kind === 193 /* BinaryExpression */) { // Use JS Doc type if present on parent expression statement if (declaration.flags & 65536 /* JavaScriptFile */) { var jsdocType = ts.getJSDocType(declaration.parent); @@ -27547,7 +27626,7 @@ var ts; return links.type = getTypeFromTypeNode(jsdocType); } } - var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 /* BinaryExpression */ ? + var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 193 /* BinaryExpression */ ? checkExpressionCached(decl.right) : checkExpressionCached(decl.parent.right); }); type = getUnionType(declaredTypes, /*subtypeReduction*/ true); @@ -27564,7 +27643,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 151 /* GetAccessor */) { + if (accessor.kind === 152 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -27584,8 +27663,8 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - var getter = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 152 /* SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 152 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 153 /* SetAccessor */); if (getter && getter.flags & 65536 /* JavaScriptFile */) { var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); if (jsDocType) { @@ -27629,7 +27708,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 152 /* 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)); } } @@ -27637,6 +27716,10 @@ var ts; } return links.type; } + function getBaseTypeVariableOfClass(symbol) { + var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); + return baseConstructorType.flags & 540672 /* TypeVariable */ ? baseConstructorType : undefined; + } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -27645,8 +27728,13 @@ var ts; } else { var type = createObjectType(16 /* Anonymous */, symbol); - links.type = strictNullChecks && symbol.flags & 536870912 /* Optional */ ? - includeFalsyTypes(type, 2048 /* Undefined */) : type; + if (symbol.flags & 32 /* Class */) { + var baseTypeVariable = getBaseTypeVariableOfClass(symbol); + links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; + } + else { + links.type = strictNullChecks && symbol.flags & 536870912 /* Optional */ ? includeFalsyTypes(type, 2048 /* Undefined */) : type; + } } } return links.type; @@ -27726,8 +27814,13 @@ var ts; function hasBaseType(type, checkBase) { return check(type); function check(type) { - var target = getTargetType(type); - return target === checkBase || ts.forEach(getBaseTypes(target), check); + if (getObjectFlags(type) & (3 /* ClassOrInterface */ | 4 /* Reference */)) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(getBaseTypes(target), check); + } + else if (type.flags & 131072 /* Intersection */) { + return ts.forEach(type.types, check); + } } } // Appends the type parameters given by a list of declarations to a set of type parameters and returns the resulting set. @@ -27755,9 +27848,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 227 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */ || - node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ || - node.kind === 149 /* MethodDeclaration */ || node.kind === 185 /* ArrowFunction */) { + if (node.kind === 228 /* ClassDeclaration */ || node.kind === 198 /* ClassExpression */ || + node.kind === 227 /* FunctionDeclaration */ || node.kind === 185 /* FunctionExpression */ || + node.kind === 150 /* MethodDeclaration */ || node.kind === 186 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -27767,7 +27860,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, 228 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 229 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -27776,8 +27869,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 228 /* InterfaceDeclaration */ || node.kind === 227 /* ClassDeclaration */ || - node.kind === 197 /* ClassExpression */ || node.kind === 229 /* TypeAliasDeclaration */) { + if (node.kind === 229 /* InterfaceDeclaration */ || node.kind === 228 /* ClassDeclaration */ || + node.kind === 198 /* ClassExpression */ || node.kind === 230 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -27791,8 +27884,25 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); } + // A type is a mixin constructor if it has a single construct signature taking no type parameters and a single + // rest parameter of type any[]. + function isMixinConstructorType(type) { + var signatures = getSignaturesOfType(type, 1 /* Construct */); + if (signatures.length === 1) { + var s = signatures[0]; + return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType; + } + return false; + } function isConstructorType(type) { - return type.flags & 32768 /* Object */ && getSignaturesOfType(type, 1 /* Construct */).length > 0; + if (isValidBaseType(type) && getSignaturesOfType(type, 1 /* Construct */).length > 0) { + return true; + } + if (type.flags & 540672 /* TypeVariable */) { + var constraint = getBaseConstraintOfType(type); + return isValidBaseType(constraint) && isMixinConstructorType(constraint); + } + return false; } function getBaseTypeNodeOfClass(type) { return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); @@ -27826,7 +27936,7 @@ var ts; return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); - if (baseConstructorType.flags & 32768 /* Object */) { + if (baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */)) { // Resolving the members of a class requires us to resolve the base class of that class. // We force resolution here such that we catch circularities now. resolveStructuredTypeMembers(baseConstructorType); @@ -27864,8 +27974,8 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseConstructorType = getBaseConstructorTypeOfClass(type); - if (!(baseConstructorType.flags & 32768 /* Object */)) { + var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); + if (!(baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */))) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -27900,7 +28010,7 @@ var ts; if (baseType === unknownType) { return; } - if (!(getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */)) { + if (!isValidBaseType(baseType)) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); return; } @@ -27926,16 +28036,22 @@ var ts; } return true; } + // A valid base type is any non-generic object type or intersection of non-generic + // object types. + function isValidBaseType(type) { + return type.flags & 32768 /* Object */ && !isGenericMappedType(type) || + type.flags & 131072 /* Intersection */ && !ts.forEach(type.types, function (t) { return !isValidBaseType(t); }); + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 228 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 229 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { - if (getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */) { + if (isValidBaseType(baseType)) { if (type !== baseType && !hasBaseType(baseType, type)) { if (type.resolvedBaseTypes === emptyArray) { type.resolvedBaseTypes = [baseType]; @@ -27962,7 +28078,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 228 /* InterfaceDeclaration */) { + if (declaration.kind === 229 /* InterfaceDeclaration */) { if (declaration.flags & 64 /* ContainsThis */) { return false; } @@ -28000,7 +28116,7 @@ var ts; type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384 /* TypeParameter */); @@ -28019,7 +28135,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 286 /* JSDocTypedefTag */); + var declaration = ts.getDeclarationOfKind(symbol, 287 /* JSDocTypedefTag */); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -28030,7 +28146,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 229 /* TypeAliasDeclaration */); + declaration = ts.getDeclarationOfKind(symbol, 230 /* TypeAliasDeclaration */); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -28040,7 +28156,7 @@ var ts; // an instantiation of the type alias with the type parameters supplied as type arguments. links.typeParameters = typeParameters; links.instantiations = ts.createMap(); - links.instantiations[getTypeListId(typeParameters)] = type; + links.instantiations.set(getTypeListId(typeParameters), type); } } else { @@ -28057,14 +28173,14 @@ var ts; return !ts.isInAmbientContext(member); } return expr.kind === 8 /* NumericLiteral */ || - expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && + expr.kind === 191 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */ || - expr.kind === 70 /* Identifier */ && !!symbol.exports[expr.text]; + expr.kind === 70 /* Identifier */ && !!symbol.exports.get(expr.text); } function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 230 /* EnumDeclaration */) { + if (declaration.kind === 231 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -28089,10 +28205,10 @@ var ts; enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { var memberTypeList = []; - var memberTypes = ts.createMap(); + var memberTypes = []; for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 230 /* EnumDeclaration */) { + if (declaration.kind === 231 /* EnumDeclaration */) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -28109,7 +28225,7 @@ var ts; if (memberTypeList.length > 1) { enumType.flags |= 65536 /* Union */; enumType.types = memberTypeList; - unionTypes[getTypeListId(memberTypeList)] = enumType; + unionTypes.set(getTypeListId(memberTypeList), enumType); } } } @@ -28130,9 +28246,6 @@ var ts; if (!links.declaredType) { var type = createType(16384 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */).constraint) { - type.constraint = noConstraintType; - } links.declaredType = type; } return links.declaredType; @@ -28145,7 +28258,6 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0); if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { return getDeclaredTypeOfClassOrInterface(symbol); } @@ -28184,19 +28296,20 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: + case 133 /* ObjectKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 129 /* NeverKeyword */: - case 171 /* LiteralType */: + case 172 /* LiteralType */: return true; - case 162 /* ArrayType */: + case 163 /* ArrayType */: return isIndependentType(node.elementType); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return isIndependentTypeReference(node); } return false; @@ -28209,7 +28322,7 @@ var ts; // A function-like declaration is considered independent (free of this references) if it has a return type // annotation that is considered independent and if each parameter is considered independent. function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 150 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 151 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -28230,12 +28343,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return isIndependentVariableLikeDeclaration(declaration); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -28246,7 +28359,7 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; - result[symbol.name] = symbol; + result.set(symbol.name, symbol); } return result; } @@ -28256,15 +28369,15 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; - result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; - if (!symbols[s.name]) { - symbols[s.name] = s; + if (!symbols.has(s.name)) { + symbols.set(s.name, s); } } } @@ -28272,8 +28385,8 @@ var ts; if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get("__call")); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get("__new")); type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); } @@ -28281,7 +28394,14 @@ var ts; } function getTypeWithThisArgument(type, thisArgument) { if (getObjectFlags(type) & 4 /* Reference */) { - return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + var target = type.target; + var typeArguments = type.typeArguments; + if (ts.length(target.typeParameters) === ts.length(typeArguments)) { + return createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType])); + } + } + else if (type.flags & 131072 /* Intersection */) { + return getIntersectionType(ts.map(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument); })); } return type; } @@ -28317,7 +28437,7 @@ var ts; for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0 /* String */); @@ -28474,19 +28594,51 @@ var ts; function unionSpreadIndexInfos(info1, info2) { return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly); } + function includeMixinType(type, types, index) { + var mixedTypes = []; + for (var i = 0; i < types.length; i++) { + if (i === index) { + mixedTypes.push(type); + } + else if (isMixinConstructorType(types[i])) { + mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1 /* Construct */)[0])); + } + } + return getIntersectionType(mixedTypes); + } function resolveIntersectionTypeMembers(type) { // The members and properties collections are empty for intersection types. To get all properties of an // intersection type use getPropertiesOfType (only the language service uses this). var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexInfo = undefined; - var numberIndexInfo = undefined; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; + var stringIndexInfo; + var numberIndexInfo; + var types = type.types; + var mixinCount = ts.countWhere(types, isMixinConstructorType); + var _loop_3 = function (i) { + var t = type.types[i]; + // When an intersection type contains mixin constructor types, the construct signatures from + // those types are discarded and their return types are mixed into the return types of all + // other construct signatures in the intersection type. For example, the intersection type + // '{ new(...args: any[]) => A } & { new(s: string) => B }' has a single construct signature + // 'new(s: string) => A & B'. + if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) { + var signatures = getSignaturesOfType(t, 1 /* Construct */); + if (signatures.length && mixinCount > 0) { + signatures = ts.map(signatures, function (s) { + var clone = cloneSignature(s); + clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i); + return clone; + }); + } + constructSignatures = ts.concatenate(constructSignatures, signatures); + } callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0 /* Call */)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1 /* Construct */)); stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0 /* String */)); numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1 /* Number */)); + }; + for (var i = 0; i < types.length; i++) { + _loop_3(i); } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } @@ -28505,8 +28657,8 @@ var ts; } else if (symbol.flags & 2048 /* TypeLiteral */) { var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var callSignatures = getSignaturesOfSymbol(members.get("__call")); + var constructSignatures = getSignaturesOfSymbol(members.get("__new")); var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); @@ -28520,14 +28672,14 @@ var ts; } if (symbol.flags & 32 /* Class */) { var classType = getDeclaredTypeOfClassOrInterface(symbol); - constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); } var baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & 32768 /* Object */) { + if (baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */ | 540672 /* TypeVariable */)) { members = createSymbolTable(getNamedMembers(members)); - addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); + addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); } } var numberIndexInfo = symbol.flags & 384 /* Enum */ ? enumNumberIndexInfo : undefined; @@ -28552,12 +28704,15 @@ var ts; var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); // The 'T' in 'keyof T' var templateReadonly = !!type.declaration.readonlyToken; var templateOptional = !!type.declaration.questionToken; - if (type.declaration.typeParameter.constraint.kind === 168 /* TypeOperator */) { + if (type.declaration.typeParameter.constraint.kind === 169 /* TypeOperator */) { // We have a { [P in keyof T]: X } - forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + for (var _i = 0, _a = getPropertiesOfType(modifiersType); _i < _a.length; _i++) { + var propertySymbol = _a[_i]; + addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); + } if (getIndexInfoOfType(modifiersType, 0 /* String */)) { addMemberForKeyType(stringType); } @@ -28571,11 +28726,11 @@ var ts; forEachType(iterationType, addMemberForKeyType); } setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); - function addMemberForKeyType(t) { + function addMemberForKeyType(t, propertySymbol) { // Create a mapper from T to the current iteration type constituent. Then, if the // mapped type is itself an instantiated type, combine the iteration mapper with the // instantiation mapper. - var iterationMapper = createUnaryTypeMapper(typeParameter, t); + var iterationMapper = createTypeMapper([typeParameter], [t]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); // If the current iteration type constituent is a string literal type, create a property. @@ -28587,7 +28742,10 @@ var ts; var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | (isOptional ? 536870912 /* Optional */ : 0), propName); prop.type = propType; prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); - members[propName] = prop; + if (propertySymbol) { + prop.mappedTypeOrigin = propertySymbol; + } + members.set(propName, prop); } else if (t.flags & 2 /* String */) { stringIndexInfo = createIndexInfo(propType, templateReadonly); @@ -28611,7 +28769,7 @@ var ts; function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { var constraintDeclaration = type.declaration.typeParameter.constraint; - if (constraintDeclaration.kind === 168 /* TypeOperator */) { + if (constraintDeclaration.kind === 169 /* TypeOperator */) { // If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check // AST nodes here because, when T is a non-generic type, the logic below eagerly resolves // 'keyof T' to a literal union type and we can't recover T from that type. @@ -28629,9 +28787,6 @@ var ts; } return type.modifiersType; } - function getErasedTemplateTypeFromMappedType(type) { - return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); - } function isGenericMappedType(type) { if (getObjectFlags(type) & 32 /* Mapped */) { var constraintType = getConstraintTypeFromMappedType(type); @@ -28676,38 +28831,35 @@ var ts; function getPropertyOfObjectType(type, name) { if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } } } function getPropertiesOfUnionOrIntersectionType(type) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var current = _a[_i]; - for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { - var prop = _c[_b]; - getUnionOrIntersectionProperty(type, prop.name); - } - // The properties of a union type are those that are present in all constituent types, so - // we only need to check the properties of the first type - if (type.flags & 65536 /* Union */) { - break; - } - } - var props = type.resolvedProperties; - if (props) { - var result = []; - for (var key in props) { - var prop = props[key]; - // We need to filter out partial properties in union types - if (!(prop.flags & 268435456 /* SyntheticProperty */ && prop.isPartial)) { - result.push(prop); + if (!type.resolvedProperties) { + var members = ts.createMap(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.name)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.name); + if (combinedProp) { + members.set(prop.name, combinedProp); + } + } + } + // The properties of a union type are those that are present in all constituent types, so + // we only need to check the properties of the first type + if (type.flags & 65536 /* Union */) { + break; } } - return result; + type.resolvedProperties = getNamedMembers(members); } - return emptyArray; + return type.resolvedProperties; } function getPropertiesOfType(type) { type = getApparentType(type); @@ -28715,19 +28867,77 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } + function getConstraintOfType(type) { + return type.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(type) : getBaseConstraintOfType(type); + } + function getConstraintOfTypeParameter(typeParameter) { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; + } + function getBaseConstraintOfType(type) { + var constraint = getResolvedBaseConstraint(type); + return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined; + } + function hasNonCircularBaseConstraint(type) { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } /** - * The apparent type of a type parameter is the base constraint instantiated with the type parameter - * as the type argument for the 'this' type. + * Return the resolved base constraint of a type variable. The noConstraintType singleton is returned if the + * type variable has no constraint, and the circularConstraintType singleton is returned if the constraint + * circularly references the type variable. */ - function getApparentTypeOfTypeVariable(type) { - if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeVariable(type); - while (constraintType && constraintType.flags & 16384 /* TypeParameter */) { - constraintType = getConstraintOfTypeVariable(constraintType); + function getResolvedBaseConstraint(type) { + var typeStack; + var circular; + if (!type.resolvedBaseConstraint) { + typeStack = []; + var constraint = getBaseConstraint(type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + } + return type.resolvedBaseConstraint; + function getBaseConstraint(t) { + if (ts.contains(typeStack, t)) { + circular = true; + return undefined; + } + typeStack.push(t); + var result = computeBaseConstraint(t); + typeStack.pop(); + return result; + } + function computeBaseConstraint(t) { + if (t.flags & 16384 /* TypeParameter */) { + var constraint = getConstraintFromTypeParameter(t); + return t.isThisType ? constraint : + constraint ? getBaseConstraint(constraint) : undefined; } - type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + if (t.flags & 196608 /* UnionOrIntersection */) { + var types = t.types; + var baseTypes = []; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var type_1 = types_2[_i]; + var baseType = getBaseConstraint(type_1); + if (baseType) { + baseTypes.push(baseType); + } + } + return t.flags & 65536 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : + t.flags & 131072 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : + undefined; + } + if (t.flags & 262144 /* Index */) { + return stringType; + } + if (t.flags & 524288 /* IndexedAccess */) { + var baseObjectType = getBaseConstraint(t.objectType); + var baseIndexType = getBaseConstraint(t.indexType); + var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; + return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; + } + return t; } - return type.resolvedApparentType; + } + function getApparentTypeOfIntersectionType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type)); } /** * For a type parameter, return the base constraint of the type parameter. For the string, number, @@ -28735,26 +28945,29 @@ var ts; * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type) { - var t = type.flags & 540672 /* TypeVariable */ ? getApparentTypeOfTypeVariable(type) : type; - return t.flags & 262178 /* StringLike */ ? globalStringType : - t.flags & 340 /* NumberLike */ ? globalNumberType : - t.flags & 136 /* BooleanLike */ ? globalBooleanType : - t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() : - t; + var t = type.flags & 540672 /* TypeVariable */ ? getBaseConstraintOfType(type) || emptyObjectType : type; + return t.flags & 131072 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : + t.flags & 262178 /* StringLike */ ? globalStringType : + t.flags & 340 /* NumberLike */ ? globalNumberType : + t.flags & 136 /* BooleanLike */ ? globalBooleanType : + t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() : + t.flags & 16777216 /* NonPrimitive */ ? globalObjectType : + t; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; + var excludeModifiers = containingType.flags & 65536 /* Union */ ? 8 /* Private */ | 16 /* Protected */ : 0; var props; // Flags we want to propagate to the result if they exist in all source symbols var commonFlags = (containingType.flags & 131072 /* Intersection */) ? 536870912 /* Optional */ : 0 /* None */; var isReadonly = false; var isPartial = false; - for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { - var current = types_2[_i]; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var current = types_3[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))) { + if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & excludeModifiers)) { commonFlags &= prop.flags; if (!props) { props = [prop]; @@ -28810,12 +29023,12 @@ var ts; // these partial properties when identifying discriminant properties, but otherwise they are filtered out // and do not appear to be present in the union type. function getUnionOrIntersectionProperty(type, name) { - var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap()); - var property = properties[name]; + var properties = type.propertyCache || (type.propertyCache = ts.createMap()); + var property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); if (property) { - properties[name] = property; + properties.set(name, property); } } return property; @@ -28837,7 +29050,7 @@ var ts; type = getApparentType(type); if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -28926,16 +29139,16 @@ var ts; } function symbolsToArray(symbols) { var result = []; - for (var id in symbols) { + symbols.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { - result.push(symbols[id]); + result.push(symbol); } - } + }); return result; } function isJSDocOptionalParameter(node) { if (node.flags & 65536 /* JavaScriptFile */) { - if (node.type && node.type.kind === 274 /* JSDocOptionalType */) { + if (node.type && node.type.kind === 275 /* JSDocOptionalType */) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -28946,7 +29159,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 274 /* JSDocOptionalType */; + return paramTag.typeExpression.type.kind === 275 /* JSDocOptionalType */; } } } @@ -28995,9 +29208,10 @@ var ts; if (!links.resolvedSignature) { var parameters = []; var hasLiteralTypes = false; - var minArgumentCount = -1; + var minArgumentCount = 0; var thisParameter = undefined; var hasThisParameter = void 0; + var iife = ts.getImmediatelyInvokedFunctionExpression(declaration); var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); // If this is a JSDoc construct signature, then skip the first parameter in the // parameter list. The first parameter represents the return type of the construct @@ -29017,43 +29231,35 @@ var ts; else { parameters.push(paramSymbol); } - if (param.type && param.type.kind === 171 /* LiteralType */) { + if (param.type && param.type.kind === 172 /* LiteralType */) { hasLiteralTypes = true; } - if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { - if (minArgumentCount < 0) { - minArgumentCount = i - (hasThisParameter ? 1 : 0); - } - } - else { - // If we see any required parameters, it means the prior ones were not in fact optional. - minArgumentCount = -1; + // Record a new minimum argument count if this is not an optional parameter + var isOptionalParameter_1 = param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !param.type || + isJSDocOptionalParameter(param); + if (!isOptionalParameter_1) { + minArgumentCount = parameters.length; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 151 /* GetAccessor */ || declaration.kind === 152 /* SetAccessor */) && + if ((declaration.kind === 152 /* GetAccessor */ || declaration.kind === 153 /* SetAccessor */) && !ts.hasDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */; + var otherKind = declaration.kind === 152 /* GetAccessor */ ? 153 /* SetAccessor */ : 152 /* GetAccessor */; var other = ts.getDeclarationOfKind(declaration.symbol, otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); - } - if (isJSConstructSignature) { - minArgumentCount--; - } - var classType = declaration.kind === 150 /* Constructor */ ? + var classType = declaration.kind === 151 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : getTypeParametersFromJSDocTemplate(declaration); var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType); - var typePredicate = declaration.type && declaration.type.kind === 156 /* TypePredicate */ ? + var typePredicate = declaration.type && declaration.type.kind === 157 /* TypePredicate */ ? createTypePredicateFromTypePredicateNode(declaration.type) : undefined; links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes); @@ -29078,8 +29284,8 @@ var ts; } // 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 === 151 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 152 /* SetAccessor */); + if (declaration.kind === 152 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 153 /* SetAccessor */); return getAnnotatedAccessorType(setter); } if (ts.nodeIsMissing(declaration.body)) { @@ -29093,20 +29299,20 @@ var ts; for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 275 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 276 /* JSDocFunctionType */: // 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). @@ -29179,7 +29385,11 @@ var ts; function getSignatureInstantiation(signature, typeArguments) { var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()); var id = getTypeListId(typeArguments); - return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + var instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; } function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), /*eraseTypeParameters*/ true); @@ -29198,7 +29408,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 === 150 /* Constructor */ || signature.declaration.kind === 154 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 151 /* Constructor */ || signature.declaration.kind === 155 /* ConstructSignature */; var type = createObjectType(16 /* Anonymous */); type.members = emptySymbols; type.properties = emptyArray; @@ -29209,10 +29419,10 @@ var ts; return signature.isolatedSignatureType; } function getIndexSymbol(symbol) { - return symbol.members["__index"]; + return symbol.members.get("__index"); } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 132 /* NumberKeyword */ : 134 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 132 /* NumberKeyword */ : 135 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -29239,21 +29449,9 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 143 /* TypeParameter */).constraint; - } - function hasConstraintReferenceTo(type, target) { - var checked; - while (type && type.flags & 16384 /* TypeParameter */ && !(type.isThisType) && !ts.contains(checked, type)) { - if (type === target) { - return true; - } - (checked || (checked = [])).push(type); - var constraintDeclaration = getConstraintDeclaration(type); - type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); - } - return false; + return ts.getDeclarationOfKind(type.symbol, 144 /* TypeParameter */).constraint; } - function getConstraintOfTypeParameter(typeParameter) { + function getConstraintFromTypeParameter(typeParameter) { if (!typeParameter.constraint) { if (typeParameter.target) { var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); @@ -29261,23 +29459,13 @@ var ts; } else { var constraintDeclaration = getConstraintDeclaration(typeParameter); - var constraint = getTypeFromTypeNode(constraintDeclaration); - if (hasConstraintReferenceTo(constraint, typeParameter)) { - error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); - constraint = unknownType; - } - typeParameter.constraint = constraint; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } - function getConstraintOfTypeVariable(type) { - return type.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(type) : - type.flags & 524288 /* IndexedAccess */ ? type.constraint : - undefined; - } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 144 /* TypeParameter */).parent); } function getTypeListId(types) { var result = ""; @@ -29308,8 +29496,8 @@ var ts; // that care about the presence of such types at arbitrary depth in a containing type. function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; - for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { - var type = types_3[_i]; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var type = types_4[_i]; if (!(type.flags & excludeKinds)) { result |= type.flags; } @@ -29318,9 +29506,10 @@ var ts; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); - var type = target.instantiations[id]; + var type = target.instantiations.get(id); if (!type) { - type = target.instantiations[id] = createObjectType(4 /* Reference */, target.symbol); + type = createObjectType(4 /* Reference */, target.symbol); + target.instantiations.set(id, type); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -29363,7 +29552,11 @@ var ts; var links = getSymbolLinks(symbol); var typeParameters = links.typeParameters; var id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + var instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + } + return instantiation; } // Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include // references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the @@ -29395,11 +29588,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 157 /* TypeReference */: + case 158 /* TypeReference */: return node.typeName; - case 273 /* JSDocTypeReference */: + case 274 /* JSDocTypeReference */: return node.name; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -29425,7 +29618,7 @@ var ts; if (symbol.flags & 524288 /* TypeAlias */) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 /* Value */ && node.kind === 273 /* JSDocTypeReference */) { + if (symbol.flags & 107455 /* Value */ && node.kind === 274 /* JSDocTypeReference */) { // A JSDocTypeReference may have resolved to a value (as opposed to a type). In // that case, the type of this reference is just the type of the value we resolved // to. @@ -29438,14 +29631,14 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 273 /* JSDocTypeReference */) { + if (node.kind === 274 /* JSDocTypeReference */) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(typeReferenceName); type = getTypeReferenceType(node, symbol); } else { // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 157 /* TypeReference */ + var typeNameOrExpression = node.kind === 158 /* TypeReference */ ? node.typeName : ts.isEntityNameExpression(node.expression) ? node.expression @@ -29480,9 +29673,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: return declaration; } } @@ -29576,7 +29769,7 @@ var ts; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384 /* TypeParameter */); @@ -29660,14 +29853,14 @@ var ts; // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToUnion(typeSet, types) { - for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { - var type = types_4[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; addTypeToUnion(typeSet, type); } } function containsIdenticalType(types, type) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var t = types_5[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -29675,8 +29868,8 @@ var ts; return false; } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var type = types_7[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } @@ -29763,10 +29956,11 @@ var ts; return types[0]; } var id = getTypeListId(types); - var type = unionTypes[id]; + var type = unionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 6144 /* Nullable */); - type = unionTypes[id] = createType(65536 /* Union */ | propagatedFlags); + type = createType(65536 /* Union */ | propagatedFlags); + unionTypes.set(id, type); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -29797,8 +29991,8 @@ var ts; // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var type = types_8[_i]; addTypeToIntersection(typeSet, type); } } @@ -29833,10 +30027,11 @@ var ts; /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); } var id = getTypeListId(typeSet); - var type = intersectionTypes[id]; + var type = intersectionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 6144 /* Nullable */); - type = intersectionTypes[id] = createType(131072 /* Intersection */ | propagatedFlags); + type = createType(131072 /* Intersection */ | propagatedFlags); + intersectionTypes.set(id, type); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -29886,28 +30081,10 @@ var ts; var type = createType(524288 /* IndexedAccess */); type.objectType = objectType; type.indexType = indexType; - // We eagerly compute the constraint of the indexed access type such that circularity - // errors are immediately caught and reported. For example, class C { x: this["x"] } - // becomes an error only when the constraint is eagerly computed. - if (type.objectType.flags & 229376 /* StructuredType */) { - // The constraint of T[K], where T is an object, union, or intersection type, - // is the type of the string index signature of T, if any. - type.constraint = getIndexTypeOfType(type.objectType, 0 /* String */); - } - else if (type.objectType.flags & 540672 /* TypeVariable */) { - // The constraint of T[K], where T is a type variable, is A[K], where A is the - // apparent type of T. - var apparentType = getApparentTypeOfTypeVariable(type.objectType); - if (apparentType !== emptyObjectType) { - type.constraint = isTypeOfKind(type.indexType, 262178 /* StringLike */) ? - getIndexedAccessType(apparentType, type.indexType) : - getIndexTypeOfType(apparentType, 0 /* String */); - } - } return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode : undefined; var propName = indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */) ? indexType.text : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ? @@ -29955,7 +30132,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType)); } @@ -29969,12 +30146,12 @@ var ts; return unknownType; } function getIndexedAccessForMappedType(type, indexType, accessNode) { - var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode : undefined; if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); return unknownType; } - var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } @@ -29986,18 +30163,11 @@ var ts; // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. if (maybeTypeOfKind(indexType, 540672 /* TypeVariable */ | 262144 /* Index */) || - maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && !(accessNode && accessNode.kind === 178 /* ElementAccessExpression */) || + maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && !(accessNode && accessNode.kind === 179 /* ElementAccessExpression */) || isGenericMappedType(objectType)) { if (objectType.flags & 1 /* Any */) { return objectType; } - // We first check that the index type is assignable to 'keyof T' for the object type. - if (accessNode) { - if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } - } // If the object type is a mapped type { [P in K]: E }, we instantiate E using a mapper that substitutes // the index type for P. For example, for an index access { [P in K]: Box }[X], we construct the // type Box. @@ -30006,7 +30176,11 @@ var ts; } // Otherwise we defer the operation by creating an indexed access type. var id = objectType.id + "," + indexType.id; - return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + var type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); + } + return type; } // In the following we resolve T[K] to the type of the property in T selected by K. var apparentObjectType = getApparentType(objectType); @@ -30050,7 +30224,7 @@ var ts; if (!links.resolvedType) { // Deferred resolution of members is handled by resolveObjectTypeMembers var aliasSymbol = getAliasSymbolForTypeNode(node); - if (ts.isEmpty(node.symbol.members) && !aliasSymbol) { + if (node.symbol.members.size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -30063,7 +30237,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 229 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 230 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -30074,7 +30248,7 @@ var ts; * this function should be called in a left folding style, with left = previous result of getSpreadType * and right = the new element to be spread. */ - function getSpreadType(left, right, isFromObjectLiteral) { + function getSpreadType(left, right) { if (left.flags & 1 /* Any */ || right.flags & 1 /* Any */) { return anyType; } @@ -30087,10 +30261,13 @@ var ts; return left; } if (left.flags & 65536 /* Union */) { - return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); }); + return mapType(left, function (t) { return getSpreadType(t, right); }); } if (right.flags & 65536 /* Union */) { - return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); }); + return mapType(right, function (t) { return getSpreadType(left, t); }); + } + if (right.flags & 16777216 /* NonPrimitive */) { + return emptyObjectType; } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); @@ -30108,23 +30285,23 @@ var ts; for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { var rightProp = _a[_i]; // we approximate own properties as non-methods plus methods that are inside the object literal - var isOwnProperty = !(rightProp.flags & 8192 /* Method */) || isFromObjectLiteral; var isSetterWithoutGetter = rightProp.flags & 65536 /* SetAccessor */ && !(rightProp.flags & 32768 /* GetAccessor */); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 /* Private */ | 16 /* Protected */)) { - skippedPrivateMembers[rightProp.name] = true; + skippedPrivateMembers.set(rightProp.name, true); } - else if (isOwnProperty && !isSetterWithoutGetter) { - members[rightProp.name] = rightProp; + else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { + members.set(rightProp.name, rightProp); } } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (leftProp.flags & 65536 /* SetAccessor */ && !(leftProp.flags & 32768 /* GetAccessor */) - || leftProp.name in skippedPrivateMembers) { + || skippedPrivateMembers.has(leftProp.name) + || isClassMethod(leftProp)) { continue; } - if (leftProp.name in members) { - var rightProp = members[leftProp.name]; + if (members.has(leftProp.name)) { + var rightProp = members.get(leftProp.name); var rightType = getTypeOfSymbol(rightProp); if (maybeTypeOfKind(rightType, 2048 /* Undefined */) || rightProp.flags & 536870912 /* Optional */) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); @@ -30135,15 +30312,18 @@ var ts; result.rightSpread = rightProp; result.declarations = declarations; result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); - members[leftProp.name] = result; + members.set(leftProp.name, result); } } else { - members[leftProp.name] = leftProp; + members.set(leftProp.name, leftProp); } } return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } + function isClassMethod(prop) { + return prop.flags & 8192 /* Method */ && ts.find(prop.declarations, function (decl) { return ts.isClassLike(decl.parent); }); + } function createLiteralType(flags, text) { var type = createType(flags); type.text = text; @@ -30165,7 +30345,11 @@ var ts; } function getLiteralTypeForText(flags, text) { var map = flags & 32 /* StringLiteral */ ? stringLiteralTypes : numericLiteralTypes; - return map[text] || (map[text] = createLiteralType(flags, text)); + var type = map.get(text); + if (!type) { + map.set(text, type = createLiteralType(flags, text)); + } + return type; } function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); @@ -30193,9 +30377,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 228 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 229 /* InterfaceDeclaration */)) { if (!(ts.getModifierFlags(container) & 32 /* Static */) && - (container.kind !== 150 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { + (container.kind !== 151 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -30212,87 +30396,89 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118 /* AnyKeyword */: - case 264 /* JSDocAllType */: - case 265 /* JSDocUnknownType */: + case 265 /* JSDocAllType */: + case 266 /* JSDocUnknownType */: return anyType; - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: return stringType; case 132 /* NumberKeyword */: return numberType; case 121 /* BooleanKeyword */: return booleanType; - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: return esSymbolType; case 104 /* VoidKeyword */: return voidType; - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: return undefinedType; case 94 /* NullKeyword */: return nullType; case 129 /* NeverKeyword */: return neverType; - case 290 /* JSDocNullKeyword */: + case 133 /* ObjectKeyword */: + return nonPrimitiveType; + case 291 /* JSDocNullKeyword */: return nullType; - case 291 /* JSDocUndefinedKeyword */: + case 292 /* JSDocUndefinedKeyword */: return undefinedType; - case 292 /* JSDocNeverKeyword */: + case 293 /* JSDocNeverKeyword */: return neverType; - case 167 /* ThisType */: + case 168 /* ThisType */: case 98 /* ThisKeyword */: return getTypeFromThisTypeNode(node); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 289 /* JSDocLiteralType */: + case 290 /* JSDocLiteralType */: return getTypeFromLiteralTypeNode(node.literal); - case 157 /* TypeReference */: - case 273 /* JSDocTypeReference */: + case 158 /* TypeReference */: + case 274 /* JSDocTypeReference */: return getTypeFromTypeReference(node); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return booleanType; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 162 /* ArrayType */: - case 266 /* JSDocArrayType */: + case 163 /* ArrayType */: + case 267 /* JSDocArrayType */: return getTypeFromArrayTypeNode(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 164 /* UnionType */: - case 267 /* JSDocUnionType */: + case 165 /* UnionType */: + case 268 /* JSDocUnionType */: return getTypeFromUnionTypeNode(node); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 166 /* ParenthesizedType */: - case 269 /* JSDocNullableType */: - case 270 /* JSDocNonNullableType */: - case 277 /* JSDocConstructorType */: - case 278 /* JSDocThisType */: - case 274 /* JSDocOptionalType */: + case 167 /* ParenthesizedType */: + case 270 /* JSDocNullableType */: + case 271 /* JSDocNonNullableType */: + case 278 /* JSDocConstructorType */: + case 279 /* JSDocThisType */: + case 275 /* JSDocOptionalType */: return getTypeFromTypeNode(node.type); - case 271 /* JSDocRecordType */: + case 272 /* JSDocRecordType */: return getTypeFromTypeNode(node.literal); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 161 /* TypeLiteral */: - case 288 /* JSDocTypeLiteral */: - case 275 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 162 /* TypeLiteral */: + case 289 /* JSDocTypeLiteral */: + case 276 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return getTypeFromMappedTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode case 70 /* Identifier */: - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 268 /* JSDocTupleType */: + case 269 /* JSDocTupleType */: return getTypeFromJSDocTupleType(node); - case 276 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -30319,13 +30505,13 @@ var ts; var instantiations = mapper.instantiations || (mapper.instantiations = []); return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); } - function createUnaryTypeMapper(source, target) { + function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } - function createBinaryTypeMapper(source1, target1, source2, target2) { + function makeBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createArrayTypeMapper(sources, targets) { + function makeArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { @@ -30336,10 +30522,9 @@ var ts; }; } function createTypeMapper(sources, targets) { - var count = sources.length; - var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : - count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : - createArrayTypeMapper(sources, targets); + var mapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + makeArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; return mapper; } @@ -30369,7 +30554,12 @@ var ts; } function combineTypeMappers(mapper1, mapper2) { var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; - mapper.mappedTypes = mapper1.mappedTypes; + mapper.mappedTypes = ts.concatenate(mapper1.mappedTypes, mapper2.mappedTypes); + return mapper; + } + function createReplacementMapper(source, target, baseMapper) { + var mapper = function (t) { return t === source ? target : baseMapper(t); }; + mapper.mappedTypes = baseMapper.mappedTypes; return mapper; } function cloneTypeParameter(typeParameter) { @@ -30459,10 +30649,7 @@ var ts; if (typeVariable_1 !== mappedTypeVariable) { return mapType(mappedTypeVariable, function (t) { if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); + return instantiateMappedObjectType(type, createReplacementMapper(typeVariable_1, t, mapper)); } return t; }); @@ -30493,23 +30680,23 @@ var ts; var node = symbol.declarations[0]; while (node) { switch (node.kind) { - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -30519,14 +30706,19 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 228 /* InterfaceDeclaration */) { + if (ts.isClassLike(node) || node.kind === 229 /* InterfaceDeclaration */) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 275 /* JSDocFunctionType */: + case 171 /* MappedType */: + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)))) { + return true; + } + break; + case 276 /* JSDocFunctionType */: var func = node; for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { var p = _c[_b]; @@ -30535,8 +30727,8 @@ var ts; } } break; - case 231 /* ModuleDeclaration */: - case 262 /* SourceFile */: + case 232 /* ModuleDeclaration */: + case 263 /* SourceFile */: return false; } node = node.parent; @@ -30546,7 +30738,7 @@ var ts; function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 262 /* SourceFile */ || parentKind === 232 /* ModuleBlock */; + return parentKind === 263 /* SourceFile */ || parentKind === 233 /* ModuleBlock */; } return false; } @@ -30623,27 +30815,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 !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return node.operatorToken.kind === 53 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; @@ -30658,7 +30850,7 @@ var ts; return true; } // For arrow functions we now know we're not context sensitive. - if (node.kind === 185 /* ArrowFunction */) { + if (node.kind === 186 /* ArrowFunction */) { return false; } // If the first parameter is not an explicit 'this' parameter, then the function has @@ -30680,9 +30872,12 @@ var ts; result.properties = resolved.properties; result.callSignatures = emptyArray; result.constructSignatures = emptyArray; - type = result; + return result; } } + else if (type.flags & 131072 /* Intersection */) { + return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures)); + } return type; } // TYPE CHECKING @@ -30873,13 +31068,15 @@ var ts; return true; } var id = source.id + "," + target.id; - if (enumRelation[id] !== undefined) { - return enumRelation[id]; + var relation = enumRelation.get(id); + if (relation !== undefined) { + return relation; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256 /* RegularEnum */) || !(target.symbol.flags & 256 /* RegularEnum */) || (source.flags & 65536 /* Union */) !== (target.flags & 65536 /* Union */)) { - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } var targetEnumType = getTypeOfSymbol(target.symbol); for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { @@ -30890,11 +31087,13 @@ var ts; if (errorReporter) { errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */)); } - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } } } - return enumRelation[id] = true; + enumRelation.set(id, true); + return true; } function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { if (target.flags & 8192 /* Never */) @@ -30915,6 +31114,8 @@ var ts; return true; if (source.flags & 4096 /* Null */ && (!strictNullChecks || target.flags & 4096 /* Null */)) return true; + if (source.flags & 32768 /* Object */ && target.flags & 16777216 /* NonPrimitive */) + return true; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & 1 /* Any */) return true; @@ -30946,12 +31147,12 @@ var ts; } if (source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */) { var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { return related === 1 /* Succeeded */; } } - if (source.flags & 507904 /* StructuredOrTypeParameter */ || target.flags & 507904 /* StructuredOrTypeParameter */) { + if (source.flags & 1032192 /* StructuredOrTypeVariable */ || target.flags & 1032192 /* StructuredOrTypeVariable */) { return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); } return false; @@ -31130,16 +31331,6 @@ var ts; } } } - else { - // Given a type parameter K with a constraint keyof T, a type S is - // assignable to K if S is assignable to keyof T. - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144 /* Index */) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; - } - } - } } else if (target.flags & 262144 /* Index */) { // A keyof S is related to a keyof T if T is related to S. @@ -31148,14 +31339,12 @@ var ts; return result; } } - // Given a type variable T with a constraint C, a type S is assignable to - // keyof T if S is assignable to keyof C. - if (target.type.flags & 540672 /* TypeVariable */) { - var constraint = getConstraintOfTypeVariable(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; - } + // A type S is assignable to keyof T if S is assignable to keyof C, where C is the + // constraint of T. + var constraint = getConstraintOfType(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; } } } @@ -31169,8 +31358,9 @@ var ts; } // A type S is related to a type T[K] if S is related to A[K], where K is string-like and // A is the apparent type of S. - if (target.constraint) { - if (result = isRelatedTo(source, target.constraint, reportErrors)) { + var constraint = getBaseConstraintOfType(target); + if (constraint) { + if (result = isRelatedTo(source, constraint, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -31188,24 +31378,28 @@ var ts; } else { var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1 /* Any */) { - constraint = emptyObjectType; - } - // The constraint may need to be further instantiated with its 'this' type. - constraint = getTypeWithThisArgument(constraint, source); - // 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; + // A type parameter with no constraint is not related to the non-primitive object type. + if (constraint || !(target.flags & 16777216 /* NonPrimitive */)) { + if (!constraint || constraint.flags & 1 /* Any */) { + constraint = emptyObjectType; + } + // The constraint may need to be further instantiated with its 'this' type. + constraint = getTypeWithThisArgument(constraint, source); + // 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 & 524288 /* IndexedAccess */) { // A type S[K] is related to a type T if A[K] is related to T, where K is string-like and // A is the apparent type of S. - if (source.constraint) { - if (result = isRelatedTo(source.constraint, target, reportErrors)) { + var constraint = getBaseConstraintOfType(source); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -31272,7 +31466,7 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) || + if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyResolvedType(resolved)) || resolved.stringIndexInfo || (resolved.numberIndexInfo && isNumericLiteralName(name)) || getPropertyOfType(type, name)) { @@ -31289,13 +31483,16 @@ var ts; } return false; } - function isEmptyObjectType(t) { + function isEmptyResolvedType(t) { return t.properties.length === 0 && t.callSignatures.length === 0 && t.constructSignatures.length === 0 && !t.stringIndexInfo && !t.numberIndexInfo; } + function isEmptyObjectType(type) { + return type.flags & 32768 /* Object */ && isEmptyResolvedType(resolveStructuredTypeMembers(type)); + } function hasExcessProperties(source, target, reportErrors) { if (maybeTypeOfKind(target, 32768 /* Object */) && !(getObjectFlags(target) & 512 /* ObjectLiteralPatternWithComputedProperties */)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { @@ -31409,12 +31606,12 @@ var ts; return 0 /* False */; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { if (reportErrors && related === 2 /* Failed */) { // We are elaborating errors and the cached result is an unreported failure. Record the result as a reported // failure and continue computing the relation such that errors get reported. - relation[id] = 3 /* FailedAndReported */; + relation.set(id, 3 /* FailedAndReported */); } else { return related === 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */; @@ -31423,7 +31620,7 @@ var ts; if (depth > 0) { for (var i = 0; i < depth; i++) { // If source and target are already being compared, consider them related with assumptions - if (maybeStack[i][id]) { + if (maybeStack[i].get(id)) { return 1 /* Maybe */; } } @@ -31441,7 +31638,7 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = ts.createMap(); - maybeStack[depth][id] = 1 /* Succeeded */; + maybeStack[depth].set(id, 1 /* Succeeded */); depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) @@ -31476,41 +31673,43 @@ var ts; var maybeCache = maybeStack[depth]; // If result is definitely true, copy assumptions to global cache, else copy to next level up var destinationCache = (result === -1 /* True */ || depth === 0) ? relation : maybeStack[depth - 1]; - ts.copyProperties(maybeCache, destinationCache); + ts.copyEntries(maybeCache, destinationCache); } else { // A false result goes straight into global cache (when something is false under assumptions it // will also be false without assumptions) - relation[id] = reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */; + relation.set(id, reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */); } return result; } - // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y. + // A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is + // related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice + // that S and T are contra-variant whereas X and Y are co-variant. function mappedTypeRelatedTo(source, target, reportErrors) { if (isGenericMappedType(target)) { if (isGenericMappedType(source)) { - var result_2; - if (relation === identityRelation) { - var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; - var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else { - if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); - } + var sourceReadonly = !!source.declaration.readonlyToken; + var sourceOptional = !!source.declaration.questionToken; + var targetReadonly = !!target.declaration.readonlyToken; + var targetOptional = !!target.declaration.questionToken; + var modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + var result_2; + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); } } } + else if (target.declaration.questionToken && isEmptyObjectType(source)) { + return -1 /* True */; + } } else if (relation !== identityRelation) { var resolved = resolveStructuredTypeMembers(target); - if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1 /* Any */) { + if (isEmptyResolvedType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1 /* Any */) { return -1 /* True */; } } @@ -31918,8 +32117,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var t = types_9[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -31927,8 +32126,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -32034,8 +32233,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; result |= getFalsyFlags(t); } return result; @@ -32103,7 +32302,7 @@ var ts; var property = _a[_i]; var original = getTypeOfSymbol(property); var updated = f(original); - members[property.name] = updated === original ? property : createTransientSymbol(property, updated); + members.set(property.name, updated === original ? property : createTransientSymbol(property, updated)); } ; return members; @@ -32205,25 +32404,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 144 /* Parameter */: + case 145 /* 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 174 /* BindingElement */: + case 175 /* BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -32328,7 +32527,7 @@ var ts; inferredProp.declarations = prop.declarations; inferredProp.type = inferredPropType; inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); - members[prop.name] = inferredProp; + members.set(prop.name, inferredProp); } if (indexInfo) { var inferredIndexType = inferTargetType(indexInfo.type); @@ -32502,10 +32701,10 @@ var ts; return; } var key = source.id + "," + target.id; - if (visited[key]) { + if (visited.get(key)) { return; } - visited[key] = true; + visited.set(key, true); if (depth === 0) { sourceStack = []; targetStack = []; @@ -32603,8 +32802,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -32701,10 +32900,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 160 /* TypeQuery */: + case 161 /* TypeQuery */: return true; case 70 /* Identifier */: - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: node = node.parent; continue; default: @@ -32725,7 +32924,7 @@ var ts; if (node.kind === 98 /* ThisKeyword */) { return "0"; } - if (node.kind === 177 /* PropertyAccessExpression */) { + if (node.kind === 178 /* PropertyAccessExpression */) { var key = getFlowCacheKey(node.expression); return key && key + "." + node.name.text; } @@ -32736,7 +32935,7 @@ var ts; case 70 /* Identifier */: case 98 /* ThisKeyword */: return node; - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return getLeftmostIdentifierOrThis(node.expression); } return undefined; @@ -32745,19 +32944,19 @@ var ts; switch (source.kind) { case 70 /* Identifier */: return target.kind === 70 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 224 /* VariableDeclaration */ || target.kind === 174 /* BindingElement */) && + (target.kind === 225 /* VariableDeclaration */ || target.kind === 175 /* BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98 /* ThisKeyword */: return target.kind === 98 /* ThisKeyword */; - case 177 /* PropertyAccessExpression */: - return target.kind === 177 /* PropertyAccessExpression */ && + case 178 /* PropertyAccessExpression */: + return target.kind === 178 /* PropertyAccessExpression */ && source.name.text === target.name.text && isMatchingReference(source.expression, target.expression); } return false; } function containsMatchingReference(source, target) { - while (source.kind === 177 /* PropertyAccessExpression */) { + while (source.kind === 178 /* PropertyAccessExpression */) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -32770,7 +32969,7 @@ var ts; // a possible discriminant if its type differs in the constituents of containing union type, and if every // choice is a unit type or a union of unit types. function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 177 /* PropertyAccessExpression */ && + return target.kind === 178 /* PropertyAccessExpression */ && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); } @@ -32778,7 +32977,7 @@ var ts; if (expr.kind === 70 /* Identifier */) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 177 /* PropertyAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.text); } @@ -32808,7 +33007,7 @@ var ts; } } } - if (callExpression.expression.kind === 177 /* PropertyAccessExpression */ && + if (callExpression.expression.kind === 178 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -32850,8 +33049,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0 /* None */; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; result |= getTypeFacts(t); } return result; @@ -32861,7 +33060,7 @@ var ts; // check. This gives us a quicker out in the common case where an object type is not a function. var resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || - resolved.members["bind"] && isTypeSubtypeOf(type, globalFunctionType)); + resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type) { var flags = type.flags; @@ -32904,6 +33103,9 @@ var ts; if (flags & 512 /* ESSymbol */) { return strictNullChecks ? 1981320 /* SymbolStrictFacts */ : 4193160 /* SymbolFacts */; } + if (flags & 16777216 /* NonPrimitive */) { + return strictNullChecks ? 6166480 /* ObjectStrictFacts */ : 8378320 /* ObjectFacts */; + } if (flags & 16384 /* TypeParameter */) { var constraint = getConstraintOfTypeParameter(type); return getTypeFacts(constraint || emptyObjectType); @@ -32939,7 +33141,7 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 258 /* PropertyAssignment */ ? + return node.parent.kind === 176 /* ArrayLiteralExpression */ || node.parent.kind === 259 /* PropertyAssignment */ ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } @@ -32958,21 +33160,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return stringType; - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return checkRightHandSideOfForOf(parent.expression) || unknownType; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return undefinedType; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -32980,7 +33182,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 172 /* ObjectBindingPattern */ ? + var type = pattern.kind === 173 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : @@ -32998,35 +33200,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 213 /* ForInStatement */) { + if (node.parent.parent.kind === 214 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 214 /* ForOfStatement */) { + if (node.parent.parent.kind === 215 /* ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 224 /* VariableDeclaration */ ? + return node.kind === 225 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 224 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */ ? + return node.kind === 225 /* VariableDeclaration */ || node.kind === 175 /* BindingElement */ ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 224 /* VariableDeclaration */ && node.initializer && + return node.kind === 225 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 174 /* BindingElement */ && node.parent.kind === 192 /* BinaryExpression */ && + node.kind !== 175 /* BindingElement */ && node.parent.kind === 193 /* BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (node.operatorToken.kind) { case 57 /* EqualsToken */: return getReferenceCandidate(node.left); @@ -33038,13 +33240,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 183 /* ParenthesizedExpression */ || - parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node || - parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ? + return parent.kind === 184 /* ParenthesizedExpression */ || + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node || + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 254 /* CaseClause */) { + if (clause.kind === 255 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -33159,8 +33361,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var t = types_13[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var t = types_14[_i]; if (!(t.flags & 8192 /* Never */)) { if (!(getObjectFlags(t) & 256 /* EvolvingArray */)) { return false; @@ -33183,11 +33385,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 177 /* PropertyAccessExpression */ && (parent.name.text === "length" || - parent.parent.kind === 179 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 178 /* ElementAccessExpression */ && + var isLengthPushOrUnshift = parent.kind === 178 /* PropertyAccessExpression */ && (parent.name.text === "length" || + parent.parent.kind === 180 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 179 /* ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 192 /* BinaryExpression */ && + parent.parent.kind === 193 /* BinaryExpression */ && parent.parent.operatorToken.kind === 57 /* EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -33216,7 +33418,7 @@ var ts; } function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) { var key; - if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215 /* Narrowable */)) { + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 17810431 /* Narrowable */)) { return declaredType; } var initialType = assumeInitialized ? declaredType : @@ -33230,7 +33432,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent.kind === 201 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) { + if (reference.parent.kind === 202 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) { return declaredType; } return resultType; @@ -33279,7 +33481,7 @@ var ts; else if (flow.flags & 2 /* Start */) { // Check if we should continue with the control flow of the containing function. var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 177 /* PropertyAccessExpression */) { + if (container && container !== flowContainer && reference.kind !== 178 /* PropertyAccessExpression */) { flow = container.flowNode; continue; } @@ -33333,7 +33535,7 @@ var ts; } function getTypeAtFlowArrayMutation(flow) { var node = flow.node; - var expr = node.kind === 179 /* CallExpression */ ? + var expr = node.kind === 180 /* CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -33341,7 +33543,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256 /* EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 179 /* CallExpression */) { + if (node.kind === 180 /* CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -33432,8 +33634,9 @@ var ts; if (!key) { key = getFlowCacheKey(reference); } - if (cache[key]) { - return cache[key]; + var cached = cache.get(key); + if (cached) { + return cached; } // If this flow loop junction and reference are already being processed, return // the union of the types computed for each branch so far, marked as incomplete. @@ -33468,8 +33671,9 @@ var ts; // If we see a value appear in the cache it is a sign that control flow analysis // was restarted and completed by checkExpressionCached. We can simply pick up // the resulting type and bail out. - if (cache[key]) { - return cache[key]; + var cached_1 = cache.get(key); + if (cached_1) { + return cached_1; } if (!ts.contains(antecedentTypes, type)) { antecedentTypes.push(type); @@ -33493,10 +33697,11 @@ var ts; if (isIncomplete(firstAntecedentType)) { return createFlowType(result, /*incomplete*/ true); } - return cache[key] = result; + cache.set(key, result); + return result; } function isMatchingReferenceDiscriminant(expr) { - return expr.kind === 177 /* PropertyAccessExpression */ && + return expr.kind === 178 /* PropertyAccessExpression */ && declaredType.flags & 65536 /* Union */ && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(declaredType, expr.name.text); @@ -33530,10 +33735,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 187 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) { + if (left_1.kind === 188 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 187 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) { + if (right_1.kind === 188 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -33579,7 +33784,7 @@ var ts; assumeTrue ? 16384 /* EQUndefined */ : 131072 /* NEUndefined */; return getTypeWithFacts(type, facts); } - if (type.flags & 33281 /* NotUnionOrUnit */) { + if (type.flags & 16810497 /* NotUnionOrUnit */) { return type; } if (assumeTrue) { @@ -33610,14 +33815,14 @@ var ts; // We narrow a non-union type to an exact primitive type if the non-union type // is a supertype of that primitive type. For example, type 'any' can be narrowed // to one of the primitive types. - var targetType = typeofTypesByName[literal.text]; + var targetType = typeofTypesByName.get(literal.text); if (targetType && isTypeSubtypeOf(targetType, type)) { return targetType; } } var facts = assumeTrue ? - typeofEQFacts[literal.text] || 64 /* TypeofEQHostObject */ : - typeofNEFacts[literal.text] || 8192 /* TypeofNEHostObject */; + typeofEQFacts.get(literal.text) || 64 /* TypeofEQHostObject */ : + typeofNEFacts.get(literal.text) || 8192 /* TypeofNEHostObject */; return getTypeWithFacts(type, facts); } function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { @@ -33732,7 +33937,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 178 /* ElementAccessExpression */ || invokedExpression.kind === 177 /* PropertyAccessExpression */) { + if (invokedExpression.kind === 179 /* ElementAccessExpression */ || invokedExpression.kind === 178 /* PropertyAccessExpression */) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -33751,15 +33956,15 @@ var ts; switch (expr.kind) { case 70 /* Identifier */: case 98 /* ThisKeyword */: - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: if (expr.operator === 50 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -33795,9 +34000,9 @@ var ts; while (true) { node = node.parent; if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 232 /* ModuleBlock */ || - node.kind === 262 /* SourceFile */ || - node.kind === 147 /* PropertyDeclaration */) { + node.kind === 233 /* ModuleBlock */ || + node.kind === 263 /* SourceFile */ || + node.kind === 148 /* PropertyDeclaration */) { return node; } } @@ -33829,7 +34034,7 @@ var ts; if (node.kind === 70 /* Identifier */) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144 /* Parameter */) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 145 /* Parameter */) { symbol.isAssigned = true; } } @@ -33855,7 +34060,7 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ES2015 */) { - if (container.kind === 185 /* ArrowFunction */) { + if (container.kind === 186 /* ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (ts.hasModifier(container, 256 /* Async */)) { @@ -33876,7 +34081,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration_1.kind === 227 /* ClassDeclaration */ + if (declaration_1.kind === 228 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -33888,14 +34093,14 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration_1.kind === 197 /* ClassExpression */) { + else if (declaration_1.kind === 198 /* ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); while (container !== undefined) { if (container.parent === declaration_1) { - if (container.kind === 147 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) { + if (container.kind === 148 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) { getNodeLinks(declaration_1).flags |= 8388608 /* ClassWithConstructorReference */; getNodeLinks(node).flags |= 16777216 /* ConstructorReferenceInClass */; } @@ -33930,15 +34135,15 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 144 /* Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 145 /* Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 184 /* FunctionExpression */ || - flowContainer.kind === 185 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 185 /* FunctionExpression */ || + flowContainer.kind === 186 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -33981,7 +34186,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 257 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 258 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -34006,8 +34211,8 @@ var ts; } // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. - if (container.kind === 212 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 225 /* VariableDeclarationList */).parent === container && + if (container.kind === 213 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 226 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -34021,7 +34226,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { var current = node; // skip parenthesized nodes - while (current.parent.kind === 183 /* ParenthesizedExpression */) { + while (current.parent.kind === 184 /* ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -34029,7 +34234,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 190 /* PrefixUnaryExpression */ || current.parent.kind === 191 /* PostfixUnaryExpression */)) { + else if ((current.parent.kind === 191 /* PrefixUnaryExpression */ || current.parent.kind === 192 /* PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 42 /* PlusPlusToken */ || expr.operator === 43 /* MinusMinusToken */; } @@ -34050,7 +34255,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 147 /* PropertyDeclaration */ || container.kind === 150 /* Constructor */) { + if (container.kind === 148 /* PropertyDeclaration */ || container.kind === 151 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -34118,36 +34323,36 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; - if (container.kind === 150 /* Constructor */) { + if (container.kind === 151 /* Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 185 /* ArrowFunction */) { + if (container.kind === 186 /* 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 /* ES2015 */); } switch (container.kind) { - case 231 /* ModuleDeclaration */: + case 232 /* 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 230 /* EnumDeclaration */: + case 231 /* 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 150 /* Constructor */: + case 151 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: if (ts.getModifierFlags(container) & 32 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -34159,7 +34364,7 @@ var ts; // Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated. // If this is a function in a JS file, it might be a class method. Check if it's the RHS // of a x.prototype.y = function [name]() { .... } - if (container.kind === 184 /* FunctionExpression */ && + if (container.kind === 185 /* FunctionExpression */ && ts.isInJavaScriptFile(container.parent) && ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') @@ -34196,28 +34401,28 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 275 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 276 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 278 /* JSDocThisType */) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 279 /* JSDocThisType */) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 144 /* Parameter */) { + if (n.kind === 145 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 179 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 180 /* CallExpression */ && node.parent.expression === node; var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var needToCaptureLexicalThis = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 185 /* ArrowFunction */) { + while (container && container.kind === 186 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */; } @@ -34231,16 +34436,16 @@ var ts; // [super.foo()]() {} // } var current = node; - while (current && current !== container && current.kind !== 142 /* ComputedPropertyName */) { + while (current && current !== container && current.kind !== 143 /* ComputedPropertyName */) { current = current.parent; } - if (current && current.kind === 142 /* ComputedPropertyName */) { + if (current && current.kind === 143 /* 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 if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 177 /* ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -34248,7 +34453,7 @@ var ts; } return unknownType; } - if (!isCallExpression && container.kind === 150 /* Constructor */) { + if (!isCallExpression && container.kind === 151 /* Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if ((ts.getModifierFlags(container) & 32 /* Static */) || isCallExpression) { @@ -34314,7 +34519,7 @@ var ts; // This helper creates an object with a "value" property that wraps the `super` property or indexed access for both get and set. // This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment // while a property access can. - if (container.kind === 149 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) { + if (container.kind === 150 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */; } @@ -34328,7 +34533,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 176 /* ObjectLiteralExpression */) { + if (container.parent.kind === 177 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -34348,7 +34553,7 @@ var ts; } return unknownType; } - if (container.kind === 150 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 151 /* 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; @@ -34363,7 +34568,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 150 /* Constructor */; + return container.kind === 151 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -34371,21 +34576,21 @@ var ts; // - 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 // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 177 /* ObjectLiteralExpression */) { if (ts.getModifierFlags(container) & 32 /* Static */) { - return container.kind === 149 /* MethodDeclaration */ || - container.kind === 148 /* MethodSignature */ || - container.kind === 151 /* GetAccessor */ || - container.kind === 152 /* SetAccessor */; + return container.kind === 150 /* MethodDeclaration */ || + container.kind === 149 /* MethodSignature */ || + container.kind === 152 /* GetAccessor */ || + container.kind === 153 /* SetAccessor */; } else { - return container.kind === 149 /* MethodDeclaration */ || - container.kind === 148 /* MethodSignature */ || - container.kind === 151 /* GetAccessor */ || - container.kind === 152 /* SetAccessor */ || - container.kind === 147 /* PropertyDeclaration */ || - container.kind === 146 /* PropertySignature */ || - container.kind === 150 /* Constructor */; + return container.kind === 150 /* MethodDeclaration */ || + container.kind === 149 /* MethodSignature */ || + container.kind === 152 /* GetAccessor */ || + container.kind === 153 /* SetAccessor */ || + container.kind === 148 /* PropertyDeclaration */ || + container.kind === 147 /* PropertySignature */ || + container.kind === 151 /* Constructor */; } } } @@ -34393,7 +34598,7 @@ var ts; } } function getContextualThisParameterType(func) { - if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185 /* ArrowFunction */) { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 186 /* ArrowFunction */) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { var thisParameter = contextualSignature.thisParameter; @@ -34409,23 +34614,23 @@ var ts; var func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var iife = ts.getImmediatelyInvokedFunctionExpression(func); - if (iife) { + if (iife && iife.arguments) { var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (iife.arguments && indexOfParameter < iife.arguments.length) { - if (parameter.dotDotDotToken) { - var restTypes = []; - for (var i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); - } - return createArrayType(getUnionType(restTypes)); - } - var links = getNodeLinks(iife); - var cached = links.resolvedSignature; - links.resolvedSignature = anySignature; - var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); - links.resolvedSignature = cached; - return type; - } + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); + } + return restTypes.length ? createArrayType(getUnionType(restTypes)) : undefined; + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = indexOfParameter < iife.arguments.length ? + getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : + parameter.initializer ? undefined : undefinedWideningType; + links.resolvedSignature = cached; + return type; } var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -34459,7 +34664,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 144 /* Parameter */) { + if (declaration.kind === 145 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -34470,11 +34675,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_19 = declaration.propertyName || declaration.name; + var name = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_19)) { - var text = ts.getTextOfPropertyName(name_19); + !ts.isBindingPattern(name)) { + var text = ts.getTextOfPropertyName(name); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -34511,7 +34716,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 144 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 145 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -34522,8 +34727,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 === 150 /* Constructor */ || - functionDecl.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152 /* SetAccessor */))) { + functionDecl.kind === 151 /* Constructor */ || + functionDecl.kind === 152 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 153 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -34545,7 +34750,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 181 /* TaggedTemplateExpression */) { + if (template.parent.kind === 182 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -34589,8 +34794,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -34673,13 +34878,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 251 /* JsxAttribute */) { + if (attribute.kind === 252 /* JsxAttribute */) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 252 /* JsxSpreadAttribute */) { + else if (attribute.kind === 253 /* JsxSpreadAttribute */) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -34717,41 +34922,41 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 224 /* VariableDeclaration */: - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 174 /* BindingElement */: + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 175 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 185 /* ArrowFunction */: - case 217 /* ReturnStatement */: + case 186 /* ArrowFunction */: + case 218 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 258 /* PropertyAssignment */: - case 259 /* ShorthandPropertyAssignment */: + case 259 /* PropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 203 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 194 /* TemplateExpression */); + case 204 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 195 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return getContextualType(parent); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return getContextualType(parent); - case 251 /* JsxAttribute */: - case 252 /* JsxSpreadAttribute */: + case 252 /* JsxAttribute */: + case 253 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -34783,7 +34988,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */; + return node.kind === 185 /* FunctionExpression */ || node.kind === 186 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -34802,7 +35007,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 !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; @@ -34812,8 +35017,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var current = types_15[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var current = types_16[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -34863,8 +35068,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function hasDefaultValue(node) { - return (node.kind === 174 /* BindingElement */ && !!node.initializer) || - (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */); + return (node.kind === 175 /* BindingElement */ && !!node.initializer) || + (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -34873,7 +35078,7 @@ var ts; var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 196 /* SpreadElement */) { + if (inDestructuringPattern && e.kind === 197 /* SpreadElement */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -34897,7 +35102,7 @@ var ts; var type = checkExpressionForMutableLocation(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 196 /* SpreadElement */; + hasSpreadElement = hasSpreadElement || e.kind === 197 /* SpreadElement */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -34912,7 +35117,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 173 /* ArrayBindingPattern */ || pattern.kind === 175 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 174 /* ArrayBindingPattern */ || pattern.kind === 176 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -34920,7 +35125,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 198 /* OmittedExpression */) { + if (patternElement.kind !== 199 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -34937,7 +35142,7 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 142 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 143 /* 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, @@ -35009,7 +35214,7 @@ var ts; var propagatedFlags = 0; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 172 /* ObjectBindingPattern */ || contextualType.pattern.kind === 176 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 173 /* ObjectBindingPattern */ || contextualType.pattern.kind === 177 /* ObjectLiteralExpression */); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -35018,18 +35223,18 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 258 /* PropertyAssignment */ || - memberDecl.kind === 259 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 259 /* PropertyAssignment */ || + memberDecl.kind === 260 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 258 /* PropertyAssignment */) { + if (memberDecl.kind === 259 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 149 /* MethodDeclaration */) { + else if (memberDecl.kind === 150 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 259 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 260 /* ShorthandPropertyAssignment */); type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -35037,8 +35242,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 258 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 259 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 259 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 260 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912 /* Optional */; } @@ -35066,12 +35271,12 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 260 /* SpreadAssignment */) { - if (languageVersion < 5 /* ESNext */) { + else if (memberDecl.kind === 261 /* SpreadAssignment */) { + if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; propertiesTable = ts.createMap(); hasComputedStringProperty = false; @@ -35083,7 +35288,7 @@ var ts; error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } - spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false); + spread = getSpreadType(spread, type); offset = i + 1; continue; } @@ -35093,7 +35298,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 === 151 /* GetAccessor */ || memberDecl.kind === 152 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 152 /* GetAccessor */ || memberDecl.kind === 153 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } if (ts.hasDynamicName(memberDecl)) { @@ -35105,7 +35310,7 @@ var ts; } } else { - propertiesTable[member.name] = member; + propertiesTable.set(member.name, member); } propertiesArray.push(member); } @@ -35114,18 +35319,18 @@ var ts; if (contextualTypeHasPattern) { for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; - if (!propertiesTable[prop.name]) { + if (!propertiesTable.get(prop.name)) { if (!(prop.flags & 536870912 /* Optional */)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable[prop.name] = prop; + propertiesTable.set(prop.name, prop); propertiesArray.push(prop); } } } if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + spread = getSpreadType(spread, createObjectLiteralType()); } if (spread.flags & 32768 /* Object */) { // only set the symbol and flags if this is a (fresh) object type @@ -35155,7 +35360,7 @@ var ts; } } function isValidSpreadType(type) { - return !!(type.flags & (1 /* Any */ | 4096 /* Null */ | 2048 /* Undefined */) || + return !!(type.flags & (1 /* Any */ | 4096 /* Null */ | 2048 /* Undefined */ | 16777216 /* NonPrimitive */) || type.flags & 32768 /* Object */ && !isGenericMappedType(type) || type.flags & 196608 /* UnionOrIntersection */ && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); } @@ -35177,13 +35382,13 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: checkJsxExpression(child); break; - case 247 /* JsxElement */: + case 248 /* JsxElement */: checkJsxElement(child); break; - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; } @@ -35202,7 +35407,7 @@ var ts; */ function isJsxIntrinsicIdentifier(tagName) { // TODO (yuisu): comment - if (tagName.kind === 177 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) { + if (tagName.kind === 178 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) { return false; } else { @@ -35211,6 +35416,15 @@ var ts; } function checkJsxAttribute(node, elementAttributesType, nameTable) { var correspondingPropType = undefined; + // We need to unconditionally get the expression type + var exprType; + if (node.initializer) { + exprType = checkExpression(node.initializer); + } + else { + // is sugar for + exprType = booleanType; + } // Look up the corresponding property for this attribute if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) { // If there is no 'props' property, you may not have non-"data-" attributes @@ -35233,18 +35447,10 @@ var ts; } } } - var exprType; - if (node.initializer) { - exprType = checkExpression(node.initializer); - } - else { - // is sugar for - exprType = booleanType; - } if (correspondingPropType) { checkTypeAssignableTo(exprType, correspondingPropType, node); } - nameTable[node.name.text] = true; + nameTable.set(node.name.text, true); return exprType; } function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { @@ -35257,22 +35463,23 @@ var ts; var prop = props_2[_i]; // Is there a corresponding property in the element attributes type? Skip checking of properties // that have already been assigned to, as these are not actually pushed into the resulting type - if (!nameTable[prop.name]) { + if (!nameTable.get(prop.name)) { var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); if (targetPropSym) { var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); } - nameTable[prop.name] = true; + nameTable.set(prop.name, true); } } return type; } function getJsxType(name) { - if (jsxTypes[name] === undefined) { - return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + var jsxType = jsxTypes.get(name); + if (jsxType === undefined) { + jsxTypes.set(name, jsxType = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } - return jsxTypes[name]; + return jsxType; } /** * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic @@ -35558,11 +35765,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 === 251 /* JsxAttribute */) { + if (node.attributes[i].kind === 252 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 252 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 253 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -35573,10 +35780,10 @@ var ts; // was spreaded in, though, assume that it provided all required properties if (targetAttributesType && !sawSpreadedAny) { var targetProperties = getPropertiesOfType(targetAttributesType); - for (var i = 0; i < targetProperties.length; i++) { - if (!(targetProperties[i].flags & 536870912 /* Optional */) && - !nameTable[targetProperties[i].name]) { - error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); + for (var _i = 0, targetProperties_1 = targetProperties; _i < targetProperties_1.length; _i++) { + var targetProperty = targetProperties_1[_i]; + if (!(targetProperty.flags & 536870912 /* Optional */) && !nameTable.get(targetProperty.name)) { + error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperty.name, typeToString(targetAttributesType)); } } } @@ -35596,7 +35803,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 : 147 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 148 /* PropertyDeclaration */; } function getDeclarationModifierFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0; @@ -35615,7 +35822,7 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 /* PropertyAccessExpression */ || node.kind === 224 /* VariableDeclaration */ ? + var errorNode = node.kind === 178 /* PropertyAccessExpression */ || node.kind === 225 /* VariableDeclaration */ ? node.name : node.right; if (left.kind === 96 /* SuperKeyword */) { @@ -35626,11 +35833,14 @@ 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 (languageVersion < 2 /* ES2015 */ && getDeclarationKindFromSymbol(prop) !== 149 /* 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); - return false; + if (languageVersion < 2 /* ES2015 */) { + var propKind = getDeclarationKindFromSymbol(prop); + if (propKind !== 150 /* MethodDeclaration */ && propKind !== 149 /* MethodSignature */) { + // `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); + return false; + } } if (flags & 128 /* Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. @@ -35687,16 +35897,17 @@ var ts; return true; } function checkNonNullExpression(node) { - var type = checkExpression(node); - if (strictNullChecks) { - var kind = getFalsyFlags(type) & 6144 /* Nullable */; - if (kind) { - error(node, kind & 2048 /* Undefined */ ? kind & 4096 /* Null */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); - } - return getNonNullableType(type); + return checkNonNullType(checkExpression(node), node); + } + function checkNonNullType(type, errorNode) { + var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 6144 /* Nullable */; + if (kind) { + error(errorNode, kind & 2048 /* Undefined */ ? kind & 4096 /* Null */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + var t = getNonNullableType(type); + return t.flags & (6144 /* Nullable */ | 8192 /* Never */) ? unknownType : t; } return type; } @@ -35745,6 +35956,10 @@ var ts; } var prop = getPropertyOfType(apparentType, right.text); if (!prop) { + var stringIndexType = getIndexTypeOfType(apparentType, 0 /* String */); + if (stringIndexType) { + return stringIndexType; + } if (right.text && !checkAndReportErrorForExtendingInterface(node)) { reportNonexistentProperty(right, type.flags & 16384 /* TypeParameter */ && type.isThisType ? apparentType : type); } @@ -35766,7 +35981,7 @@ var ts; // Only compute control flow type if this is a property access expression that isn't an // assignment target, and the referenced property was declared as a variable, property, // accessor, or optional method. - if (node.kind !== 177 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || + if (node.kind !== 178 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 65536 /* Union */)) { return propType; @@ -35775,7 +35990,7 @@ var ts; return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 177 /* PropertyAccessExpression */ + var left = node.kind === 178 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); @@ -35792,7 +36007,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 225 /* VariableDeclarationList */) { + if (initializer.kind === 226 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -35821,7 +36036,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 213 /* ForInStatement */ && + if (node.kind === 214 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -35839,7 +36054,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 180 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 181 /* 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); @@ -35859,7 +36074,7 @@ var ts; error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } - return getIndexedAccessType(objectType, indexType, node); + return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node); } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) { @@ -35897,10 +36112,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 145 /* Decorator */) { + else if (node.kind !== 146 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -35930,13 +36145,13 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_9 = signature.declaration && signature.declaration.parent; + var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_9 === lastParent) { + if (lastParent && parent === lastParent) { index++; } else { - lastParent = parent_9; + lastParent = parent; index = cutoffIndex; } } @@ -35944,7 +36159,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_9; + lastParent = parent; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -35966,7 +36181,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 196 /* SpreadElement */) { + if (arg && arg.kind === 197 /* SpreadElement */) { return i; } } @@ -35979,13 +36194,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 === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* 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 argCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 194 /* TemplateExpression */) { + if (tagExpression.template.kind === 195 /* 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; @@ -36002,7 +36217,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 145 /* Decorator */) { + else if (node.kind === 146 /* Decorator */) { isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); @@ -36011,7 +36226,7 @@ var ts; var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 180 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 181 /* NewExpression */); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -36095,7 +36310,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 !== 198 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 199 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); // If the effective argument type is 'undefined', there is no synthetic type @@ -36152,7 +36367,7 @@ var ts; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 180 /* NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 181 /* NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -36169,7 +36384,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 !== 198 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 199 /* 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); @@ -36191,12 +36406,12 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - if (node.kind === 179 /* CallExpression */) { + if (node.kind === 180 /* CallExpression */) { var callee = node.expression; - if (callee.kind === 177 /* PropertyAccessExpression */) { + if (callee.kind === 178 /* PropertyAccessExpression */) { return callee.expression; } - else if (callee.kind === 178 /* ElementAccessExpression */) { + else if (callee.kind === 179 /* ElementAccessExpression */) { return callee.expression; } } @@ -36212,16 +36427,16 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 194 /* TemplateExpression */) { + if (template.kind === 195 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 145 /* Decorator */) { + else if (node.kind === 146 /* 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. @@ -36246,19 +36461,19 @@ var ts; * Otherwise, the argument count is the length of the 'args' array. */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { switch (node.parent.kind) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts) // If we are emitting decorators for ES3, we will only pass two arguments. @@ -36268,7 +36483,7 @@ var 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 144 /* Parameter */: + case 145 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -36292,25 +36507,25 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 227 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { // 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); } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* 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 @@ -36337,21 +36552,21 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 227 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { node = node.parent; - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* 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 @@ -36362,7 +36577,7 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return getLiteralTypeForText(32 /* StringLiteral */, element.name.text); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 512 /* ESSymbol */)) { return nameType; @@ -36388,21 +36603,21 @@ var ts; function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a parameter decorator - if (node.kind === 227 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { // The `parameterIndex` for a parameter decorator is always a number return numberType; } - if (node.kind === 147 /* PropertyDeclaration */) { + if (node.kind === 148 /* PropertyDeclaration */) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -36434,10 +36649,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 === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */) { return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' @@ -36449,8 +36664,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 === 145 /* Decorator */ || - (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */)) { + if (node.kind === 146 /* Decorator */ || + (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -36459,11 +36674,11 @@ var ts; * Gets the error node to use when reporting errors for an effective argument. */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -36472,8 +36687,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 181 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 145 /* Decorator */; + var isTaggedTemplate = node.kind === 182 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 146 /* Decorator */; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -36544,7 +36759,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 /* CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 180 /* CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -36893,16 +37108,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 144 /* Parameter */: + case 145 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -36932,13 +37147,13 @@ var ts; } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 179 /* CallExpression */: + case 180 /* CallExpression */: return resolveCallExpression(node, candidatesOutArray); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return resolveNewExpression(node, candidatesOutArray); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray); - case 145 /* Decorator */: + case 146 /* Decorator */: return resolveDecorator(node, candidatesOutArray); } ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); @@ -36987,12 +37202,12 @@ var ts; if (node.expression.kind === 96 /* SuperKeyword */) { return voidType; } - if (node.kind === 180 /* NewExpression */) { + if (node.kind === 181 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 150 /* Constructor */ && - declaration.kind !== 154 /* ConstructSignature */ && - declaration.kind !== 159 /* ConstructorType */ && + declaration.kind !== 151 /* Constructor */ && + declaration.kind !== 155 /* ConstructSignature */ && + declaration.kind !== 160 /* ConstructorType */ && !ts.isJSDocConstructSignature(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any, unless // the declaring function had members created through 'x.prototype.y = expr' or 'this.y = expr' psuedodeclarations @@ -37032,9 +37247,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 226 /* FunctionDeclaration */ + ? 227 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 224 /* VariableDeclaration */ + ? 225 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -37069,7 +37284,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return unknownType; } - else if (container.kind === 150 /* Constructor */) { + else if (container.kind === 151 /* Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -37148,8 +37363,8 @@ var ts; links.type = instantiateType(contextualType, mapper); // if inference didn't come up with anything but {}, fall back to the binding pattern if present. if (links.type === emptyObjectType && - (parameter.valueDeclaration.name.kind === 172 /* ObjectBindingPattern */ || - parameter.valueDeclaration.name.kind === 173 /* ArrayBindingPattern */)) { + (parameter.valueDeclaration.name.kind === 173 /* ObjectBindingPattern */ || + parameter.valueDeclaration.name.kind === 174 /* ArrayBindingPattern */)) { links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); } assignBindingElementTypes(parameter.valueDeclaration); @@ -37219,7 +37434,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 205 /* Block */) { + if (func.body.kind !== 206 /* 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 @@ -37309,7 +37524,7 @@ var ts; return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 219 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 220 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; @@ -37342,7 +37557,7 @@ var ts; } }); if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || - func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */)) { + func.kind === 185 /* FunctionExpression */ || func.kind === 186 /* ArrowFunction */)) { return undefined; } if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) { @@ -37371,7 +37586,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (ts.nodeIsMissing(func.body) || func.body.kind !== 205 /* Block */ || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 206 /* Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */; @@ -37404,10 +37619,10 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 184 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 185 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -37448,7 +37663,7 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 149 /* MethodDeclaration */) { + if (produceDiagnostics && node.kind !== 150 /* MethodDeclaration */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithCapturedNewTargetVariable(node, node.name); @@ -37456,7 +37671,7 @@ var ts; return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); if (!node.asteriskToken) { @@ -37472,7 +37687,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 205 /* Block */) { + if (node.body.kind === 206 /* Block */) { checkSourceElement(node.body); } else { @@ -37519,11 +37734,11 @@ var ts; if (isReadonlySymbol(symbol)) { // Allow assignments to readonly properties within constructors of the same class declaration. if (symbol.flags & 4 /* Property */ && - (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) && + (expr.kind === 178 /* PropertyAccessExpression */ || expr.kind === 179 /* ElementAccessExpression */) && expr.expression.kind === 98 /* ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 150 /* Constructor */)) + if (!(func && func.kind === 151 /* Constructor */)) return true; // If func.parent is a class and symbol is a (readonly) property of that class, or // if func is a constructor and symbol is a (readonly) parameter property declared in it, @@ -37535,13 +37750,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */ || expr.kind === 179 /* ElementAccessExpression */) { var node = ts.skipParentheses(expr.expression); if (node.kind === 70 /* Identifier */) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 238 /* NamespaceImport */; + return declaration && declaration.kind === 239 /* NamespaceImport */; } } } @@ -37550,7 +37765,7 @@ var ts; function checkReferenceExpression(expr, invalidReferenceMessage) { // References are combinations of identifiers, parentheses, and property accesses. var node = ts.skipParentheses(expr); - if (node.kind !== 70 /* Identifier */ && node.kind !== 177 /* PropertyAccessExpression */ && node.kind !== 178 /* ElementAccessExpression */) { + if (node.kind !== 70 /* Identifier */ && node.kind !== 178 /* PropertyAccessExpression */ && node.kind !== 179 /* ElementAccessExpression */) { error(expr, invalidReferenceMessage); return false; } @@ -37559,7 +37774,7 @@ var ts; function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); - if (expr.kind !== 177 /* PropertyAccessExpression */ && expr.kind !== 178 /* ElementAccessExpression */) { + if (expr.kind !== 178 /* PropertyAccessExpression */ && expr.kind !== 179 /* ElementAccessExpression */) { error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } @@ -37603,6 +37818,7 @@ var ts; case 36 /* PlusToken */: case 37 /* MinusToken */: case 51 /* TildeToken */: + checkNonNullType(operandType, node.operand); if (maybeTypeOfKind(operandType, 512 /* ESSymbol */)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } @@ -37614,7 +37830,7 @@ var ts; booleanType; case 42 /* PlusPlusToken */: case 43 /* MinusMinusToken */: - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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 checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); @@ -37628,7 +37844,7 @@ var ts; if (operandType === silentNeverType) { return silentNeverType; } - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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 checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); @@ -37643,8 +37859,8 @@ var ts; } if (type.flags & 196608 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var t = types_17[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -37661,8 +37877,8 @@ var ts; } if (type.flags & 65536 /* Union */) { var types = type.types; - for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { - var t = types_17[_i]; + for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { + var t = types_18[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -37671,8 +37887,8 @@ var ts; } if (type.flags & 131072 /* Intersection */) { var types = type.types; - for (var _a = 0, types_18 = types; _a < types_18.length; _a++) { - var t = types_18[_a]; + for (var _a = 0, types_19 = types; _a < types_19.length; _a++) { + var t = types_19[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -37692,14 +37908,17 @@ var ts; } // TypeScript 1.0 spec (April 2014): 4.15.4 // The instanceof operator requires the left operand to be of type Any, an object type, or a type parameter type, - // and the right operand to be of type Any or a subtype of the 'Function' interface type. + // and the right operand to be of type Any, a subtype of the 'Function' interface type, or have a call or construct signature. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported if (isTypeOfKind(leftType, 8190 /* Primitive */)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported - if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(isTypeAny(rightType) || + getSignaturesOfType(rightType, 0 /* Call */).length || + getSignaturesOfType(rightType, 1 /* Construct */).length || + isTypeSubtypeOf(rightType, globalFunctionType))) { error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; @@ -37708,6 +37927,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); // TypeScript 1.0 spec (April 2014): 4.15.5 // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. @@ -37730,22 +37951,22 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 258 /* PropertyAssignment */ || property.kind === 259 /* ShorthandPropertyAssignment */) { - var name_20 = property.name; - if (name_20.kind === 142 /* ComputedPropertyName */) { - checkComputedPropertyName(name_20); + if (property.kind === 259 /* PropertyAssignment */ || property.kind === 260 /* ShorthandPropertyAssignment */) { + var name = property.name; + if (name.kind === 143 /* ComputedPropertyName */) { + checkComputedPropertyName(name); } - if (isComputedNonLiteralName(name_20)) { + if (isComputedNonLiteralName(name)) { return undefined; } - var text = ts.getTextOfPropertyName(name_20); + var text = ts.getTextOfPropertyName(name); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 259 /* ShorthandPropertyAssignment */) { + if (property.kind === 260 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -37754,10 +37975,10 @@ var ts; } } else { - error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 260 /* SpreadAssignment */) { + else if (property.kind === 261 /* SpreadAssignment */) { if (languageVersion < 5 /* ESNext */) { checkExternalEmitHelpers(property, 4 /* Rest */); } @@ -37788,8 +38009,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 198 /* OmittedExpression */) { - if (element.kind !== 196 /* SpreadElement */) { + if (element.kind !== 199 /* OmittedExpression */) { + if (element.kind !== 197 /* SpreadElement */) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -37817,7 +38038,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 192 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) { + if (restExpression.kind === 193 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -37830,7 +38051,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 259 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 260 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -37846,21 +38067,21 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 192 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) { + if (target.kind === 193 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 176 /* ObjectLiteralExpression */) { + if (target.kind === 177 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 175 /* ArrayLiteralExpression */) { + if (target.kind === 176 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 260 /* SpreadAssignment */ ? + var error = target.parent.kind === 261 /* SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -37882,35 +38103,35 @@ var ts; case 70 /* Identifier */: case 9 /* StringLiteral */: case 11 /* RegularExpressionLiteral */: - case 181 /* TaggedTemplateExpression */: - case 194 /* TemplateExpression */: + case 182 /* TaggedTemplateExpression */: + case 195 /* TemplateExpression */: case 12 /* NoSubstitutionTemplateLiteral */: case 8 /* NumericLiteral */: case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: case 94 /* NullKeyword */: - case 137 /* UndefinedKeyword */: - case 184 /* FunctionExpression */: - case 197 /* ClassExpression */: - case 185 /* ArrowFunction */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 187 /* TypeOfExpression */: - case 201 /* NonNullExpression */: - case 248 /* JsxSelfClosingElement */: - case 247 /* JsxElement */: + case 138 /* UndefinedKeyword */: + case 185 /* FunctionExpression */: + case 198 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 188 /* TypeOfExpression */: + case 202 /* NonNullExpression */: + case 249 /* JsxSelfClosingElement */: + case 248 /* JsxElement */: return true; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -37922,9 +38143,9 @@ var ts; } return false; // Some forms listed here for clarity - case 188 /* VoidExpression */: // Explicit opt-out - case 182 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 200 /* AsExpression */: // Not SEF, but can produce useful type warnings + case 189 /* VoidExpression */: // Explicit opt-out + case 183 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 201 /* AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -37944,7 +38165,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 57 /* EqualsToken */ && (left.kind === 176 /* ObjectLiteralExpression */ || left.kind === 175 /* ArrayLiteralExpression */)) { + if (operator === 57 /* EqualsToken */ && (left.kind === 177 /* ObjectLiteralExpression */ || left.kind === 176 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -37975,18 +38196,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - // TypeScript 1.0 spec (April 2014): 4.19.1 - // These operators require their operands to be of type Any, the Number primitive type, - // or an enum type. Operands of an enum type are treated - // as having the primitive type Number. If one operand is the null or undefined value, - // it is treated as having the type of the other operand. - // The result is always of the Number primitive type. - if (leftType.flags & 6144 /* Nullable */) - leftType = rightType; - if (rightType.flags & 6144 /* Nullable */) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); var suggestedOperator = void 0; // if a user tries to apply a bitwise operator to 2 boolean operands // try and return them a helpful suggestion @@ -38009,16 +38220,10 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - // TypeScript 1.0 spec (April 2014): 4.19.2 - // The binary + operator requires both operands to be of the Number primitive type or an enum type, - // or at least one of the operands to be of type Any or the String primitive type. - // If one operand is the null or undefined value, it is treated as having the type of the other operand. - if (leftType.flags & 6144 /* Nullable */) - leftType = rightType; - if (rightType.flags & 6144 /* Nullable */) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + if (!isTypeOfKind(leftType, 1 /* Any */ | 262178 /* StringLike */) && !isTypeOfKind(rightType, 1 /* Any */ | 262178 /* StringLike */)) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } var resultType = void 0; if (isTypeOfKind(leftType, 340 /* NumberLike */) && isTypeOfKind(rightType, 340 /* NumberLike */)) { // Operands of an enum type are treated as having the primitive type Number. @@ -38053,8 +38258,8 @@ var ts; case 29 /* LessThanEqualsToken */: case 30 /* GreaterThanEqualsToken */: if (checkForDisallowedESSymbolOperand(operator)) { - leftType = getBaseTypeOfLiteralType(leftType); - rightType = getBaseTypeOfLiteralType(rightType); + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -38246,7 +38451,7 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 182 /* TypeAssertionExpression */ || node.kind === 200 /* AsExpression */; + return node.kind === 183 /* TypeAssertionExpression */ || node.kind === 201 /* AsExpression */; } function checkDeclarationInitializer(declaration) { var type = checkExpressionCached(declaration.initializer); @@ -38257,14 +38462,14 @@ var ts; function isLiteralContextualType(contextualType) { if (contextualType) { if (contextualType.flags & 540672 /* TypeVariable */) { - var apparentType = getApparentTypeOfTypeVariable(contextualType); + var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; // If the type parameter is constrained to the base primitive type we're checking for, // consider this a literal context. For example, given a type parameter 'T extends string', // this causes us to infer string literal types for T. - if (apparentType.flags & (2 /* String */ | 4 /* Number */ | 8 /* Boolean */ | 16 /* Enum */)) { + if (constraint.flags & (2 /* String */ | 4 /* Number */ | 8 /* Boolean */ | 16 /* Enum */)) { return true; } - contextualType = apparentType; + contextualType = constraint; } return maybeTypeOfKind(contextualType, (480 /* Literal */ | 262144 /* Index */)); } @@ -38278,7 +38483,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 === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, contextualMapper); @@ -38289,7 +38494,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 === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -38315,7 +38520,7 @@ var ts; function getTypeOfExpression(node) { // Optimize for the common case of a call to a function with a single non-generic call // signature where we can just fetch the return type without checking the arguments. - if (node.kind === 179 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */) { + if (node.kind === 180 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -38336,7 +38541,7 @@ var ts; // contextually typed function and arrow expressions in the initial phase. function checkExpression(node, contextualMapper) { var type; - if (node.kind === 141 /* QualifiedName */) { + if (node.kind === 142 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -38348,9 +38553,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 70 /* Identifier */ || node.kind === 142 /* 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); } @@ -38372,68 +38577,68 @@ var ts; case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: return checkLiteralExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return checkTemplateExpression(node); case 12 /* NoSubstitutionTemplateLiteral */: return stringType; case 11 /* RegularExpressionLiteral */: return globalRegExpType; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return checkCallExpression(node); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return checkClassExpression(node); - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: return checkAssertion(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return checkNonNullAssertion(node); - case 202 /* MetaProperty */: + case 203 /* MetaProperty */: return checkMetaProperty(node); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return checkDeleteExpression(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return checkVoidExpression(node); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return checkAwaitExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return checkSpreadExpression(node, contextualMapper); - case 198 /* OmittedExpression */: + case 199 /* OmittedExpression */: return undefinedWideningType; - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return checkYieldExpression(node); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return checkJsxExpression(node); - case 247 /* JsxElement */: + case 248 /* JsxElement */: return checkJsxElement(node); - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 249 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -38445,6 +38650,10 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!hasNonCircularBaseConstraint(typeParameter)) { + error(node.constraint, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + } getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); if (produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); @@ -38461,7 +38670,7 @@ var ts; var func = ts.getContainingFunction(node); if (ts.getModifierFlags(node) & 92 /* ParameterPropertyModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 150 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 151 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -38472,7 +38681,7 @@ var ts; if (ts.indexOf(func.parameters, node) !== 0) { error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); } - if (func.kind === 150 /* Constructor */ || func.kind === 154 /* ConstructSignature */ || func.kind === 159 /* ConstructorType */) { + if (func.kind === 151 /* Constructor */ || func.kind === 155 /* ConstructSignature */ || func.kind === 160 /* ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } } @@ -38486,9 +38695,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 149 /* MethodDeclaration */ || - node.kind === 226 /* FunctionDeclaration */ || - node.kind === 184 /* FunctionExpression */; + return node.kind === 150 /* MethodDeclaration */ || + node.kind === 227 /* FunctionDeclaration */ || + node.kind === 185 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -38531,9 +38740,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_21 = _a[_i].name; - if (ts.isBindingPattern(name_21) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) { + var name = _a[_i].name; + if (ts.isBindingPattern(name) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -38546,16 +38755,16 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 185 /* ArrowFunction */: - case 153 /* CallSignature */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 158 /* FunctionType */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - var parent_10 = node.parent; - if (node === parent_10.type) { - return parent_10; + case 186 /* ArrowFunction */: + case 154 /* CallSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 159 /* FunctionType */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + var parent = node.parent; + if (node === parent.type) { + return parent; } } } @@ -38565,15 +38774,15 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_22 = element.name; - if (name_22.kind === 70 /* Identifier */ && - name_22.text === predicateVariableName) { + var name = element.name; + if (name.kind === 70 /* Identifier */ && + name.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_22.kind === 173 /* ArrayBindingPattern */ || - name_22.kind === 172 /* ObjectBindingPattern */) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) { + else if (name.kind === 174 /* ArrayBindingPattern */ || + name.kind === 173 /* ObjectBindingPattern */) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } } @@ -38581,12 +38790,12 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 /* FunctionType */ || node.kind === 226 /* FunctionDeclaration */ || node.kind === 159 /* ConstructorType */ || - node.kind === 153 /* CallSignature */ || node.kind === 150 /* Constructor */ || - node.kind === 154 /* ConstructSignature */) { + else if (node.kind === 159 /* FunctionType */ || node.kind === 227 /* FunctionDeclaration */ || node.kind === 160 /* ConstructorType */ || + node.kind === 154 /* CallSignature */ || node.kind === 151 /* Constructor */ || + node.kind === 155 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } if (ts.isAsyncFunctionLike(node) && languageVersion < 4 /* ES2017 */) { @@ -38604,10 +38813,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 153 /* CallSignature */: + case 154 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -38650,7 +38859,7 @@ var ts; var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150 /* Constructor */) { + if (member.kind === 151 /* Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param)) { @@ -38659,18 +38868,18 @@ var ts; } } else { - var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114 /* StaticKeyword */; }); + var isStatic = ts.getModifierFlags(member) & 32 /* Static */; var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { switch (member.kind) { - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: addName(names, member.name, memberName, 1 /* Getter */); break; - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: addName(names, member.name, memberName, 2 /* Setter */); break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: addName(names, member.name, memberName, 3 /* Property */); break; } @@ -38678,17 +38887,49 @@ var ts; } } function addName(names, location, name, meaning) { - var prev = names[name]; + var prev = names.get(name); if (prev) { if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { - names[name] = prev | meaning; + names.set(name, prev | meaning); } } else { - names[name] = meaning; + names.set(name, meaning); + } + } + } + /** + * Static members being set on a constructor function may conflict with built-in properties + * of Function. Esp. in ECMAScript 5 there are non-configurable and non-writable + * built-in properties. This check issues a transpile error when a class has a static + * member with the same name as a non-writable built-in property. + * + * @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.3 + * @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.5 + * @see http://www.ecma-international.org/ecma-262/6.0/#sec-properties-of-the-function-constructor + * @see http://www.ecma-international.org/ecma-262/6.0/#sec-function-instances + */ + function checkClassForStaticPropertyNameConflicts(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var memberNameNode = member.name; + var isStatic = ts.getModifierFlags(member) & 32 /* Static */; + if (isStatic && memberNameNode) { + var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); + switch (memberName) { + case "name": + case "length": + case "caller": + case "arguments": + case "prototype": + var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; + var className = getNameOfSymbol(getSymbolOfNode(node)); + error(memberNameNode, message, memberName, className); + break; + } } } } @@ -38696,7 +38937,7 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind == 146 /* PropertySignature */) { + if (member.kind == 147 /* PropertySignature */) { var memberName = void 0; switch (member.name.kind) { case 9 /* StringLiteral */: @@ -38707,18 +38948,18 @@ var ts; default: continue; } - if (names[memberName]) { + if (names.get(memberName)) { error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName); error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName); } else { - names[memberName] = true; + names.set(memberName, true); } } } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 228 /* InterfaceDeclaration */) { + if (node.kind === 229 /* 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 @@ -38738,7 +38979,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -38814,12 +39055,12 @@ var ts; if (n.kind === 98 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 /* FunctionExpression */ && n.kind !== 226 /* FunctionDeclaration */) { + else if (n.kind !== 185 /* FunctionExpression */ && n.kind !== 227 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 147 /* PropertyDeclaration */ && + return n.kind === 148 /* PropertyDeclaration */ && !(ts.getModifierFlags(n) & 32 /* Static */) && !!n.initializer; } @@ -38849,7 +39090,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -38873,7 +39114,7 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 151 /* GetAccessor */) { + if (node.kind === 152 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) { if (!(node.flags & 256 /* HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -38883,13 +39124,13 @@ 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 === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } 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 === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */; + var otherKind = node.kind === 152 /* GetAccessor */ ? 153 /* SetAccessor */ : 152 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if ((ts.getModifierFlags(node) & 28 /* AccessibilityModifier */) !== (ts.getModifierFlags(otherAccessor) & 28 /* AccessibilityModifier */)) { @@ -38905,11 +39146,11 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 151 /* GetAccessor */) { + if (node.kind === 152 /* GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } - if (node.parent.kind !== 176 /* ObjectLiteralExpression */) { + if (node.parent.kind !== 177 /* ObjectLiteralExpression */) { checkSourceElement(node.body); registerForUnusedIdentifiersCheck(node); } @@ -38992,16 +39233,36 @@ var ts; function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement); } + function checkIndexedAccessIndexType(type, accessNode) { + if (!(type.flags & 524288 /* IndexedAccess */)) { + return type; + } + // Check if the index type is assignable to 'keyof T' for the object type. + var objectType = type.objectType; + var indexType = type.indexType; + if (isTypeAssignableTo(indexType, getIndexType(objectType))) { + return type; + } + // Check if we're indexing with a numeric type and the object type is a generic + // type with a constraint that has a numeric index signature. + if (maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && isTypeOfKind(indexType, 340 /* NumberLike */)) { + var constraint = getBaseConstraintOfType(objectType); + if (constraint && getIndexInfoOfType(constraint, 1 /* Number */)) { + return type; + } + } + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return type; + } function checkIndexedAccessType(node) { - getTypeFromIndexedAccessTypeNode(node); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node) { checkSourceElement(node.typeParameter); checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 540672 /* TypeVariable */ ? getApparentTypeOfTypeVariable(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8 /* Private */) && ts.isInAmbientContext(node); @@ -39010,9 +39271,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 228 /* InterfaceDeclaration */ && - n.parent.kind !== 227 /* ClassDeclaration */ && - n.parent.kind !== 197 /* ClassExpression */ && + if (n.parent.kind !== 229 /* InterfaceDeclaration */ && + n.parent.kind !== 228 /* ClassDeclaration */ && + n.parent.kind !== 198 /* ClassExpression */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported @@ -39100,7 +39361,7 @@ var ts; var errorNode_1 = subsequentNode.name || subsequentNode; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - var reportError = (node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */) && + var reportError = (node.kind === 150 /* MethodDeclaration */ || node.kind === 149 /* MethodSignature */) && (ts.getModifierFlags(node) & 32 /* Static */) !== (ts.getModifierFlags(subsequentNode) & 32 /* Static */); // we can get here in two cases // 1. mixed static and instance class members @@ -39139,7 +39400,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 228 /* InterfaceDeclaration */ || node.parent.kind === 161 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 229 /* InterfaceDeclaration */ || node.parent.kind === 162 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -39150,7 +39411,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 === 226 /* FunctionDeclaration */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */ || node.kind === 150 /* Constructor */) { + if (node.kind === 227 /* FunctionDeclaration */ || node.kind === 150 /* MethodDeclaration */ || node.kind === 149 /* MethodSignature */ || node.kind === 151 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -39272,16 +39533,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -39545,22 +39806,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 144 /* Parameter */: + case 145 /* 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 147 /* PropertyDeclaration */: + case 148 /* 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 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -39601,14 +39862,14 @@ var ts; } var firstDecorator = node.decorators[0]; checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */); - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -39617,19 +39878,19 @@ var ts; } } break; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); break; - case 144 /* Parameter */: + case 145 /* Parameter */: markTypeNodeAsReferenced(node.type); break; } @@ -39653,7 +39914,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 === 142 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 143 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -39713,43 +39974,43 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 262 /* SourceFile */: - case 231 /* ModuleDeclaration */: + case 263 /* SourceFile */: + case 232 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: checkUnusedTypeParameters(node); break; - case 205 /* Block */: - case 233 /* CaseBlock */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: checkUnusedLocalsAndParameters(node); break; - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: if (node.body) { checkUnusedLocalsAndParameters(node); } checkUnusedTypeParameters(node); break; - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: checkUnusedTypeParameters(node); break; } @@ -39758,11 +40019,10 @@ var ts; } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 228 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_2 = function (key) { - var local = node.locals[key]; + if (node.parent.kind !== 229 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + node.locals.forEach(function (local) { if (!local.isReferenced) { - if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144 /* Parameter */) { + if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 145 /* Parameter */) { var parameter = ts.getRootDeclaration(local.valueDeclaration); if (compilerOptions.noUnusedParameters && !ts.isParameterPropertyDeclaration(parameter) && @@ -39775,10 +40035,7 @@ var ts; ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); }); } } - }; - for (var key in node.locals) { - _loop_2(key); - } + }); } } function isRemovedPropertyFromObjectSpread(node) { @@ -39791,9 +40048,9 @@ var ts; function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 224 /* VariableDeclaration */ && - (declaration.parent.parent.kind === 213 /* ForInStatement */ || - declaration.parent.parent.kind === 214 /* ForOfStatement */)) { + if (declaration.kind === 225 /* VariableDeclaration */ && + (declaration.parent.parent.kind === 214 /* ForInStatement */ || + declaration.parent.parent.kind === 215 /* ForOfStatement */)) { return; } } @@ -39812,12 +40069,12 @@ var ts; if (node.members) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 149 /* MethodDeclaration */ || member.kind === 147 /* PropertyDeclaration */) { + if (member.kind === 150 /* MethodDeclaration */ || member.kind === 148 /* PropertyDeclaration */) { if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8 /* Private */) { error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); } } - else if (member.kind === 150 /* Constructor */) { + else if (member.kind === 151 /* Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8 /* Private */) { @@ -39850,8 +40107,7 @@ var ts; } function checkUnusedModuleMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { - for (var key in node.locals) { - var local = node.locals[key]; + node.locals.forEach(function (local) { if (!local.isReferenced && !local.exportSymbol) { for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; @@ -39860,12 +40116,12 @@ var ts; } } } - } + }); } } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 205 /* Block */) { + if (node.kind === 206 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -39888,12 +40144,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 146 /* PropertySignature */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 148 /* MethodSignature */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 147 /* PropertySignature */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 149 /* MethodSignature */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -39902,7 +40158,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 144 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 145 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -39980,12 +40236,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 231 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 232 /* 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 === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 263 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -39995,12 +40251,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 231 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 232 /* 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 === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { + if (parent.kind === 263 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -40035,7 +40291,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 224 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 225 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -40045,24 +40301,24 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 225 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 206 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 226 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 207 /* 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 === 205 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 232 /* ModuleBlock */ || - container.kind === 231 /* ModuleDeclaration */ || - container.kind === 262 /* SourceFile */); + (container.kind === 206 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 233 /* ModuleBlock */ || + container.kind === 232 /* ModuleDeclaration */ || + container.kind === 263 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail // since LHS will be block scoped name instead of function scoped if (!namesShareScope) { - var name_23 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23); + var name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } @@ -40070,7 +40326,7 @@ 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 !== 144 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 145 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -40081,7 +40337,7 @@ var ts; // skip declaration names (i.e. in object literal expressions) return; } - if (n.kind === 177 /* PropertyAccessExpression */) { + if (n.kind === 178 /* PropertyAccessExpression */) { // skip property names in property access expression return visit(n.expression); } @@ -40100,8 +40356,8 @@ var ts; // so we need to do a bit of extra work to check if reference is legal var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144 /* Parameter */ || - symbol.valueDeclaration.kind === 174 /* BindingElement */) { + if (symbol.valueDeclaration.kind === 145 /* Parameter */ || + symbol.valueDeclaration.kind === 175 /* BindingElement */) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { @@ -40115,7 +40371,7 @@ var ts; } // computed property names/initializers in instance property declaration of class like entities // are executed in constructor and thus deferred - if (current.parent.kind === 147 /* PropertyDeclaration */ && + if (current.parent.kind === 148 /* PropertyDeclaration */ && !(ts.hasModifier(current.parent, 32 /* Static */)) && ts.isClassLike(current.parent.parent)) { return; @@ -40142,28 +40398,28 @@ 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 === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 174 /* BindingElement */) { - if (node.parent.kind === 172 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */ && !ts.isInAmbientContext(node)) { + if (node.kind === 175 /* BindingElement */) { + if (node.parent.kind === 173 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */ && !ts.isInAmbientContext(node)) { checkExternalEmitHelpers(node, 4 /* Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 142 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access - var parent_11 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_11); - var name_24 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); + var parent = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent); + var name = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name)); markPropertyAsReferenced(property); - if (parent_11.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + if (parent.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent, parent.initializer, parentType, property); } } // For a binding pattern, check contained binding elements @@ -40171,14 +40427,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 === 144 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 145 /* 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)) { // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 213 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 214 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -40189,7 +40445,7 @@ var ts; if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 213 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 214 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -40209,10 +40465,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */) { + if (node.kind !== 148 /* PropertyDeclaration */ && node.kind !== 147 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 224 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */) { + if (node.kind === 225 /* VariableDeclaration */ || node.kind === 175 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -40223,8 +40479,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 /* Parameter */ && right.kind === 224 /* VariableDeclaration */) || - (left.kind === 224 /* VariableDeclaration */ && right.kind === 144 /* Parameter */)) { + if ((left.kind === 145 /* Parameter */ && right.kind === 225 /* VariableDeclaration */) || + (left.kind === 225 /* VariableDeclaration */ && right.kind === 145 /* Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -40254,7 +40510,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 === 176 /* ObjectLiteralExpression */) { + if (node.modifiers && node.parent.kind === 177 /* ObjectLiteralExpression */) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -40275,7 +40531,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 207 /* EmptyStatement */) { + if (node.thenStatement.kind === 208 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -40295,12 +40551,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 225 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 226 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 225 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -40323,14 +40579,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 === 225 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* 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 === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) { + if (varExpr.kind === 176 /* ArrayLiteralExpression */ || varExpr.kind === 177 /* 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. @@ -40362,7 +40618,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 === 225 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* 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); @@ -40376,7 +40632,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 === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) { + if (varExpr.kind === 176 /* ArrayLiteralExpression */ || varExpr.kind === 177 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -40629,7 +40885,7 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152 /* SetAccessor */))); + return !!(node.kind === 152 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 153 /* SetAccessor */))); } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; @@ -40656,33 +40912,33 @@ var ts; // for generators. return; } - if (func.kind === 152 /* SetAccessor */) { + if (func.kind === 153 /* SetAccessor */) { if (node.expression) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 150 /* Constructor */) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { - error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + else if (func.kind === 151 /* Constructor */) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { // If the function has a return type, but promisedType is // undefined, an error will be reported in checkAsyncFunctionReturnType // so we don't need to report one here. - checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + checkTypeAssignableTo(awaitedType, promisedType, node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression || node); + checkTypeAssignableTo(exprType, returnType, node); } } } - else if (func.kind !== 150 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + else if (func.kind !== 151 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -40712,7 +40968,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 255 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 256 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -40724,7 +40980,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 254 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 255 /* 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 comparable @@ -40755,7 +41011,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 220 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 221 /* 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; @@ -40792,14 +41048,14 @@ var ts; grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var blockLocals = catchClause.block.locals; - if (blockLocals) { - for (var caughtName in catchClause.locals) { - var blockLocal = blockLocals[caughtName]; + var blockLocals_1 = catchClause.block.locals; + if (blockLocals_1) { + ts.forEachKey(catchClause.locals, function (caughtName) { + var blockLocal = blockLocals_1.get(caughtName); if (blockLocal && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); } - } + }); } } } @@ -40851,15 +41107,16 @@ var ts; if (!indexType) { return; } + var propDeclaration = prop.valueDeclaration; // index is numeric and property name is not valid numeric literal - if (indexKind === 1 /* Number */ && !isNumericName(prop.valueDeclaration.name)) { + if (indexKind === 1 /* Number */ && !(propDeclaration ? isNumericName(propDeclaration.name) : isNumericLiteralName(prop.name))) { return; } // 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 === 142 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + if (propDeclaration && (propDeclaration.name.kind === 143 /* ComputedPropertyName */ || prop.parent === containingType.symbol)) { + errorNode = propDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; @@ -40889,6 +41146,7 @@ var ts; case "string": case "symbol": case "void": + case "object": error(name, message, name.text); } } @@ -40916,7 +41174,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* ClassDeclaration */ || declaration.kind === 228 /* InterfaceDeclaration */) { + if (declaration.kind === 228 /* ClassDeclaration */ || declaration.kind === 229 /* InterfaceDeclaration */) { if (!firstDecl) { firstDecl = declaration; } @@ -40961,6 +41219,10 @@ var ts; var staticType = getTypeOfSymbol(symbol); checkTypeParameterListsIdentical(node, symbol); checkClassForDuplicateDeclarations(node); + // Only check for reserved static identifiers on non-ambient context. + if (!ts.isInAmbientContext(node)) { + checkClassForStaticPropertyNameConflicts(node); + } var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { if (languageVersion < 2 /* ES2015 */ && !ts.isInAmbientContext(node)) { @@ -40969,7 +41231,8 @@ var ts; var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; - var staticBaseType = getBaseConstructorTypeOfClass(type); + var baseConstructorType = getBaseConstructorTypeOfClass(type); + var staticBaseType = getApparentType(baseConstructorType); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { @@ -40983,14 +41246,17 @@ var ts; } checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType_1.symbol.valueDeclaration && + if (baseConstructorType.flags & 540672 /* TypeVariable */ && !isMixinConstructorType(staticType)) { + error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); + } + if (baseType_1.symbol && baseType_1.symbol.valueDeclaration && !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 227 /* ClassDeclaration */) { + baseType_1.symbol.valueDeclaration.kind === 228 /* ClassDeclaration */) { if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); } } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */)) { + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 540672 /* TypeVariable */)) { // When the static base type is a "class-like" constructor function (but not actually a class), we verify // that all instantiated base constructor signatures return the same type. We can simply compare the type // references (as opposed to checking the structure of the types) because elsewhere we have already checked @@ -41014,8 +41280,7 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { - var declaredType = getObjectFlags(t) & 4 /* Reference */ ? t.target : t; - if (getObjectFlags(declaredType) & 3 /* ClassOrInterface */) { + if (isValidBaseType(t)) { checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -41065,7 +41330,7 @@ var ts; // Base class instance member variables and accessors can be overridden by // derived class instance member variables and accessors, but not by other kinds of members. // NOTE: assignability is checked in checkClassDeclaration - var baseProperties = getPropertiesOfObjectType(baseType); + var baseProperties = getPropertiesOfType(baseType); for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); @@ -41086,7 +41351,7 @@ var ts; // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128 /* Abstract */))) { - if (derivedClassDecl.kind === 197 /* ClassExpression */) { + if (derivedClassDecl.kind === 198 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -41134,7 +41399,7 @@ var ts; } } function isAccessor(kind) { - return kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */; + return kind === 152 /* GetAccessor */ || kind === 153 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -41170,16 +41435,16 @@ var ts; return true; } var seen = ts.createMap(); - ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.name, { prop: p, containingType: type }); }); var ok = true; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); + var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { var prop = properties_7[_a]; - var existing = seen[prop.name]; + var existing = seen.get(prop.name); if (!existing) { - seen[prop.name] = { prop: prop, containingType: base }; + seen.set(prop.name, { prop: prop, containingType: base }); } else { var isInheritedProperty = existing.containingType !== type; @@ -41206,7 +41471,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 228 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 229 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -41313,7 +41578,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -41324,7 +41589,7 @@ var ts; case 51 /* TildeToken */: return ~value_1; } return undefined; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -41350,11 +41615,11 @@ var ts; case 8 /* NumericLiteral */: checkGrammarNumericLiteral(e); return +e.text; - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return evalConstant(e.expression); case 70 /* Identifier */: - case 178 /* ElementAccessExpression */: - case 177 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -41367,7 +41632,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 178 /* ElementAccessExpression */) { + if (e.kind === 179 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; @@ -41385,7 +41650,7 @@ var ts; if (current.kind === 70 /* Identifier */) { break; } - else if (current.kind === 177 /* PropertyAccessExpression */) { + else if (current.kind === 178 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -41458,7 +41723,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 230 /* EnumDeclaration */) { + if (declaration.kind !== 231 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -41481,8 +41746,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 227 /* ClassDeclaration */ || - (declaration.kind === 226 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 228 /* ClassDeclaration */ || + (declaration.kind === 227 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -41546,7 +41811,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, 227 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 228 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -41597,26 +41862,26 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 241 /* ExportAssignment */: - case 242 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 243 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 235 /* ImportEqualsDeclaration */: - case 236 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 237 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 174 /* BindingElement */: - case 224 /* VariableDeclaration */: - var name_25 = node.name; - if (ts.isBindingPattern(name_25)) { - for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { + case 175 /* BindingElement */: + case 225 /* VariableDeclaration */: + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); @@ -41624,12 +41889,12 @@ var ts; break; } // fallthrough - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: - case 226 /* FunctionDeclaration */: - case 228 /* InterfaceDeclaration */: - case 231 /* ModuleDeclaration */: - case 229 /* TypeAliasDeclaration */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 227 /* FunctionDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -41652,12 +41917,12 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return node; - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: do { node = node.left; } while (node.kind !== 70 /* Identifier */); return node; - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 70 /* Identifier */); @@ -41670,9 +41935,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 232 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 262 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 242 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 233 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 263 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 243 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -41705,7 +41970,7 @@ var ts; (symbol.flags & 793064 /* Type */ ? 793064 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 244 /* ExportSpecifier */ ? + var message = node.kind === 245 /* 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)); @@ -41733,7 +41998,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 238 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 239 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -41790,8 +42055,8 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 232 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 262 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 233 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 263 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -41805,7 +42070,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 262 /* SourceFile */ || node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 231 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 263 /* SourceFile */ || node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 232 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -41831,8 +42096,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 === 262 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 231 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 263 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 232 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -41864,18 +42129,13 @@ var ts; } } function hasExportedMembers(moduleSymbol) { - for (var id in moduleSymbol.exports) { - if (id !== "export=") { - return true; - } - } - return false; + return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; }); } function checkExternalModuleExports(node) { var moduleSymbol = getSymbolOfNode(node); var links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - var exportEqualsSymbol = moduleSymbol.exports["export="]; + var exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (!isTopLevelInExternalModuleAugmentation(declaration)) { @@ -41884,21 +42144,21 @@ var ts; } // Checks for export * conflicts var exports = getExportsOfModule(moduleSymbol); - for (var id in exports) { + exports && exports.forEach(function (_a, id) { + var declarations = _a.declarations, flags = _a.flags; if (id === "__export") { - continue; + return; } - var _a = exports[id], declarations = _a.declarations, flags = _a.flags; // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. // (TS Exceptions: namespaces, function overloads, enums, and interfaces) if (flags & (1920 /* Namespace */ | 64 /* Interface */ | 384 /* Enum */)) { - continue; + return; } var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); if (flags & 524288 /* TypeAlias */ && exportedDeclarationsCount <= 2) { // it is legal to merge type alias with other values // so count should be either 1 (just type alias) or 2 (type alias + merged value) - continue; + return; } if (exportedDeclarationsCount > 1) { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -41908,11 +42168,11 @@ var ts; } } } - } + }); links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 226 /* FunctionDeclaration */ && declaration.kind !== 149 /* MethodDeclaration */) || + return (declaration.kind !== 227 /* FunctionDeclaration */ && declaration.kind !== 150 /* MethodDeclaration */) || !!declaration.body; } } @@ -41925,123 +42185,123 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 231 /* ModuleDeclaration */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 226 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return checkTypeParameter(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return checkParameter(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return checkPropertyDeclaration(node); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return checkSignatureDeclaration(node); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return checkMethodDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return checkConstructorDeclaration(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return checkAccessorDeclaration(node); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return checkTypeReferenceNode(node); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return checkTypePredicate(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return checkTypeQuery(node); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return checkTypeLiteral(node); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return checkArrayType(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return checkTupleType(node); - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 166 /* ParenthesizedType */: - case 168 /* TypeOperator */: + case 167 /* ParenthesizedType */: + case 169 /* TypeOperator */: return checkSourceElement(node.type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return checkIndexedAccessType(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return checkMappedType(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 205 /* Block */: - case 232 /* ModuleBlock */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return checkBlock(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return checkVariableStatement(node); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return checkExpressionStatement(node); - case 209 /* IfStatement */: + case 210 /* IfStatement */: return checkIfStatement(node); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return checkDoStatement(node); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return checkWhileStatement(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return checkForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return checkForInStatement(node); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return checkForOfStatement(node); - case 215 /* ContinueStatement */: - case 216 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return checkReturnStatement(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return checkWithStatement(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return checkSwitchStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return checkLabeledStatement(node); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: return checkThrowStatement(node); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return checkTryStatement(node); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return checkBindingElement(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return checkClassDeclaration(node); - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return checkImportDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return checkExportDeclaration(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return checkExportAssignment(node); - case 207 /* EmptyStatement */: + case 208 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 223 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 245 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -42063,17 +42323,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: checkAccessorDeferred(node); break; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: checkClassExpressionDeferred(node); break; } @@ -42179,7 +42439,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 218 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 219 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -42202,25 +42462,25 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 262 /* SourceFile */: + case 263 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 197 /* ClassExpression */: + case 198 /* 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 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* 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. @@ -42229,7 +42489,7 @@ var ts; copySymbols(getSymbolOfNode(location).members, meaning & 793064 /* Type */); } break; - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -42257,17 +42517,16 @@ var ts; // We will copy all symbol regardless of its reserved name because // symbolsToArray will check whether the key is a reserved name and // it will not copy symbol with reserved name to the array - if (!symbols[id]) { - symbols[id] = symbol; + if (!symbols.has(id)) { + symbols.set(id, symbol); } } } function copySymbols(source, meaning) { if (meaning) { - for (var id in source) { - var symbol = source[id]; + source.forEach(function (symbol) { copySymbol(symbol, meaning); - } + }); } } } @@ -42278,28 +42537,28 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 143 /* TypeParameter */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 230 /* EnumDeclaration */: + case 144 /* TypeParameter */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* 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 === 141 /* QualifiedName */) { + while (node.parent && node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } - return node.parent && (node.parent.kind === 157 /* TypeReference */ || node.parent.kind === 273 /* JSDocTypeReference */); + return node.parent && (node.parent.kind === 158 /* TypeReference */ || node.parent.kind === 274 /* JSDocTypeReference */); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 177 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 178 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 199 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 200 /* ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -42316,13 +42575,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 141 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 142 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 235 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 236 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 241 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 242 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -42334,7 +42593,7 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177 /* PropertyAccessExpression */) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 178 /* PropertyAccessExpression */) { var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); switch (specialPropertyAssignmentKind) { case 1 /* ExportsProperty */: @@ -42346,13 +42605,13 @@ var ts; default: } } - if (entityName.parent.kind === 241 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 242 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 177 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { + if (entityName.kind !== 178 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(entityName, 235 /* ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(entityName, 236 /* ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true); } @@ -42362,7 +42621,7 @@ var ts; if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0 /* None */; // In an interface or class, we're definitely interested in a type. - if (entityName.parent.kind === 199 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 200 /* ExpressionWithTypeArguments */) { meaning = 793064 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -42386,14 +42645,14 @@ var ts; } return resolveEntityName(entityName, 107455 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.kind === 177 /* PropertyAccessExpression */) { + else if (entityName.kind === 178 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 141 /* QualifiedName */) { + else if (entityName.kind === 142 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -42402,20 +42661,20 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 /* TypeReference */ || entityName.parent.kind === 273 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; + var meaning = (entityName.parent.kind === 158 /* TypeReference */ || entityName.parent.kind === 274 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 251 /* JsxAttribute */) { + else if (entityName.parent.kind === 252 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 156 /* TypePredicate */) { + if (entityName.parent.kind === 157 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 262 /* SourceFile */) { + if (node.kind === 263 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -42433,8 +42692,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 174 /* BindingElement */ && - node.parent.parent.kind === 172 /* ObjectBindingPattern */ && + else if (node.parent.kind === 175 /* BindingElement */ && + node.parent.parent.kind === 173 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -42445,8 +42704,8 @@ var ts; } switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 98 /* ThisKeyword */: var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); @@ -42460,12 +42719,12 @@ var ts; case 96 /* SuperKeyword */: var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 167 /* ThisType */: + case 168 /* ThisType */: return getTypeFromTypeNode(node).symbol; case 122 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 150 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 151 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -42473,7 +42732,7 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 236 /* ImportDeclaration */ || node.parent.kind === 242 /* ExportDeclaration */) && + ((node.parent.kind === 237 /* ImportDeclaration */ || node.parent.kind === 243 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -42483,7 +42742,7 @@ var ts; // Fall through case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -42500,7 +42759,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 === 259 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 260 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */); } return undefined; @@ -42562,28 +42821,28 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 176 /* ObjectLiteralExpression */ || expr.kind === 175 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 177 /* ObjectLiteralExpression */ || expr.kind === 176 /* ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 214 /* ForOfStatement */) { + if (expr.parent.kind === 215 /* ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 192 /* BinaryExpression */) { + if (expr.parent.kind === 193 /* BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 258 /* PropertyAssignment */) { + if (expr.parent.kind === 259 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } // Array literal assignment - array destructuring pattern - ts.Debug.assert(expr.parent.kind === 175 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.parent.kind === 176 /* ArrayLiteralExpression */); // [{ property1: p1, property2 }] = elems; var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType; @@ -42623,8 +42882,8 @@ var ts; var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0 /* Call */).length || getSignaturesOfType(type, 1 /* Construct */).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { - if (!propsByName[p.name]) { - propsByName[p.name] = p; + if (!propsByName.has(p.name)) { + propsByName.set(p.name, p); } }); } @@ -42633,9 +42892,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456 /* SyntheticProperty */) { var symbols_3 = []; - var name_26 = symbol.name; + var name_2 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_26); + var symbol = getPropertyOfType(t, name_2); if (symbol) { symbols_3.push(symbol); } @@ -42647,6 +42906,9 @@ var ts; var links = symbol; return [links.leftSpread, links.rightSpread]; } + if (symbol.mappedTypeOrigin) { + return getRootSymbols(symbol.mappedTypeOrigin); + } var target = void 0; var next = symbol; while (next = getSymbolLinks(next).target) { @@ -42663,7 +42925,8 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - return getReferencedValueSymbol(node) === argumentsSymbol; + var isPropertyName_1 = node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node; + return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } return false; @@ -42684,7 +42947,7 @@ var ts; // otherwise - check if at least one export is value symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 107455 /* Value */) - : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue); + : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; function isValue(s) { @@ -42719,7 +42982,7 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 262 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 263 /* SourceFile */) { var symbolFile = parentSymbol.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -42776,7 +43039,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 205 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 206 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -42822,16 +43085,16 @@ var ts; return true; } switch (node.kind) { - case 235 /* ImportEqualsDeclaration */: - case 237 /* ImportClause */: - case 238 /* NamespaceImport */: - case 240 /* ImportSpecifier */: - case 244 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return node.expression && node.expression.kind === 70 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -42841,7 +43104,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 262 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 263 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -42907,7 +43170,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 261 /* EnumMember */) { + if (node.kind === 262 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -42925,16 +43188,18 @@ var ts; function getTypeReferenceSerializationKind(typeName, location) { // Resolve the symbol as a value to ensure the type can be reached at runtime during emit. var valueSymbol = resolveEntityName(typeName, 107455 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); - var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); - if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { - return ts.TypeReferenceSerializationKind.Promise; - } - var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; - if (constructorType && isConstructorType(constructorType)) { - return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; - } // Resolve the symbol as a type so that we can provide a more useful hint for the type serializer. var typeSymbol = resolveEntityName(typeName, 793064 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); + if (valueSymbol && valueSymbol === typeSymbol) { + var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return ts.TypeReferenceSerializationKind.Promise; + } + var constructorType = getTypeOfSymbol(valueSymbol); + if (constructorType && isConstructorType(constructorType)) { + return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + } // We might not be able to resolve type symbol so use unknown type in that case (eg error case) if (!typeSymbol) { return ts.TypeReferenceSerializationKind.ObjectType; @@ -42997,7 +43262,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); } function hasGlobalName(name) { - return !!globals[name]; + return globals.has(name); } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; @@ -43008,9 +43273,9 @@ var ts; if (startInDeclarationContainer) { // When resolving the name of a declaration as a value, we need to start resolution // at a point outside of the declaration. - var parent_12 = reference.parent; - if (ts.isDeclaration(parent_12) && reference === parent_12.name) { - location = getDeclarationContainer(parent_12); + var parent = reference.parent; + if (ts.isDeclaration(parent) && reference === parent.name) { + location = getDeclarationContainer(parent); } } return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); @@ -43046,14 +43311,13 @@ var ts; if (resolvedTypeReferenceDirectives) { // populate reverse mapping: file path -> type reference directive that was resolved to this file fileToDirective = ts.createFileMap(); - for (var key in resolvedTypeReferenceDirectives) { - var resolvedDirective = resolvedTypeReferenceDirectives[key]; + resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (!resolvedDirective) { - continue; + return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key); - } + }); } return { getReferencedExportContainer: getReferencedExportContainer, @@ -43096,7 +43360,7 @@ var ts; // property access can only be used as values // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries - var meaning = (node.kind === 177 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node)) + var meaning = (node.kind === 178 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node)) ? 107455 /* Value */ | 1048576 /* ExportValue */ : 793064 /* Type */ | 1920 /* Namespace */; var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true); @@ -43139,15 +43403,15 @@ var ts; // external modules cannot define or contribute to type declaration files var current = symbol; while (true) { - var parent_13 = getParentOfSymbol(current); - if (parent_13) { - current = parent_13; + var parent = getParentOfSymbol(current); + if (parent) { + current = parent; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 262 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 263 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -43167,7 +43431,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 262 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 263 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -43191,11 +43455,11 @@ var ts; if (file.symbol && file.symbol.globalExports) { // Merge in UMD exports with first-in-wins semantics (see #9771) var source = file.symbol.globalExports; - for (var id in source) { - if (!(id in globals)) { - globals[id] = source[id]; + source.forEach(function (sourceSymbol, id) { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); } - } + }); } } if (augmentations) { @@ -43265,10 +43529,10 @@ var ts; var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; for (var helper = 1 /* FirstEmitHelper */; helper <= 128 /* LastEmitHelper */; helper <<= 1) { if (uncheckedHelpers & helper) { - var name_27 = getHelperName(helper); - var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_27), 107455 /* Value */); + var name = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name), 107455 /* Value */); if (!symbol) { - error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_27); + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); } } } @@ -43319,14 +43583,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 149 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 150 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */) { + else if (node.kind === 152 /* GetAccessor */ || node.kind === 153 /* 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); @@ -43344,16 +43608,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 130 /* ReadonlyKeyword */) { - if (node.kind === 146 /* PropertySignature */ || node.kind === 148 /* MethodSignature */) { + if (node.kind === 147 /* PropertySignature */ || node.kind === 149 /* MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 75 /* ConstKeyword */: - if (node.kind !== 230 /* EnumDeclaration */ && node.parent.kind === 227 /* ClassDeclaration */) { + if (node.kind !== 231 /* EnumDeclaration */ && node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75 /* ConstKeyword */)); } break; @@ -43379,7 +43643,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { + else if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 263 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -43402,10 +43666,10 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { + else if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 263 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128 /* Abstract */) { @@ -43418,7 +43682,7 @@ var ts; if (flags & 64 /* Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */ && node.kind !== 155 /* IndexSignature */ && node.kind !== 144 /* Parameter */) { + else if (node.kind !== 148 /* PropertyDeclaration */ && node.kind !== 147 /* PropertySignature */ && node.kind !== 156 /* IndexSignature */ && node.kind !== 145 /* Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -43438,10 +43702,10 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 227 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; @@ -43453,13 +43717,13 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 227 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 232 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 233 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -43469,14 +43733,14 @@ var ts; if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 227 /* ClassDeclaration */) { - if (node.kind !== 149 /* MethodDeclaration */ && - node.kind !== 147 /* PropertyDeclaration */ && - node.kind !== 151 /* GetAccessor */ && - node.kind !== 152 /* SetAccessor */) { + if (node.kind !== 228 /* ClassDeclaration */) { + if (node.kind !== 150 /* MethodDeclaration */ && + node.kind !== 148 /* PropertyDeclaration */ && + node.kind !== 152 /* GetAccessor */ && + node.kind !== 153 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 227 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { + if (!(node.parent.kind === 228 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -43495,7 +43759,7 @@ var ts; 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 === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256 /* Async */; @@ -43503,7 +43767,7 @@ var ts; break; } } - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -43518,13 +43782,13 @@ var ts; } return; } - else if ((node.kind === 236 /* ImportDeclaration */ || node.kind === 235 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 237 /* ImportDeclaration */ || node.kind === 236 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 145 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 145 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256 /* Async */) { @@ -43544,37 +43808,37 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 155 /* IndexSignature */: - case 231 /* ModuleDeclaration */: - case 236 /* ImportDeclaration */: - case 235 /* ImportEqualsDeclaration */: - case 242 /* ExportDeclaration */: - case 241 /* ExportAssignment */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 144 /* Parameter */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 156 /* IndexSignature */: + case 232 /* ModuleDeclaration */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 145 /* Parameter */: return false; default: - if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { + if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 263 /* SourceFile */) { return false; } switch (node.kind) { - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return nodeHasAnyModifiersExcept(node, 119 /* AsyncKeyword */); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return nodeHasAnyModifiersExcept(node, 116 /* AbstractKeyword */); - case 228 /* InterfaceDeclaration */: - case 206 /* VariableStatement */: - case 229 /* TypeAliasDeclaration */: + case 229 /* InterfaceDeclaration */: + case 207 /* VariableStatement */: + case 230 /* TypeAliasDeclaration */: return true; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 75 /* ConstKeyword */); default: ts.Debug.fail(); @@ -43587,10 +43851,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 149 /* MethodDeclaration */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: if (!node.asteriskToken) { return false; } @@ -43653,7 +43917,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 185 /* ArrowFunction */) { + if (node.kind === 186 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -43688,7 +43952,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 !== 134 /* StringKeyword */ && parameter.type.kind !== 132 /* NumberKeyword */) { + if (parameter.type.kind !== 135 /* StringKeyword */ && parameter.type.kind !== 132 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -43716,7 +43980,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { var arg = args_4[_i]; - if (arg.kind === 198 /* OmittedExpression */) { + if (arg.kind === 199 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -43789,19 +44053,19 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 142 /* ComputedPropertyName */) { + if (node.kind !== 143 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 192 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* CommaToken */) { + if (computedPropertyName.expression.kind === 193 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* 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 === 226 /* FunctionDeclaration */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 149 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 227 /* FunctionDeclaration */ || + node.kind === 185 /* FunctionExpression */ || + node.kind === 150 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -43826,15 +44090,15 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 260 /* SpreadAssignment */) { + if (prop.kind === 261 /* SpreadAssignment */) { continue; } - var name_28 = prop.name; - if (name_28.kind === 142 /* ComputedPropertyName */) { + var name = prop.name; + if (name.kind === 143 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it - checkGrammarComputedPropertyName(name_28); + checkGrammarComputedPropertyName(name); } - if (prop.kind === 259 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 260 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -43843,7 +44107,7 @@ var ts; if (prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 149 /* MethodDeclaration */) { + if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 150 /* MethodDeclaration */) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -43857,48 +44121,48 @@ 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 === 258 /* PropertyAssignment */ || prop.kind === 259 /* ShorthandPropertyAssignment */) { + if (prop.kind === 259 /* PropertyAssignment */ || prop.kind === 260 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_28.kind === 8 /* NumericLiteral */) { - checkGrammarNumericLiteral(name_28); + if (name.kind === 8 /* NumericLiteral */) { + checkGrammarNumericLiteral(name); } currentKind = Property; } - else if (prop.kind === 149 /* MethodDeclaration */) { + else if (prop.kind === 150 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 151 /* GetAccessor */) { + else if (prop.kind === 152 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 152 /* SetAccessor */) { + else if (prop.kind === 153 /* SetAccessor */) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_28); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name); if (effectiveName === undefined) { continue; } - if (!seen[effectiveName]) { - seen[effectiveName] = currentKind; + var existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); } else { - var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_28, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_28)); + grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[effectiveName] = currentKind | existingKind; + seen.set(effectiveName, currentKind | existingKind); } else { - return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -43907,19 +44171,19 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 252 /* JsxSpreadAttribute */) { + if (attr.kind === 253 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; - var name_29 = jsxAttr.name; - if (!seen[name_29.text]) { - seen[name_29.text] = true; + var name = jsxAttr.name; + if (!seen.get(name.text)) { + seen.set(name.text, true); } else { - return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 253 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 254 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -43928,7 +44192,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 225 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 226 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -43943,20 +44207,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 213 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* 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 = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 213 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* 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 === 213 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* 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); @@ -43983,11 +44247,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 151 /* GetAccessor */ ? + return grammarErrorOnNode(accessor.name, kind === 152 /* GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 152 /* SetAccessor */) { + else if (kind === 153 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -44010,10 +44274,10 @@ var ts; A get accessor has no parameters or a single `this` parameter. A set accessor has one parameter or a `this` parameter and one more parameter */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 152 /* GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 152 /* GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } @@ -44028,7 +44292,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 176 /* ObjectLiteralExpression */) { + if (node.parent.kind === 177 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } @@ -44049,10 +44313,10 @@ 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 === 228 /* InterfaceDeclaration */) { + else if (node.parent.kind === 229 /* 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 === 161 /* TypeLiteral */) { + else if (node.parent.kind === 162 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -44063,11 +44327,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 220 /* LabeledStatement */: + case 221 /* 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 === 215 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 216 /* ContinueStatement */ && !ts.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); @@ -44075,8 +44339,8 @@ var ts; return false; } break; - case 219 /* SwitchStatement */: - if (node.kind === 216 /* BreakStatement */ && !node.label) { + case 220 /* SwitchStatement */: + if (node.kind === 217 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -44091,13 +44355,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 216 /* BreakStatement */ + var message = node.kind === 217 /* 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 === 216 /* BreakStatement */ + var message = node.kind === 217 /* 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); @@ -44109,7 +44373,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 173 /* ArrayBindingPattern */ || node.name.kind === 172 /* ObjectBindingPattern */) { + if (node.name.kind === 174 /* ArrayBindingPattern */ || node.name.kind === 173 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -44120,11 +44384,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ || - expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && + expr.kind === 191 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 213 /* ForInStatement */ && node.parent.parent.kind !== 214 /* ForOfStatement */) { + if (node.parent.parent.kind !== 214 /* ForInStatement */ && node.parent.parent.kind !== 215 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -44189,15 +44453,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 209 /* IfStatement */: - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - case 218 /* WithStatement */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 219 /* WithStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return false; - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -44259,7 +44523,7 @@ var ts; return true; } } - else if (node.parent.kind === 228 /* InterfaceDeclaration */) { + else if (node.parent.kind === 229 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -44267,7 +44531,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 161 /* TypeLiteral */) { + else if (node.parent.kind === 162 /* 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; } @@ -44292,13 +44556,13 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 228 /* InterfaceDeclaration */ || - node.kind === 229 /* TypeAliasDeclaration */ || - node.kind === 236 /* ImportDeclaration */ || - node.kind === 235 /* ImportEqualsDeclaration */ || - node.kind === 242 /* ExportDeclaration */ || - node.kind === 241 /* ExportAssignment */ || - node.kind === 234 /* NamespaceExportDeclaration */ || + if (node.kind === 229 /* InterfaceDeclaration */ || + node.kind === 230 /* TypeAliasDeclaration */ || + node.kind === 237 /* ImportDeclaration */ || + node.kind === 236 /* ImportEqualsDeclaration */ || + node.kind === 243 /* ExportDeclaration */ || + node.kind === 242 /* ExportAssignment */ || + node.kind === 235 /* NamespaceExportDeclaration */ || ts.getModifierFlags(node) & (2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) { return false; } @@ -44307,7 +44571,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 === 206 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 207 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -44333,7 +44597,7 @@ var ts; // to prevent noisiness. 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 === 205 /* Block */ || node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { + if (node.parent.kind === 206 /* Block */ || node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 263 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -44351,10 +44615,10 @@ var ts; if (languageVersion >= 1 /* ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 171 /* LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 172 /* LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 261 /* EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 262 /* EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -44374,11 +44638,11 @@ var ts; } function getAmbientModules() { var result = []; - for (var sym in globals) { + globals.forEach(function (global, sym) { if (ambientModuleSymbolRegex.test(sym)) { - result.push(globals[sym]); + result.push(global); } - } + }); return result; } } @@ -44406,54 +44670,56 @@ var ts; * supplant the existing `forEachChild` implementation if performance is not * significantly impacted. */ - var nodeEdgeTraversalMap = ts.createMap((_a = {}, - _a[141 /* QualifiedName */] = [ - { name: "left", test: ts.isEntityName }, - { name: "right", test: ts.isIdentifier } - ], - _a[145 /* Decorator */] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[182 /* TypeAssertionExpression */] = [ - { name: "type", test: ts.isTypeNode }, - { name: "expression", test: ts.isUnaryExpression } - ], - _a[200 /* AsExpression */] = [ - { name: "expression", test: ts.isExpression }, - { name: "type", test: ts.isTypeNode } - ], - _a[201 /* NonNullExpression */] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[230 /* EnumDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "members", test: ts.isEnumMember } - ], - _a[231 /* ModuleDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isModuleName }, - { name: "body", test: ts.isModuleBody } - ], - _a[232 /* ModuleBlock */] = [ - { name: "statements", test: ts.isStatement } - ], - _a[235 /* ImportEqualsDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "moduleReference", test: ts.isModuleReference } - ], - _a[246 /* ExternalModuleReference */] = [ - { name: "expression", test: ts.isExpression, optional: true } - ], - _a[261 /* EnumMember */] = [ - { name: "name", test: ts.isPropertyName }, - { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } - ], - _a)); + function getNodeEdgeTraversal(kind) { + switch (kind) { + case 142 /* QualifiedName */: return [ + { name: "left", test: ts.isEntityName }, + { name: "right", test: ts.isIdentifier } + ]; + case 146 /* Decorator */: return [ + { name: "expression", test: ts.isLeftHandSideExpression } + ]; + case 183 /* TypeAssertionExpression */: return [ + { name: "type", test: ts.isTypeNode }, + { name: "expression", test: ts.isUnaryExpression } + ]; + case 201 /* AsExpression */: return [ + { name: "expression", test: ts.isExpression }, + { name: "type", test: ts.isTypeNode } + ]; + case 202 /* NonNullExpression */: return [ + { name: "expression", test: ts.isLeftHandSideExpression } + ]; + case 231 /* EnumDeclaration */: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "members", test: ts.isEnumMember } + ]; + case 232 /* ModuleDeclaration */: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isModuleName }, + { name: "body", test: ts.isModuleBody } + ]; + case 233 /* ModuleBlock */: return [ + { name: "statements", test: ts.isStatement } + ]; + case 236 /* ImportEqualsDeclaration */: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "moduleReference", test: ts.isModuleReference } + ]; + case 247 /* ExternalModuleReference */: return [ + { name: "expression", test: ts.isExpression, optional: true } + ]; + case 262 /* EnumMember */: return [ + { name: "name", test: ts.isPropertyName }, + { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } + ]; + } + } function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } @@ -44477,47 +44743,47 @@ var ts; var cbNodes = cbNodeArray || cbNode; var kind = node.kind; // No need to visit nodes with no children. - if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) { + if ((kind > 0 /* FirstToken */ && kind <= 141 /* LastToken */)) { return initial; } // We do not yet support types. - if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) { + if ((kind >= 157 /* TypePredicate */ && kind <= 172 /* LiteralType */)) { return initial; } var result = initial; switch (node.kind) { // Leaf nodes - case 204 /* SemicolonClassElement */: - case 207 /* EmptyStatement */: - case 198 /* OmittedExpression */: - case 223 /* DebuggerStatement */: - case 294 /* NotEmittedStatement */: + case 205 /* SemicolonClassElement */: + case 208 /* EmptyStatement */: + case 199 /* OmittedExpression */: + case 224 /* DebuggerStatement */: + case 295 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: result = reduceNode(node.expression, cbNode, result); break; // Signature elements - case 144 /* Parameter */: + case 145 /* Parameter */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 145 /* Decorator */: + case 146 /* Decorator */: result = reduceNode(node.expression, cbNode, result); break; // Type member - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44526,12 +44792,12 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 150 /* Constructor */: + case 151 /* Constructor */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44539,7 +44805,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44547,45 +44813,45 @@ var ts; result = reduceNode(node.body, cbNode, result); break; // Binding patterns - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: result = reduceNodes(node.elements, cbNodes, result); break; - case 174 /* BindingElement */: + case 175 /* BindingElement */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Expression - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: result = reduceNodes(node.elements, cbNodes, result); break; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: result = reduceNodes(node.properties, cbNodes, result); break; - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.argumentExpression, cbNode, result); break; - case 179 /* CallExpression */: + case 180 /* CallExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 180 /* NewExpression */: + case 181 /* NewExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -44593,119 +44859,119 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 183 /* ParenthesizedExpression */: - case 186 /* DeleteExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 189 /* AwaitExpression */: - case 195 /* YieldExpression */: - case 196 /* SpreadElement */: - case 201 /* NonNullExpression */: + case 184 /* ParenthesizedExpression */: + case 187 /* DeleteExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 190 /* AwaitExpression */: + case 196 /* YieldExpression */: + case 197 /* SpreadElement */: + case 202 /* NonNullExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: result = reduceNode(node.operand, cbNode, result); break; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; // Misc - case 203 /* TemplateSpan */: + case 204 /* TemplateSpan */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; // Element - case 205 /* Block */: + case 206 /* Block */: result = reduceNodes(node.statements, cbNodes, result); break; - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 209 /* IfStatement */: + case 210 /* IfStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 210 /* DoStatement */: + case 211 /* DoStatement */: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 211 /* WhileStatement */: - case 218 /* WithStatement */: + case 212 /* WhileStatement */: + case 219 /* WithStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212 /* ForStatement */: + case 213 /* ForStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 217 /* ReturnStatement */: - case 221 /* ThrowStatement */: + case 218 /* ReturnStatement */: + case 222 /* ThrowStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 222 /* TryStatement */: + case 223 /* TryStatement */: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: result = reduceNodes(node.declarations, cbNodes, result); break; - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44714,7 +44980,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44722,101 +44988,101 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: result = reduceNodes(node.clauses, cbNodes, result); break; - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 237 /* ImportClause */: + case 238 /* ImportClause */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: result = reduceNode(node.name, cbNode, result); break; - case 239 /* NamedImports */: - case 243 /* NamedExports */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: result = reduceNodes(node.elements, cbNodes, result); break; - case 240 /* ImportSpecifier */: - case 244 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; // JSX - case 247 /* JsxElement */: + case 248 /* JsxElement */: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 248 /* JsxSelfClosingElement */: - case 249 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: result = reduceNode(node.tagName, cbNode, result); result = reduceNodes(node.attributes, cbNodes, result); break; - case 250 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: result = reduceNode(node.tagName, cbNode, result); break; - case 251 /* JsxAttribute */: + case 252 /* JsxAttribute */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 252 /* JsxSpreadAttribute */: + case 253 /* JsxSpreadAttribute */: result = reduceNode(node.expression, cbNode, result); break; - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: result = reduceNode(node.expression, cbNode, result); break; // Clauses - case 254 /* CaseClause */: + case 255 /* CaseClause */: result = reduceNode(node.expression, cbNode, result); // fall-through - case 255 /* DefaultClause */: + case 256 /* DefaultClause */: result = reduceNodes(node.statements, cbNodes, result); break; - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: result = reduceNodes(node.types, cbNodes, result); break; - case 257 /* CatchClause */: + case 258 /* CatchClause */: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; // Property assignments - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: result = reduceNode(node.expression, cbNode, result); break; // Top-level nodes - case 262 /* SourceFile */: + case 263 /* SourceFile */: result = reduceNodes(node.statements, cbNodes, result); break; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: result = reduceNode(node.expression, cbNode, result); break; default: - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + var edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) { var edge = edgeTraversalPath_1[_i]; @@ -44962,197 +45228,197 @@ var ts; } var kind = node.kind; // No need to visit nodes with no children. - if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) { + if ((kind > 0 /* FirstToken */ && kind <= 141 /* LastToken */)) { return node; } // We do not yet support types. - if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) { + if ((kind >= 157 /* TypePredicate */ && kind <= 172 /* LiteralType */)) { return node; } switch (node.kind) { - case 204 /* SemicolonClassElement */: - case 207 /* EmptyStatement */: - case 198 /* OmittedExpression */: - case 223 /* DebuggerStatement */: + case 205 /* SemicolonClassElement */: + case 208 /* EmptyStatement */: + case 199 /* OmittedExpression */: + case 224 /* DebuggerStatement */: // No need to visit nodes with no children. return node; // Names - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); // Signature elements - case 144 /* Parameter */: + case 145 /* Parameter */: return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); // Type member - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 150 /* Constructor */: + case 151 /* Constructor */: return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); // Binding patterns - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); // Expression - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); // Misc - case 203 /* TemplateSpan */: + case 204 /* TemplateSpan */: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); // Element - case 205 /* Block */: + case 206 /* Block */: return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 209 /* IfStatement */: + case 210 /* IfStatement */: return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, /*optional*/ true, liftToBlock)); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 215 /* ContinueStatement */: + case 216 /* ContinueStatement */: return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 216 /* BreakStatement */: + case 217 /* BreakStatement */: return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true)); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, /*optional*/ true), visitNode(node.finallyBlock, visitor, ts.isBlock, /*optional*/ true)); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 237 /* ImportClause */: + case 238 /* ImportClause */: return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, /*optional*/ true)); - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 239 /* NamedImports */: + case 240 /* NamedImports */: return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); - case 240 /* ImportSpecifier */: + case 241 /* ImportSpecifier */: return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, /*optional*/ true)); - case 243 /* NamedExports */: + case 244 /* NamedExports */: return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); - case 244 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); // JSX - case 247 /* JsxElement */: + case 248 /* JsxElement */: return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 249 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 250 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 251 /* JsxAttribute */: + case 252 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 252 /* JsxSpreadAttribute */: + case 253 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 254 /* CaseClause */: + case 255 /* CaseClause */: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); - case 255 /* DefaultClause */: + case 256 /* DefaultClause */: return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Top-level nodes - case 262 /* SourceFile */: + case 263 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + var edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) { var edge = edgeTraversalPath_2[_i]; @@ -45264,7 +45530,7 @@ var ts; function aggregateTransformFlagsForSubtree(node) { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 199 /* ExpressionWithTypeArguments */)) { + if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 200 /* ExpressionWithTypeArguments */)) { return 0 /* None */; } // Aggregate the transform flags of each child. @@ -45317,7 +45583,6 @@ var ts; } } })(Debug = ts.Debug || (ts.Debug = {})); - var _a; })(ts || (ts = {})); /// /// @@ -45456,11 +45721,11 @@ var ts; } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { - var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_30 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; - var variable = ts.createVariableDeclaration(name_30, - /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name, + /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location); variable.original = original; - if (ts.isIdentifier(name_30)) { + if (ts.isIdentifier(name)) { ts.setEmitFlags(variable, 64 /* NoNestedSourceMaps */); } ts.aggregateTransformFlags(variable); @@ -45664,8 +45929,8 @@ var ts; return ts.createElementAccess(value, argumentExpression); } else { - var name_31 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); - return ts.createPropertyAccess(value, name_31); + var name = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name); } } /** @@ -45775,8 +46040,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(178 /* ElementAccessExpression */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(179 /* ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -45840,15 +46105,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 262 /* SourceFile */: - case 233 /* CaseBlock */: - case 232 /* ModuleBlock */: - case 205 /* Block */: + case 263 /* SourceFile */: + case 234 /* CaseBlock */: + case 233 /* ModuleBlock */: + case 206 /* Block */: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 227 /* ClassDeclaration */: - case 226 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 227 /* FunctionDeclaration */: if (ts.hasModifier(node, 2 /* Ambient */)) { break; } @@ -45895,13 +46160,13 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitImportDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitExportAssignment(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -45921,11 +46186,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 242 /* ExportDeclaration */ || - node.kind === 236 /* ImportDeclaration */ || - node.kind === 237 /* ImportClause */ || - (node.kind === 235 /* ImportEqualsDeclaration */ && - node.moduleReference.kind === 246 /* ExternalModuleReference */)) { + if (node.kind === 243 /* ExportDeclaration */ || + node.kind === 237 /* ImportDeclaration */ || + node.kind === 238 /* ImportClause */ || + (node.kind === 236 /* ImportEqualsDeclaration */ && + node.moduleReference.kind === 247 /* ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -45955,19 +46220,19 @@ var ts; */ function classElementVisitorWorker(node) { switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: // TypeScript constructors are transformed in `visitClassDeclaration`. // We elide them here as `visitorWorker` checks transform flags, which could // erronously include an ES6 constructor without TypeScript syntax. return undefined; - case 147 /* PropertyDeclaration */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: + case 148 /* PropertyDeclaration */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: // Fallback to the default visit behavior. return visitorWorker(node); - case 204 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -46007,47 +46272,47 @@ var ts; case 123 /* DeclareKeyword */: case 130 /* ReadonlyKeyword */: // TypeScript accessibility and readonly modifiers are elided. - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 161 /* TypeLiteral */: - case 156 /* TypePredicate */: - case 143 /* TypeParameter */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 162 /* TypeLiteral */: + case 157 /* TypePredicate */: + case 144 /* TypeParameter */: case 118 /* AnyKeyword */: case 121 /* BooleanKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: case 104 /* VoidKeyword */: - case 135 /* SymbolKeyword */: - case 159 /* ConstructorType */: - case 158 /* FunctionType */: - case 160 /* TypeQuery */: - case 157 /* TypeReference */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: - case 167 /* ThisType */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 171 /* LiteralType */: + case 136 /* SymbolKeyword */: + case 160 /* ConstructorType */: + case 159 /* FunctionType */: + case 161 /* TypeQuery */: + case 158 /* TypeReference */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* ParenthesizedType */: + case 168 /* ThisType */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 172 /* LiteralType */: // TypeScript type nodes are elided. - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: // TypeScript index signatures are elided. - case 145 /* Decorator */: + case 146 /* Decorator */: // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration. - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // TypeScript property declarations are elided. return undefined; - case 150 /* Constructor */: + case 151 /* Constructor */: return visitConstructor(node); - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return ts.createNotEmittedStatement(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: // This is a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -46058,7 +46323,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: // This is a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -46069,35 +46334,35 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 144 /* Parameter */: + case 145 /* Parameter */: // This is a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -46107,33 +46372,33 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); default: @@ -46541,7 +46806,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -46614,7 +46879,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member, isStatic) { - return member.kind === 147 /* PropertyDeclaration */ + return member.kind === 148 /* PropertyDeclaration */ && isStatic === ts.hasModifier(member, 32 /* Static */) && member.initializer !== undefined; } @@ -46749,12 +47014,12 @@ var ts; */ function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return getAllDecoratorsOfAccessors(node, member); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -46907,7 +47172,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true); var descriptor = languageVersion > 0 /* ES3 */ - ? member.kind === 147 /* PropertyDeclaration */ + ? member.kind === 148 /* PropertyDeclaration */ ? ts.createVoidZero() : ts.createNull() : undefined; @@ -47026,10 +47291,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 147 /* PropertyDeclaration */; + return kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 148 /* PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -47039,7 +47304,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 149 /* MethodDeclaration */; + return node.kind === 150 /* MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -47050,12 +47315,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return true; } return false; @@ -47067,15 +47332,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 147 /* PropertyDeclaration */: - case 144 /* Parameter */: - case 151 /* GetAccessor */: + case 148 /* PropertyDeclaration */: + case 145 /* Parameter */: + case 152 /* GetAccessor */: return serializeTypeNode(node.type); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 149 /* MethodDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 150 /* MethodDeclaration */: return ts.createIdentifier("Function"); default: return ts.createVoidZero(); @@ -47112,7 +47377,7 @@ var ts; return ts.createArrayLiteral(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 151 /* GetAccessor */) { + if (container && node.kind === 152 /* GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -47158,24 +47423,24 @@ var ts; } switch (node.kind) { case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 129 /* NeverKeyword */: return ts.createVoidZero(); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return serializeTypeNode(node.type); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return ts.createIdentifier("Function"); - case 162 /* ArrayType */: - case 163 /* TupleType */: + case 163 /* ArrayType */: + case 164 /* TupleType */: return ts.createIdentifier("Array"); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: case 121 /* BooleanKeyword */: return ts.createIdentifier("Boolean"); - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: return ts.createIdentifier("String"); - case 171 /* LiteralType */: + case 172 /* LiteralType */: switch (node.literal.kind) { case 9 /* StringLiteral */: return ts.createIdentifier("String"); @@ -47191,22 +47456,22 @@ var ts; break; case 132 /* NumberKeyword */: return ts.createIdentifier("Number"); - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: return languageVersion < 2 /* ES2015 */ ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return serializeTypeReferenceNode(node); - case 165 /* IntersectionType */: - case 164 /* UnionType */: + case 166 /* IntersectionType */: + case 165 /* UnionType */: return serializeUnionOrIntersectionType(node); - case 160 /* TypeQuery */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 161 /* TypeLiteral */: + case 161 /* TypeQuery */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 162 /* TypeLiteral */: case 118 /* AnyKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: break; default: ts.Debug.failBadSyntaxKind(node); @@ -47294,15 +47559,15 @@ var ts; case 70 /* Identifier */: // Create a clone of the name with a new parent, and treat it as if it were // a source tree node for the purposes of the checker. - var name_32 = ts.getMutableClone(node); - name_32.flags &= ~8 /* Synthesized */; - name_32.original = undefined; - name_32.parent = currentScope; + var name = ts.getMutableClone(node); + name.flags &= ~8 /* Synthesized */; + name.original = undefined; + name.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_32), ts.createLiteral("undefined")), name_32); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name); } - return name_32; - case 141 /* QualifiedName */: + return name; + case 142 /* QualifiedName */: return serializeQualifiedNameAsExpression(node, useFallback); } } @@ -47816,8 +48081,8 @@ var ts; if (!currentScopeFirstDeclarationsOfName) { currentScopeFirstDeclarationsOfName = ts.createMap(); } - if (!(name in currentScopeFirstDeclarationsOfName)) { - currentScopeFirstDeclarationsOfName[name] = node; + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } } @@ -47827,9 +48092,9 @@ var ts; */ function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_33 = node.symbol && node.symbol.name; - if (name_33) { - return currentScopeFirstDeclarationsOfName[name_33] === node; + var name = node.symbol && node.symbol.name; + if (name) { + return currentScopeFirstDeclarationsOfName.get(name) === node; } } return false; @@ -47846,7 +48111,7 @@ var ts; recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 230 /* EnumDeclaration */) { + if (node.kind === 231 /* EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -47965,7 +48230,7 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 232 /* ModuleBlock */) { + if (body.kind === 233 /* ModuleBlock */) { saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; @@ -48011,13 +48276,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (body.kind !== 232 /* ModuleBlock */) { + if (body.kind !== 233 /* ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 231 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 232 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -48058,7 +48323,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 238 /* NamespaceImport */) { + if (node.kind === 239 /* NamespaceImport */) { // Elide a namespace import if it is not referenced. return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } @@ -48281,7 +48546,7 @@ var ts; // substitute class names inside of a class declaration. context.enableSubstitution(70 /* Identifier */); // Keep track of class aliases. - classAliases = ts.createMap(); + classAliases = []; } } function enableSubstitutionForNamespaceExports() { @@ -48290,16 +48555,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(70 /* Identifier */); - context.enableSubstitution(259 /* ShorthandPropertyAssignment */); + context.enableSubstitution(260 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(231 /* ModuleDeclaration */); + context.enableEmitNotification(232 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 231 /* ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 232 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 230 /* EnumDeclaration */; + return ts.getOriginalNode(node).kind === 231 /* EnumDeclaration */; } /** * Hook for node emit. @@ -48337,16 +48602,16 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2 /* NamespaceExports */) { - var name_34 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_34); + var name = node.name; + var exportedName = trySubstituteNamespaceExportedName(name); if (exportedName) { // A shorthand property with an assignment initializer is probably part of a // destructuring assignment if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_34, initializer, /*location*/ node); + return ts.createPropertyAssignment(name, initializer, /*location*/ node); } - return ts.createPropertyAssignment(name_34, exportedName, /*location*/ node); + return ts.createPropertyAssignment(name, exportedName, /*location*/ node); } } return node; @@ -48355,9 +48620,9 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -48395,9 +48660,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 262 /* SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 231 /* ModuleDeclaration */) || - (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 230 /* EnumDeclaration */); + if (container && container.kind !== 263 /* SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 232 /* ModuleDeclaration */) || + (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 231 /* EnumDeclaration */); if (substitute) { return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, /*location*/ node); } @@ -48513,37 +48778,37 @@ var ts; return node; } switch (node.kind) { - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node, noDestructuringValue); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return visitForOfStatement(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return visitVoidExpression(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return visitConstructorDeclaration(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: return visitGetAccessorDeclaration(node); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return visitArrowFunction(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return visitParameter(node); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return visitExpressionStatement(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); default: return ts.visitEachChild(node, visitor, context); @@ -48554,7 +48819,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 260 /* SpreadAssignment */) { + if (e.kind === 261 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -48566,7 +48831,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 258 /* PropertyAssignment */) { + if (e.kind === 259 /* PropertyAssignment */) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -48588,7 +48853,7 @@ var ts; // If the first element is a spread element, then the first argument to __assign is {}: // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 177 /* ObjectLiteralExpression */) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -48755,6 +49020,10 @@ var ts; text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" }; function createAssignHelper(context, attributesSegments) { + if (context.getCompilerOptions().target >= 2 /* ES2015 */) { + return ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), + /*typeArguments*/ undefined, attributesSegments); + } context.requestEmitHelper(assignHelper); return ts.createCall(ts.getHelperName("__assign"), /*typeArguments*/ undefined, attributesSegments); @@ -48796,11 +49065,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 247 /* JsxElement */: + case 248 /* JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -48810,11 +49079,11 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return visitJsxExpression(node); - case 247 /* JsxElement */: + case 248 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); default: ts.Debug.failBadSyntaxKind(node); @@ -48875,7 +49144,7 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.createLiteral(decoded, /*location*/ node) : node; } - else if (node.kind === 253 /* JsxExpression */) { + else if (node.kind === 254 /* JsxExpression */) { if (node.expression === undefined) { return ts.createLiteral(true); } @@ -48886,54 +49155,61 @@ var ts; } } function visitJsxText(node) { - var text = ts.getTextOfNode(node, /*includeTrivia*/ true); - var parts; + var fixed = fixupWhitespaceAndDecodeEntities(ts.getTextOfNode(node, /*includeTrivia*/ true)); + return fixed === undefined ? undefined : ts.createLiteral(fixed); + } + /** + * JSX trims whitespace at the end and beginning of lines, except that the + * start/end of a tag is considered a start/end of a line only if that line is + * on the same line as the closing tag. See examples in + * tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + * See also https://www.w3.org/TR/html4/struct/text.html#h-9.1 and https://www.w3.org/TR/CSS2/text.html#white-space-model + * + * An equivalent algorithm would be: + * - If there is only one line, return it. + * - If there is only whitespace (but multiple lines), return `undefined`. + * - Split the text into lines. + * - 'trimRight' the first line, 'trimLeft' the last line, 'trim' middle lines. + * - Decode entities on each line (individually). + * - Remove empty lines and join the rest with " ". + */ + function fixupWhitespaceAndDecodeEntities(text) { + var acc; + // First non-whitespace character on this line. var firstNonWhitespace = 0; + // Last non-whitespace character on this line. var lastNonWhitespace = -1; - // JSX trims whitespace at the end and beginning of lines, except that the - // start/end of a tag is considered a start/end of a line only if that line is - // on the same line as the closing tag. See examples in - // tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + // These initial values are special because the first line is: + // firstNonWhitespace = 0 to indicate that we want leading whitsepace, + // but lastNonWhitespace = -1 as a special flag to indicate that we *don't* include the line if it's all whitespace. for (var i = 0; i < text.length; i++) { var c = text.charCodeAt(i); if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - if (!parts) { - parts = []; - } - // We do not escape the string here as that is handled by the printer - // when it emits the literal. We do, however, need to decode JSX entities. - parts.push(ts.createLiteral(decodeEntities(part))); + // If we've seen any non-whitespace characters on this line, add the 'trim' of the line. + // (lastNonWhitespace === -1 is a special flag to detect whether the first line is all whitespace.) + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); } + // Reset firstNonWhitespace for the next line. + // Don't bother to reset lastNonWhitespace because we ignore it if firstNonWhitespace = -1. firstNonWhitespace = -1; } - else if (!ts.isWhiteSpace(c)) { + else if (!ts.isWhiteSpaceSingleLine(c)) { lastNonWhitespace = i; if (firstNonWhitespace === -1) { firstNonWhitespace = i; } } } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - if (!parts) { - parts = []; - } - // We do not escape the string here as that is handled by the printer - // when it emits the literal. We do, however, need to decode JSX entities. - parts.push(ts.createLiteral(decodeEntities(part))); - } - if (parts) { - return ts.reduceLeft(parts, aggregateJsxTextParts); - } - return undefined; + return firstNonWhitespace !== -1 + ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) + : acc; } - /** - * Aggregates two expressions by interpolating them with a whitespace literal. - */ - function aggregateJsxTextParts(left, right) { - return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right); + function addLineOfJsxText(acc, trimmedLine) { + // We do not escape the string here as that is handled by the printer + // when it emits the literal. We do, however, need to decode JSX entities. + var decoded = decodeEntities(trimmedLine); + return acc === undefined ? decoded : acc + " " + decoded; } /** * Replace entities like " ", "{", and "�" with the characters they encode. @@ -48948,7 +49224,7 @@ var ts; return String.fromCharCode(parseInt(hex, 16)); } else { - var ch = entities[word]; + var ch = entities.get(word); // If this is not a valid entity, then just use `match` (replace it with itself, i.e. don't replace) return ch ? String.fromCharCode(ch) : match; } @@ -48960,16 +49236,16 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 247 /* JsxElement */) { + if (node.kind === 248 /* JsxElement */) { return getTagName(node.openingElement); } else { - var name_35 = node.tagName; - if (ts.isIdentifier(name_35) && ts.isIntrinsicJsxName(name_35.text)) { - return ts.createLiteral(name_35.text); + var name = node.tagName; + if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.text)) { + return ts.createLiteral(name.text); } else { - return ts.createExpressionFromEntityName(name_35); + return ts.createExpressionFromEntityName(name); } } } @@ -48992,7 +49268,7 @@ var ts; } } ts.transformJsx = transformJsx; - var entities = ts.createMap({ + var entities = ts.createMapFromTemplate({ "quot": 0x0022, "amp": 0x0026, "apos": 0x0027, @@ -49300,19 +49576,19 @@ var ts; case 119 /* AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: // ES2017 'await' expressions must be transformed for targets < ES2017. return visitAwaitExpression(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: // ES2017 method declarations may be 'async' return visitMethodDeclaration(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: // ES2017 function declarations may be 'async' return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: // ES2017 function expressions may be 'async' return visitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: // ES2017 arrow functions may be 'async' return visitArrowFunction(node); default: @@ -49402,7 +49678,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 185 /* ArrowFunction */; + var isArrowFunction = node.kind === 186 /* ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -49466,24 +49742,24 @@ var ts; enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(179 /* CallExpression */); - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(178 /* ElementAccessExpression */); + context.enableSubstitution(180 /* CallExpression */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(179 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(227 /* ClassDeclaration */); - context.enableEmitNotification(149 /* MethodDeclaration */); - context.enableEmitNotification(151 /* GetAccessor */); - context.enableEmitNotification(152 /* SetAccessor */); - context.enableEmitNotification(150 /* Constructor */); + context.enableEmitNotification(228 /* ClassDeclaration */); + context.enableEmitNotification(150 /* MethodDeclaration */); + context.enableEmitNotification(152 /* GetAccessor */); + context.enableEmitNotification(153 /* SetAccessor */); + context.enableEmitNotification(151 /* Constructor */); } } function substituteExpression(node) { switch (node.kind) { - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) { return substituteCallExpression(node); } @@ -49527,11 +49803,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 227 /* ClassDeclaration */ - || kind === 150 /* Constructor */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */; + return kind === 228 /* ClassDeclaration */ + || kind === 151 /* Constructor */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */; } /** * Hook for node emit. @@ -49636,7 +49912,7 @@ var ts; return node; } switch (node.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -49869,7 +50145,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ - && node.kind === 217 /* ReturnStatement */ + && node.kind === 218 /* ReturnStatement */ && !node.expression; } function shouldVisitNode(node) { @@ -49902,91 +50178,91 @@ var ts; switch (node.kind) { case 114 /* StaticKeyword */: return undefined; // elide static keyword - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return visitClassDeclaration(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return visitClassExpression(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return visitParameter(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return visitArrowFunction(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); case 70 /* Identifier */: return visitIdentifier(node); - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitSwitchStatement(node); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return visitCaseBlock(node); - case 205 /* Block */: + case 206 /* Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 216 /* BreakStatement */: - case 215 /* ContinueStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: return visitBreakOrContinueStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitLabeledStatement(node); - case 210 /* DoStatement */: - case 211 /* WhileStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return visitExpressionStatement(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return visitCatchClause(node); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node, /*needsDestructuringValue*/ true); case 12 /* NoSubstitutionTemplateLiteral */: case 13 /* TemplateHead */: case 14 /* TemplateMiddle */: case 15 /* TemplateTail */: return visitTemplateLiteral(node); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return visitTemplateExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitYieldExpression(node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return visitSpreadElement(node); case 96 /* SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 98 /* ThisKeyword */: return visitThisKeyword(node); - case 202 /* MetaProperty */: + case 203 /* MetaProperty */: return visitMetaProperty(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return visitAccessorDeclaration(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return visitVariableStatement(node); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context); @@ -50058,7 +50334,7 @@ var ts; if (ts.isGeneratedIdentifier(node)) { return node; } - if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) { + if (node.text !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { return node; } return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); @@ -50069,13 +50345,13 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 216 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + var jump = node.kind === 217 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 216 /* BreakStatement */) { + if (node.kind === 217 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } @@ -50086,7 +50362,7 @@ var ts; } } else { - if (node.kind === 216 /* BreakStatement */) { + if (node.kind === 217 /* BreakStatement */) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); } @@ -50382,17 +50658,17 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 217 /* ReturnStatement */) { + if (statement.kind === 218 /* ReturnStatement */) { return true; } - else if (statement.kind === 209 /* IfStatement */) { + else if (statement.kind === 210 /* IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 205 /* Block */) { + else if (statement.kind === 206 /* Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -50450,7 +50726,7 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { + if (firstStatement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } @@ -50460,8 +50736,8 @@ var ts; && statementOffset === ctorStatements.length - 1 && !(ctor.transformFlags & (16384 /* ContainsLexicalThis */ | 32768 /* ContainsCapturedLexicalThis */))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 192 /* BinaryExpression */ - || superCallExpression.left.kind !== 179 /* CallExpression */) { + if (superCallExpression.kind !== 193 /* BinaryExpression */ + || superCallExpression.left.kind !== 180 /* CallExpression */) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } // Shift comments from the original super call to the return statement. @@ -50544,17 +50820,17 @@ var ts; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - var name_36 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; // A rest parameter cannot have a binding pattern or an initializer, // so let's just ignore it. if (dotDotDotToken) { continue; } - if (ts.isBindingPattern(name_36)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_36, initializer); + if (ts.isBindingPattern(name)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer); } else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_36, initializer); + addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer); } } } @@ -50661,7 +50937,7 @@ var ts; * @param node A node. */ function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) { + if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 186 /* ArrowFunction */) { captureThisForNode(statements, node, ts.createThis()); } } @@ -50680,22 +50956,22 @@ var ts; if (hierarchyFacts & 16384 /* NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return statements; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = ts.createVoidZero(); break; - case 150 /* Constructor */: + case 151 /* Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"); break; - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 92 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero()); @@ -50727,20 +51003,20 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 204 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 150 /* Constructor */: + case 151 /* Constructor */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -50931,7 +51207,7 @@ var ts; : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */)) { + if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 227 /* FunctionDeclaration */ || node.kind === 185 /* FunctionExpression */)) { name = ts.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); @@ -50977,7 +51253,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 185 /* ArrowFunction */); + ts.Debug.assert(node.kind === 186 /* ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -51042,9 +51318,9 @@ var ts; function visitExpressionStatement(node) { // If we are here it is most likely because our expression is a destructuring assignment. switch (node.expression.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } return ts.visitEachChild(node, visitor, context); @@ -51060,9 +51336,9 @@ var ts; // If we are here it is most likely because our expression is a destructuring assignment. if (!needsDestructuringValue) { switch (node.expression.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } } @@ -51245,10 +51521,10 @@ var ts; return updated; } function recordLabel(node) { - convertedLoopState.labels[node.label.text] = node.label.text; + convertedLoopState.labels.set(node.label.text, node.label.text); } function resetLabel(node) { - convertedLoopState.labels[node.label.text] = undefined; + convertedLoopState.labels.set(node.label.text, undefined); } function visitLabeledStatement(node) { if (convertedLoopState && !convertedLoopState.labels) { @@ -51364,7 +51640,7 @@ var ts; ts.addRange(statements, convertedLoopBodyStatements); } else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); bodyLocation = statement; @@ -51393,14 +51669,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 210 /* DoStatement */: - case 211 /* WhileStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -51423,7 +51699,7 @@ var ts; && i < numInitialPropertiesWithoutYield) { numInitialPropertiesWithoutYield = i; } - if (property.name.kind === 142 /* ComputedPropertyName */) { + if (property.name.kind === 143 /* ComputedPropertyName */) { numInitialProperties = i; break; } @@ -51496,11 +51772,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 225 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 226 /* VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -51718,26 +51994,25 @@ var ts; if (!state.labeledNonLocalBreaks) { state.labeledNonLocalBreaks = ts.createMap(); } - state.labeledNonLocalBreaks[labelText] = labelMarker; + state.labeledNonLocalBreaks.set(labelText, labelMarker); } else { if (!state.labeledNonLocalContinues) { state.labeledNonLocalContinues = ts.createMap(); } - state.labeledNonLocalContinues[labelText] = labelMarker; + state.labeledNonLocalContinues.set(labelText, labelMarker); } } function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { if (!table) { return; } - for (var labelText in table) { - var labelMarker = table[labelText]; + table.forEach(function (labelMarker, labelText) { var statements = []; // if there are no outer converted loop or outer label in question is located inside outer converted loop // then emit labeled break\continue // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) { var label = ts.createIdentifier(labelText); statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)); } @@ -51746,7 +52021,7 @@ var ts; statements.push(ts.createReturn(loopResultName)); } caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)); - } + }); } function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { var name = decl.name; @@ -51781,20 +52056,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -52040,7 +52315,7 @@ var ts; })); if (segments.length === 1) { var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 /* ArrayLiteralExpression */ + return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 176 /* ArrayLiteralExpression */ ? ts.createArraySlice(segments[0]) : segments[0]; } @@ -52273,13 +52548,13 @@ var ts; if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) { enabledSubstitutions |= 1 /* CapturedThis */; context.enableSubstitution(98 /* ThisKeyword */); - context.enableEmitNotification(150 /* Constructor */); - context.enableEmitNotification(149 /* MethodDeclaration */); - context.enableEmitNotification(151 /* GetAccessor */); - context.enableEmitNotification(152 /* SetAccessor */); - context.enableEmitNotification(185 /* ArrowFunction */); - context.enableEmitNotification(184 /* FunctionExpression */); - context.enableEmitNotification(226 /* FunctionDeclaration */); + context.enableEmitNotification(151 /* Constructor */); + context.enableEmitNotification(150 /* MethodDeclaration */); + context.enableEmitNotification(152 /* GetAccessor */); + context.enableEmitNotification(153 /* SetAccessor */); + context.enableEmitNotification(186 /* ArrowFunction */); + context.enableEmitNotification(185 /* FunctionExpression */); + context.enableEmitNotification(227 /* FunctionDeclaration */); } } /** @@ -52321,10 +52596,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 174 /* BindingElement */: - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: - case 224 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 225 /* VariableDeclaration */: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -52382,11 +52657,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 208 /* ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 209 /* ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179 /* CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 180 /* CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -52394,7 +52669,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196 /* SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 197 /* SpreadElement */) { return false; } var expression = callArgument.expression; @@ -52589,13 +52864,15 @@ var ts; Instruction[Instruction["Catch"] = 6] = "Catch"; Instruction[Instruction["Endfinally"] = 7] = "Endfinally"; })(Instruction || (Instruction = {})); - var instructionNames = ts.createMap((_a = {}, - _a[2 /* Return */] = "return", - _a[3 /* Break */] = "break", - _a[4 /* Yield */] = "yield", - _a[5 /* YieldStar */] = "yield*", - _a[7 /* Endfinally */] = "endfinally", - _a)); + function getInstructionName(instruction) { + switch (instruction) { + case 2 /* Return */: return "return"; + case 3 /* Break */: return "break"; + case 4 /* Yield */: return "yield"; + case 5 /* YieldStar */: return "yield*"; + case 7 /* Endfinally */: return "endfinally"; + } + } function transformGenerators(context) { var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); @@ -52687,13 +52964,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 210 /* DoStatement */: + case 211 /* DoStatement */: return visitDoStatement(node); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return visitWhileStatement(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitSwitchStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -52706,24 +52983,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return visitAccessorDeclaration(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return visitVariableStatement(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return visitForInStatement(node); - case 216 /* BreakStatement */: + case 217 /* BreakStatement */: return visitBreakStatement(node); - case 215 /* ContinueStatement */: + case 216 /* ContinueStatement */: return visitContinueStatement(node); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 16777216 /* ContainsYield */) { @@ -52744,21 +53021,21 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return visitConditionalExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitYieldExpression(node); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -52771,9 +53048,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); default: ts.Debug.failBadSyntaxKind(node); @@ -53001,7 +53278,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: // [source] // a.b = yield; // @@ -53013,7 +53290,7 @@ var ts; // _a.b = %sent%; target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: // [source] // a[b] = yield; // @@ -53388,35 +53665,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 205 /* Block */: + case 206 /* Block */: return transformAndEmitBlock(node); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 209 /* IfStatement */: + case 210 /* IfStatement */: return transformAndEmitIfStatement(node); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return transformAndEmitDoStatement(node); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return transformAndEmitForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 215 /* ContinueStatement */: + case 216 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 216 /* BreakStatement */: + case 217 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return transformAndEmitWithStatement(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement, /*optional*/ true)); @@ -53436,9 +53713,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - var name_37 = ts.getSynthesizedClone(variable.name); - ts.setCommentRange(name_37, variable.name); - hoistVariableDeclaration(name_37); + var name = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -53838,7 +54115,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 255 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 256 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -53851,7 +54128,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 254 /* CaseClause */) { + if (clause.kind === 255 /* CaseClause */) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -54007,14 +54284,14 @@ var ts; return node; } function substituteExpressionIdentifier(node) { - if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) { + if (renamedCatchVariables && renamedCatchVariables.has(node.text)) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_38 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_38) { - var clone_7 = ts.getMutableClone(name_38); + var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)]; + if (name) { + var clone_7 = ts.getMutableClone(name); ts.setSourceMapRange(clone_7, node); ts.setCommentRange(clone_7, node); return clone_7; @@ -54158,10 +54435,10 @@ var ts; var name = declareLocal(text); if (!renamedCatchVariables) { renamedCatchVariables = ts.createMap(); - renamedCatchVariableDeclarations = ts.createMap(); + renamedCatchVariableDeclarations = []; context.enableSubstitution(70 /* Identifier */); } - renamedCatchVariables[text] = true; + renamedCatchVariables.set(text, true); renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; var exception = peekBlock(); ts.Debug.assert(exception.state < 1 /* Catch */); @@ -54432,7 +54709,7 @@ var ts; */ function createInstruction(instruction) { var literal = ts.createLiteral(instruction); - literal.trailingComment = instructionNames[instruction]; + literal.trailingComment = getInstructionName(instruction); return literal; } /** @@ -55051,7 +55328,6 @@ var ts; priority: 6, text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; - var _a; })(ts || (ts = {})); /// /// @@ -55065,21 +55341,21 @@ var ts; */ function transformES5(context) { var compilerOptions = context.getCompilerOptions(); - // enable emit notification only if using --jsx preserve + // enable emit notification only if using --jsx preserve or react-native var previousOnEmitNode; var noSubstitution; - if (compilerOptions.jsx === 1 /* Preserve */) { + if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(249 /* JsxOpeningElement */); - context.enableEmitNotification(250 /* JsxClosingElement */); - context.enableEmitNotification(248 /* JsxSelfClosingElement */); + context.enableEmitNotification(250 /* JsxOpeningElement */); + context.enableEmitNotification(251 /* JsxClosingElement */); + context.enableEmitNotification(249 /* JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(258 /* PropertyAssignment */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(259 /* PropertyAssignment */); return transformSourceFile; /** * Transforms an ES5 source file to ES3. @@ -55096,9 +55372,9 @@ var ts; */ function onEmitNode(emitContext, node, emitCallback) { switch (node.kind) { - case 249 /* JsxOpeningElement */: - case 250 /* JsxClosingElement */: - case 248 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: + case 251 /* JsxClosingElement */: + case 249 /* JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -55174,7 +55450,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(262 /* SourceFile */); + context.enableEmitNotification(263 /* SourceFile */); context.enableSubstitution(70 /* Identifier */); var currentSourceFile; return transformSourceFile; @@ -55201,10 +55477,10 @@ var ts; } function visitor(node) { switch (node.kind) { - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // Elide `import=` as it is not legal with --module ES6 return undefined; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitExportAssignment(node); } return node; @@ -55276,14 +55552,14 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(262 /* SourceFile */); // Restore state when substituting nodes in a file. - var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. - var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. - var exportFunctionsMap = ts.createMap(); // The export function associated with a source file. - var noSubstitutionMap = ts.createMap(); // Set of nodes for which substitution rules should be ignored for each file. + context.enableSubstitution(193 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(191 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(192 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableEmitNotification(263 /* SourceFile */); // Restore state when substituting nodes in a file. + var moduleInfoMap = []; // The ExternalModuleInfo for each file. + var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. + var exportFunctionsMap = []; // The export function associated with a source file. + var noSubstitutionMap = []; // Set of nodes for which substitution rules should be ignored for each file. var currentSourceFile; // The current file. var moduleInfo; // ExternalModuleInfo for the current file. var exportFunction; // The export function for the current file. @@ -55322,7 +55598,8 @@ var ts; moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); // Make sure that the name of the 'exports' function does not conflict with // existing identifiers. - exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); + exportFunction = ts.createUniqueName("exports"); + exportFunctionsMap[id] = exportFunction; contextObject = ts.createUniqueName("context"); // Add the body of the module. var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); @@ -55374,13 +55651,13 @@ var ts; var externalImport = externalImports[i]; var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); var text = externalModuleName.text; - if (ts.hasProperty(groupIndices, text)) { + var groupIndex = groupIndices.get(text); + if (groupIndex !== undefined) { // deduplicate/group entries in dependency list by the dependency name - var groupIndex = groupIndices[text]; dependencyGroups[groupIndex].externalImports.push(externalImport); } else { - groupIndices[text] = dependencyGroups.length; + groupIndices.set(text, dependencyGroups.length); dependencyGroups.push({ name: externalModuleName, externalImports: [externalImport] @@ -55493,13 +55770,13 @@ var ts; // to support this we store names of local/indirect exported entries in a set. // this set is used to filter names brought by star expors. // local names set should only be added if we have anything exported - if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) { + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { // no exported declarations (export var ...) or export specifiers (export {x}) // check if we have any non star export declarations. var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 242 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 243 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -55524,7 +55801,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 242 /* ExportDeclaration */) { + if (externalImport.kind !== 243 /* ExportDeclaration */) { continue; } var exportDecl = externalImport; @@ -55605,19 +55882,19 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // fall-through - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -55667,15 +55944,15 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitImportDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: // ExportDeclarations are elided as they are handled via // `appendExportsOfDeclaration`. return undefined; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -55853,7 +56130,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 262 /* SourceFile */ + && (enclosingBlockScopedContainer.kind === 263 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } /** @@ -55917,7 +56194,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -55973,10 +56250,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 239 /* NamedImports */: + case 240 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -56094,7 +56371,7 @@ var ts; return statements; } var name = ts.getDeclarationName(decl); - var exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; @@ -56155,43 +56432,43 @@ var ts; */ function nestedElementVisitor(node) { switch (node.kind) { - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return visitVariableStatement(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return visitClassDeclaration(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return visitForInStatement(node); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return visitForOfStatement(node); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return visitDoStatement(node); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return visitWhileStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitLabeledStatement(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return visitWithStatement(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitSwitchStatement(node); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return visitCaseBlock(node); - case 254 /* CaseClause */: + case 255 /* CaseClause */: return visitCaseClause(node); - case 255 /* DefaultClause */: + case 256 /* DefaultClause */: return visitDefaultClause(node); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return visitTryStatement(node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return visitCatchClause(node); - case 205 /* Block */: + case 206 /* Block */: return visitBlock(node); - case 296 /* MergeDeclarationMarker */: + case 297 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 297 /* EndOfDeclarationMarker */: + case 298 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -56371,7 +56648,7 @@ var ts; */ function destructuringVisitor(node) { if (node.transformFlags & 1024 /* DestructuringAssignment */ - && node.kind === 192 /* BinaryExpression */) { + && node.kind === 193 /* BinaryExpression */) { return visitDestructuringAssignment(node); } else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) { @@ -56419,7 +56696,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 262 /* SourceFile */; + return container !== undefined && container.kind === 263 /* SourceFile */; } else { return false; @@ -56452,7 +56729,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 262 /* SourceFile */) { + if (node.kind === 263 /* SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -56499,10 +56776,10 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return substituteBinaryExpression(node); - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -56595,7 +56872,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 /* PostfixUnaryExpression */ + var expression = node.kind === 192 /* PostfixUnaryExpression */ ? ts.createPrefix(node.operator, node.operand, /*location*/ node) : node; @@ -56603,7 +56880,7 @@ var ts; var exportName = exportedNames_2[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 191 /* PostfixUnaryExpression */) { + if (node.kind === 192 /* PostfixUnaryExpression */) { expression = node.operator === 42 /* PlusPlusToken */ ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -56625,7 +56902,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 262 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 263 /* SourceFile */) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -56640,7 +56917,7 @@ var ts; */ function preventSubstitution(node) { if (noSubstitution === undefined) - noSubstitution = ts.createMap(); + noSubstitution = []; noSubstitution[ts.getNodeId(node)] = true; return node; } @@ -56661,12 +56938,13 @@ var ts; var ts; (function (ts) { function transformModule(context) { - var transformModuleDelegates = ts.createMap((_a = {}, - _a[ts.ModuleKind.None] = transformCommonJSModule, - _a[ts.ModuleKind.CommonJS] = transformCommonJSModule, - _a[ts.ModuleKind.AMD] = transformAMDModule, - _a[ts.ModuleKind.UMD] = transformUMDModule, - _a)); + function getTransformModuleDelegate(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.AMD: return transformAMDModule; + case ts.ModuleKind.UMD: return transformUMDModule; + default: return transformCommonJSModule; + } + } var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); @@ -56678,13 +56956,13 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(259 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(262 /* SourceFile */); // Restore state when substituting nodes in a file. - var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. - var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. + context.enableSubstitution(193 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(191 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(192 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(260 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(263 /* SourceFile */); // Restore state when substituting nodes in a file. + var moduleInfoMap = []; // The ExternalModuleInfo for each file. + var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. var currentModuleInfo; // The ExternalModuleInfo for the current file. var noSubstitution; // Set of nodes for which substitution rules should be ignored. @@ -56701,9 +56979,10 @@ var ts; return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + currentModuleInfo = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; // Perform the transformation. - var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; + var transformModule = getTransformModuleDelegate(moduleKind); var updated = transformModule(node); currentSourceFile = undefined; currentModuleInfo = undefined; @@ -56957,23 +57236,23 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitImportDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return visitExportDeclaration(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitExportAssignment(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return visitVariableStatement(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return visitClassDeclaration(node); - case 296 /* MergeDeclarationMarker */: + case 297 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 297 /* EndOfDeclarationMarker */: + case 298 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: // This visitor does not descend into the tree, as export/import statements @@ -57285,7 +57564,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -57340,10 +57619,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 239 /* NamedImports */: + case 240 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -57445,7 +57724,7 @@ var ts; */ function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl); - var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; @@ -57469,7 +57748,7 @@ var ts; function appendExportStatement(statements, exportName, expression, location, allowComments) { if (exportName.text === "default") { var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile); - if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { + if (sourceFile && !sourceFile.symbol.exports.get("___esModule")) { if (languageVersion === 0 /* ES3 */) { statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true)))); } @@ -57542,10 +57821,10 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 262 /* SourceFile */) { + if (node.kind === 263 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; - noSubstitution = ts.createMap(); + noSubstitution = []; previousOnEmitNode(emitContext, node, emitCallback); currentSourceFile = undefined; currentModuleInfo = undefined; @@ -57606,10 +57885,10 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return substituteBinaryExpression(node); - case 191 /* PostfixUnaryExpression */: - case 190 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -57630,7 +57909,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 262 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 263 /* SourceFile */) { return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), /*location*/ node); } @@ -57641,8 +57920,8 @@ var ts; /*location*/ node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_39 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_39), + var name = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name), /*location*/ node); } } @@ -57705,7 +57984,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 /* PostfixUnaryExpression */ + var expression = node.kind === 192 /* PostfixUnaryExpression */ ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 /* PlusPlusToken */ ? 58 /* PlusEqualsToken */ : 59 /* MinusEqualsToken */), ts.createLiteral(1), /*location*/ node) : node; @@ -57735,7 +58014,6 @@ var ts; } } } - var _a; } ts.transformModule = transformModule; // emit output for the __export helper function @@ -57760,14 +58038,16 @@ var ts; /* @internal */ var ts; (function (ts) { - var moduleTransformerMap = ts.createMap((_a = {}, - _a[ts.ModuleKind.ES2015] = ts.transformES2015Module, - _a[ts.ModuleKind.System] = ts.transformSystemModule, - _a[ts.ModuleKind.AMD] = ts.transformModule, - _a[ts.ModuleKind.CommonJS] = ts.transformModule, - _a[ts.ModuleKind.UMD] = ts.transformModule, - _a[ts.ModuleKind.None] = ts.transformModule, - _a)); + function getModuleTransformer(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.ES2015: + return ts.transformES2015Module; + case ts.ModuleKind.System: + return ts.transformSystemModule; + default: + return ts.transformModule; + } + } var SyntaxKindFeatureFlags; (function (SyntaxKindFeatureFlags) { SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution"; @@ -57795,7 +58075,7 @@ var ts; transformers.push(ts.transformES2015); transformers.push(ts.transformGenerators); } - transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]); + transformers.push(getModuleTransformer(moduleKind)); // The ES5 transformer is last so that it can substitute expressions like `exports.default` // for ES3. if (languageVersion < 1 /* ES5 */) { @@ -57813,7 +58093,7 @@ var ts; * @param transforms An array of Transformers. */ function transformFiles(resolver, host, sourceFiles, transformers) { - var enabledSyntaxKindFeatures = new Array(298 /* Count */); + var enabledSyntaxKindFeatures = new Array(299 /* Count */); var lexicalEnvironmentDisabled = false; var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; @@ -58028,7 +58308,6 @@ var ts; } } ts.transformFiles = transformFiles; - var _a; })(ts || (ts = {})); /// /* @internal */ @@ -58250,7 +58529,7 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 294 /* NotEmittedStatement */ + if (node.kind !== 295 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); @@ -58263,7 +58542,7 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 294 /* NotEmittedStatement */ + if (node.kind !== 295 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -58442,7 +58721,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 294 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 295 /* NotEmittedStatement */; var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0; // Emit leading comments if the position is not synthesized and the node @@ -58461,7 +58740,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 225 /* VariableDeclarationList */) { + if (node.kind === 226 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -58692,7 +58971,7 @@ var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); - ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + ts.forEachEmittedFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { var declarationFilePath = _a.declarationFilePath; @@ -58774,7 +59053,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 236 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 237 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -58800,9 +59079,9 @@ var ts; } }); if (usedTypeDirectiveReferences) { - for (var directive in usedTypeDirectiveReferences) { + ts.forEachKey(usedTypeDirectiveReferences, function (directive) { referencesOutput += "/// " + newLine; - } + }); } return { reportedDeclarationError: reportedDeclarationError, @@ -58849,10 +59128,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 224 /* VariableDeclaration */) { + if (declaration.kind === 225 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 239 /* NamedImports */ || declaration.kind === 240 /* ImportSpecifier */ || declaration.kind === 237 /* ImportClause */) { + else if (declaration.kind === 240 /* NamedImports */ || declaration.kind === 241 /* ImportSpecifier */ || declaration.kind === 238 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -58870,7 +59149,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 === 236 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 237 /* 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; @@ -58880,12 +59159,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 231 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 232 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 231 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 232 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -58904,8 +59183,8 @@ var ts; } for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { var directive = typeReferenceDirectives_1[_i]; - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + if (!usedTypeDirectiveReferences.has(directive)) { + usedTypeDirectiveReferences.set(directive, directive); } } } @@ -59003,49 +59282,50 @@ var ts; function emitType(type) { switch (type.kind) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 133 /* ObjectKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 129 /* NeverKeyword */: - case 167 /* ThisType */: - case 171 /* LiteralType */: + case 168 /* ThisType */: + case 172 /* LiteralType */: return writeTextOfNode(currentText, type); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return emitTypeReference(type); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return emitTypeQuery(type); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return emitArrayType(type); - case 163 /* TupleType */: + case 164 /* TupleType */: return emitTupleType(type); - case 164 /* UnionType */: + case 165 /* UnionType */: return emitUnionType(type); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return emitIntersectionType(type); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return emitParenType(type); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return emitTypeOperator(type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return emitIndexedAccessType(type); - case 170 /* MappedType */: + case 171 /* MappedType */: return emitMappedType(type); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return emitTypeLiteral(type); case 70 /* Identifier */: return emitEntityName(type); - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return emitEntityName(type); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -59053,8 +59333,8 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 141 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 141 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 142 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 142 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); @@ -59063,14 +59343,14 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 235 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 236 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isEntityNameExpression(node.expression)) { - ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 177 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 178 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -59179,15 +59459,15 @@ var ts; // do not need to keep track of created temp names. function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!(baseName in currentIdentifiers)) { + if (!currentIdentifiers.has(baseName)) { return baseName; } var count = 0; while (true) { count++; - var name_40 = baseName + "_" + count; - if (!(name_40 in currentIdentifiers)) { - return name_40; + var name = baseName + "_" + count; + if (!currentIdentifiers.has(name)) { + return name; } } } @@ -59234,10 +59514,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 235 /* ImportEqualsDeclaration */ || - (node.parent.kind === 262 /* SourceFile */ && isCurrentFileExternalModule)) { + else if (node.kind === 236 /* ImportEqualsDeclaration */ || + (node.parent.kind === 263 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 262 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 263 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -59247,7 +59527,7 @@ var ts; }); } else { - if (node.kind === 236 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -59265,23 +59545,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return writeVariableStatement(node); - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return writeClassDeclaration(node); - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -59289,7 +59569,7 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 262 /* SourceFile */) { + if (node.parent.kind === 263 /* SourceFile */) { var modifiers = ts.getModifierFlags(node); // If the node is exported if (modifiers & 1 /* Export */) { @@ -59298,7 +59578,7 @@ var ts; if (modifiers & 512 /* Default */) { write("default "); } - else if (node.kind !== 228 /* InterfaceDeclaration */ && !noDeclare) { + else if (node.kind !== 229 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } @@ -59350,7 +59630,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 238 /* NamespaceImport */) { + if (namedBindings.kind === 239 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -59374,7 +59654,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 238 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 239 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -59395,13 +59675,13 @@ var ts; // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' // so compiler will treat them as external modules. - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 231 /* ModuleDeclaration */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 232 /* ModuleDeclaration */; var moduleSpecifier; - if (parent.kind === 235 /* ImportEqualsDeclaration */) { + if (parent.kind === 236 /* ImportEqualsDeclaration */) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 231 /* ModuleDeclaration */) { + else if (parent.kind === 232 /* ModuleDeclaration */) { moduleSpecifier = parent.name; } else { @@ -59471,7 +59751,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 232 /* ModuleBlock */) { + while (node.body && node.body.kind !== 233 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -59541,7 +59821,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 149 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */); + return node.parent.kind === 150 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -59552,15 +59832,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 === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 161 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 149 /* MethodDeclaration */ || - node.parent.kind === 148 /* MethodSignature */ || - node.parent.kind === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - node.parent.kind === 153 /* CallSignature */ || - node.parent.kind === 154 /* ConstructSignature */); + if (node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 162 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 150 /* MethodDeclaration */ || + node.parent.kind === 149 /* MethodSignature */ || + node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + node.parent.kind === 154 /* CallSignature */ || + node.parent.kind === 155 /* ConstructSignature */); emitType(node.constraint); } else { @@ -59571,34 +59851,34 @@ 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 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 153 /* CallSignature */: + case 154 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* 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 === 227 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 228 /* 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 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -59636,7 +59916,7 @@ var ts; function getHeritageClauseVisibilityError() { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 227 /* ClassDeclaration */) { + if (node.parent.parent.kind === 228 /* 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 : @@ -59723,7 +60003,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 !== 224 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 225 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -59734,11 +60014,11 @@ var ts; writeTextOfNode(currentText, node.name); // If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor // we don't want to emit property declaration with "?" - if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */ || - (node.kind === 144 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { + if ((node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */ || + (node.kind === 145 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) && node.parent.kind === 161 /* TypeLiteral */) { + if ((node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */) && node.parent.kind === 162 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (resolver.isLiteralConstDeclaration(node)) { @@ -59751,14 +60031,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 224 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) { + else if (node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.hasModifier(node, 32 /* Static */)) { return symbolAccessibilityResult.errorModuleName ? @@ -59767,7 +60047,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 === 227 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -59799,7 +60079,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198 /* OmittedExpression */) { + if (element.kind !== 199 /* OmittedExpression */) { elements.push(element); } } @@ -59869,7 +60149,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 === 151 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 152 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -59882,7 +60162,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 151 /* GetAccessor */ + return accessor.kind === 152 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -59891,7 +60171,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 152 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 153 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32 /* Static */)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? @@ -59941,17 +60221,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 226 /* FunctionDeclaration */) { + if (node.kind === 227 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 149 /* MethodDeclaration */ || node.kind === 150 /* Constructor */) { + else if (node.kind === 150 /* MethodDeclaration */ || node.kind === 151 /* Constructor */) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 226 /* FunctionDeclaration */) { + if (node.kind === 227 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 150 /* Constructor */) { + else if (node.kind === 151 /* Constructor */) { write("constructor"); } else { @@ -59971,17 +60251,17 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; var closeParenthesizedFunctionType = false; - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { // Index signature can have readonly modifier emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); write("["); } else { // Construct signature or constructor type write new Signature - if (node.kind === 154 /* ConstructSignature */ || node.kind === 159 /* ConstructorType */) { + if (node.kind === 155 /* ConstructSignature */ || node.kind === 160 /* ConstructorType */) { write("new "); } - else if (node.kind === 158 /* FunctionType */) { + else if (node.kind === 159 /* FunctionType */) { var currentOutput = writer.getText(); // Do not generate incorrect type when function type with type parameters is type argument // This could happen if user used space between two '<' making it error free @@ -59996,22 +60276,22 @@ var ts; } // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 158 /* FunctionType */ || node.kind === 159 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 161 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 159 /* FunctionType */ || node.kind === 160 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 162 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 150 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) { + else if (node.kind !== 151 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -60025,26 +60305,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.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 153 /* CallSignature */: + case 154 /* CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.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 155 /* IndexSignature */: + case 156 /* IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.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 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node, 32 /* Static */)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -60052,7 +60332,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 === 227 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -60066,7 +60346,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -60101,9 +60381,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - node.parent.parent.kind === 161 /* TypeLiteral */) { + if (node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + node.parent.parent.kind === 162 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!ts.hasModifier(node.parent, 8 /* Private */)) { @@ -60119,29 +60399,29 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.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 153 /* CallSignature */: + case 154 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.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 155 /* IndexSignature */: + case 156 /* IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* Static */)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -60149,7 +60429,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 === 227 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 228 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -60162,7 +60442,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 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -60174,12 +60454,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 === 172 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 173 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 174 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -60190,7 +60470,7 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 198 /* OmittedExpression */) { + if (bindingElement.kind === 199 /* 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) @@ -60199,7 +60479,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 174 /* BindingElement */) { + else if (bindingElement.kind === 175 /* 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" @@ -60238,40 +60518,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: - case 231 /* ModuleDeclaration */: - case 235 /* ImportEqualsDeclaration */: - case 228 /* InterfaceDeclaration */: - case 227 /* ClassDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 230 /* EnumDeclaration */: + case 227 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 229 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return emitExportDeclaration(node); - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return writeFunctionDeclaration(node); - case 154 /* ConstructSignature */: - case 153 /* CallSignature */: - case 155 /* IndexSignature */: + case 155 /* ConstructSignature */: + case 154 /* CallSignature */: + case 156 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return emitAccessorDeclaration(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return emitPropertyDeclaration(node); - case 261 /* EnumMember */: + case 262 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return emitExportAssignment(node); - case 262 /* SourceFile */: + case 263 /* SourceFile */: return emitSourceFile(node); } } @@ -60289,7 +60569,7 @@ var ts; } else { // Get the declaration file path - ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, @@ -60387,11 +60667,11 @@ var ts; ts.performance.measure("transformTime", "beforeTransform"); // Emit each output file ts.performance.mark("beforePrint"); - ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, emitFile, transformed, emitOnlyDtsFiles); ts.performance.measure("printTime", "beforePrint"); // Clean up emit nodes on parse tree - for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) { - var sourceFile = sourceFiles_4[_b]; + for (var _b = 0, sourceFiles_3 = sourceFiles; _b < sourceFiles_3.length; _b++) { + var sourceFile = sourceFiles_3[_b]; ts.disposeEmitNodes(sourceFile); } return { @@ -60400,7 +60680,8 @@ var ts; emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; - function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) { + function emitFile(_a, sourceFiles, isBundledEmit) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; // Make sure not to write js file and source map file if any of them cannot be written if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { if (!emitOnlyDtsFiles) { @@ -60434,8 +60715,8 @@ var ts; isOwnFileEmit = !isBundledEmit; // Emit helpers from all the files if (isBundledEmit && moduleKind) { - for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { - var sourceFile = sourceFiles_5[_a]; + for (var _a = 0, sourceFiles_4 = sourceFiles; _a < sourceFiles_4.length; _a++) { + var sourceFile = sourceFiles_4[_a]; emitHelpers(sourceFile, /*isBundle*/ true); } } @@ -60564,7 +60845,7 @@ var ts; var kind = node.kind; switch (kind) { // Top-level nodes - case 262 /* SourceFile */: + case 263 /* SourceFile */: return emitSourceFile(node); } } @@ -60626,212 +60907,212 @@ var ts; case 130 /* ReadonlyKeyword */: case 131 /* RequireKeyword */: case 132 /* NumberKeyword */: - case 133 /* SetKeyword */: - case 134 /* StringKeyword */: - case 135 /* SymbolKeyword */: - case 136 /* TypeKeyword */: - case 137 /* UndefinedKeyword */: - case 138 /* FromKeyword */: - case 139 /* GlobalKeyword */: - case 140 /* OfKeyword */: + case 134 /* SetKeyword */: + case 135 /* StringKeyword */: + case 136 /* SymbolKeyword */: + case 137 /* TypeKeyword */: + case 138 /* UndefinedKeyword */: + case 139 /* FromKeyword */: + case 140 /* GlobalKeyword */: + case 141 /* OfKeyword */: writeTokenText(kind); return; // Parse tree nodes // Names - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return emitQualifiedName(node); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return emitTypeParameter(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return emitParameter(node); - case 145 /* Decorator */: + case 146 /* Decorator */: return emitDecorator(node); // Type members - case 146 /* PropertySignature */: + case 147 /* PropertySignature */: return emitPropertySignature(node); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return emitPropertyDeclaration(node); - case 148 /* MethodSignature */: + case 149 /* MethodSignature */: return emitMethodSignature(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return emitMethodDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return emitConstructor(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return emitAccessorDeclaration(node); - case 153 /* CallSignature */: + case 154 /* CallSignature */: return emitCallSignature(node); - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: return emitConstructSignature(node); - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return emitIndexSignature(node); // Types - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return emitTypePredicate(node); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return emitTypeReference(node); - case 158 /* FunctionType */: + case 159 /* FunctionType */: return emitFunctionType(node); - case 159 /* ConstructorType */: + case 160 /* ConstructorType */: return emitConstructorType(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return emitTypeQuery(node); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return emitTypeLiteral(node); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return emitArrayType(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return emitTupleType(node); - case 164 /* UnionType */: + case 165 /* UnionType */: return emitUnionType(node); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return emitIntersectionType(node); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return emitParenthesizedType(node); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 167 /* ThisType */: + case 168 /* ThisType */: return emitThisType(); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return emitTypeOperator(node); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return emitIndexedAccessType(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return emitMappedType(node); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return emitLiteralType(node); // Binding patterns - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return emitBindingElement(node); // Misc - case 203 /* TemplateSpan */: + case 204 /* TemplateSpan */: return emitTemplateSpan(node); - case 204 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 205 /* Block */: + case 206 /* Block */: return emitBlock(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return emitVariableStatement(node); - case 207 /* EmptyStatement */: + case 208 /* EmptyStatement */: return emitEmptyStatement(); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return emitExpressionStatement(node); - case 209 /* IfStatement */: + case 210 /* IfStatement */: return emitIfStatement(node); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return emitDoStatement(node); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return emitWhileStatement(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return emitForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return emitForInStatement(node); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return emitForOfStatement(node); - case 215 /* ContinueStatement */: + case 216 /* ContinueStatement */: return emitContinueStatement(node); - case 216 /* BreakStatement */: + case 217 /* BreakStatement */: return emitBreakStatement(node); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return emitReturnStatement(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return emitWithStatement(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return emitSwitchStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return emitLabeledStatement(node); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: return emitThrowStatement(node); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return emitTryStatement(node); - case 223 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return emitClassDeclaration(node); - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: return emitModuleBlock(node); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return emitCaseBlock(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return emitImportDeclaration(node); - case 237 /* ImportClause */: + case 238 /* ImportClause */: return emitImportClause(node); - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: return emitNamespaceImport(node); - case 239 /* NamedImports */: + case 240 /* NamedImports */: return emitNamedImports(node); - case 240 /* ImportSpecifier */: + case 241 /* ImportSpecifier */: return emitImportSpecifier(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return emitExportAssignment(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return emitExportDeclaration(node); - case 243 /* NamedExports */: + case 244 /* NamedExports */: return emitNamedExports(node); - case 244 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: return emitExportSpecifier(node); - case 245 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return; // Module references - case 246 /* ExternalModuleReference */: + case 247 /* ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 10 /* JsxText */: return emitJsxText(node); - case 249 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: return emitJsxOpeningElement(node); - case 250 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: return emitJsxClosingElement(node); - case 251 /* JsxAttribute */: + case 252 /* JsxAttribute */: return emitJsxAttribute(node); - case 252 /* JsxSpreadAttribute */: + case 253 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 254 /* CaseClause */: + case 255 /* CaseClause */: return emitCaseClause(node); - case 255 /* DefaultClause */: + case 256 /* DefaultClause */: return emitDefaultClause(node); - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: return emitHeritageClause(node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 261 /* EnumMember */: + case 262 /* EnumMember */: return emitEnumMember(node); } // If the node is an expression, try to emit it as an expression with @@ -60868,67 +61149,67 @@ var ts; writeTokenText(kind); return; // Expressions - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return emitElementAccessExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return emitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return emitNewExpression(node); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return emitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return emitArrowFunction(node); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return emitDeleteExpression(node); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return emitVoidExpression(node); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return emitAwaitExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return emitBinaryExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return emitConditionalExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return emitTemplateExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return emitYieldExpression(node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return emitSpreadExpression(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return emitClassExpression(node); - case 198 /* OmittedExpression */: + case 199 /* OmittedExpression */: return; - case 200 /* AsExpression */: + case 201 /* AsExpression */: return emitAsExpression(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return emitNonNullExpression(node); - case 202 /* MetaProperty */: + case 203 /* MetaProperty */: return emitMetaProperty(node); // JSX - case 247 /* JsxElement */: + case 248 /* JsxElement */: return emitJsxElement(node); - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); } } @@ -61049,7 +61330,7 @@ var ts; function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - write(node.kind === 151 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 152 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -61257,9 +61538,11 @@ var ts; // Also emit a dot if expression is a integer const enum value - it will appear in generated code as numeric literal function needsDotDotForPropertyAccess(expression) { if (expression.kind === 8 /* NumericLiteral */) { - // check if numeric literal was originally written with a dot + // check if numeric literal is a decimal literal that was originally written with a dot var text = getLiteralTextOfNode(expression); - return text.indexOf(ts.tokenToString(22 /* DotToken */)) < 0; + return ts.getNumericLiteralFlags(text, /*hint*/ 15 /* All */) === 0 /* None */ + && !expression.isOctalLiteral + && text.indexOf(ts.tokenToString(22 /* DotToken */)) < 0; } else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { // check if constant enum value is integer @@ -61356,7 +61639,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 190 /* PrefixUnaryExpression */ + return operand.kind === 191 /* PrefixUnaryExpression */ && ((node.operator === 36 /* PlusToken */ && (operand.operator === 36 /* PlusToken */ || operand.operator === 42 /* PlusPlusToken */)) || (node.operator === 37 /* MinusToken */ && (operand.operator === 37 /* MinusToken */ || operand.operator === 43 /* MinusMinusToken */))); } @@ -61479,7 +61762,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node); writeToken(81 /* ElseKeyword */, node.thenStatement.end, node); - if (node.elseStatement.kind === 209 /* IfStatement */) { + if (node.elseStatement.kind === 210 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -61541,7 +61824,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 225 /* VariableDeclarationList */) { + if (node.kind === 226 /* VariableDeclarationList */) { emit(node); } else { @@ -61783,7 +62066,7 @@ var ts; write(node.flags & 16 /* Namespace */ ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 231 /* ModuleDeclaration */) { + while (body.kind === 232 /* ModuleDeclaration */) { write("."); emit(body.name); body = body.body; @@ -61990,7 +62273,6 @@ var ts; emitList(node, node.types, 272 /* HeritageClauseTypes */); } function emitCatchClause(node) { - writeLine(); var openParenPos = writeToken(73 /* CatchKeyword */, node.pos); write(" "); writeToken(18 /* OpenParenToken */, openParenPos); @@ -62097,10 +62379,10 @@ var ts; // Skip the helper if it can be bundled but hasn't already been emitted and we // are emitting a bundled module. if (shouldBundle) { - if (bundledHelpers[helper.name]) { + if (bundledHelpers.get(helper.name)) { continue; } - bundledHelpers[helper.name] = true; + bundledHelpers.set(helper.name, true); } } else if (isBundle) { @@ -62456,7 +62738,7 @@ var ts; && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); } function skipSynthesizedParentheses(node) { - while (node.kind === 183 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 184 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -62498,14 +62780,15 @@ var ts; } function isUniqueName(name) { return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentFileIdentifiers, name) && - !ts.hasProperty(generatedNameSet, name); + !currentFileIdentifiers.has(name) && + !generatedNameSet.has(name); } function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { + if (node.locals) { + var local = node.locals.get(name); // We conservatively include alias symbols to cover cases where they're emitted as locals - if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { + if (local && local.flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { return false; } } @@ -62519,10 +62802,10 @@ var ts; */ function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_41 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_41)) { + var name = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name)) { tempFlags |= flags; - return name_41; + return name; } } while (true) { @@ -62530,11 +62813,11 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_42 = count < 26 + var name = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_42)) { - return name_42; + if (isUniqueName(name)) { + return name; } } } @@ -62552,7 +62835,8 @@ var ts; while (true) { var generatedName = baseName + i; if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; + generatedNameSet.set(generatedName, generatedName); + return generatedName; } i++; } @@ -62589,21 +62873,21 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return makeUniqueName(getTextOfNode(node)); - case 231 /* ModuleDeclaration */: - case 230 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 236 /* ImportDeclaration */: - case 242 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: + case 243 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 226 /* FunctionDeclaration */: - case 227 /* ClassDeclaration */: - case 241 /* ExportAssignment */: + case 227 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 242 /* ExportAssignment */: return generateNameForExportDefault(); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return generateNameForClassExpression(); - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0 /* Auto */); @@ -62862,11 +63146,11 @@ var ts; return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; } function directoryExists(directoryPath) { - if (directoryPath in existingDirectories) { + if (existingDirectories.has(directoryPath)) { return true; } if (ts.sys.directoryExists(directoryPath)) { - existingDirectories[directoryPath] = true; + existingDirectories.set(directoryPath, true); return true; } return false; @@ -62885,10 +63169,11 @@ var ts; } var hash = ts.sys.createHash(data); var mtimeBefore = ts.sys.getModifiedTime(fileName); - if (mtimeBefore && fileName in outputFingerprints) { - var fingerprint = outputFingerprints[fileName]; + if (mtimeBefore) { + var fingerprint = outputFingerprints.get(fileName); // If output has not been changed, and the file has no external modification - if (fingerprint.byteOrderMark === writeByteOrderMark && + if (fingerprint && + fingerprint.byteOrderMark === writeByteOrderMark && fingerprint.hash === hash && fingerprint.mtime.getTime() === mtimeBefore.getTime()) { return; @@ -62896,11 +63181,11 @@ var ts; } ts.sys.writeFile(fileName, data, writeByteOrderMark); var mtimeAfter = ts.sys.getModifiedTime(fileName); - outputFingerprints[fileName] = { + outputFingerprints.set(fileName, { hash: hash, byteOrderMark: writeByteOrderMark, mtime: mtimeAfter - }; + }); } function writeFile(fileName, data, writeByteOrderMark, onError) { try { @@ -62999,10 +63284,14 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_43 = names_1[_i]; - var result = name_43 in cache - ? cache[name_43] - : cache[name_43] = loader(name_43, containingFile); + var name = names_1[_i]; + var result = void 0; + if (cache.has(name)) { + result = cache.get(name); + } + else { + cache.set(name, result = loader(name, containingFile)); + } resolutions.push(result); } return resolutions; @@ -63135,7 +63424,7 @@ var ts; return program; function getCommonSourceDirectory() { if (commonSourceDirectory === undefined) { - var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary); + var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary); }); if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { // If a rootDir is specified and is valid use it as the commonSourceDirectory commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); @@ -63159,7 +63448,7 @@ var ts; classifiableNames = ts.createMap(); for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var sourceFile = files_2[_i]; - ts.copyProperties(sourceFile.classifiableNames, classifiableNames); + ts.copyEntries(sourceFile.classifiableNames, classifiableNames); } } return classifiableNames; @@ -63395,7 +63684,7 @@ var ts; }; } function isSourceFileFromExternalLibrary(file) { - return sourceFilesFoundSearchingNodeModules[file.path]; + return sourceFilesFoundSearchingNodeModules.get(file.path); } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true)); @@ -63540,23 +63829,23 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); return; } // Pass through - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 224 /* VariableDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 225 /* VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); @@ -63564,35 +63853,35 @@ var ts; } } switch (node.kind) { - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 107 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: var typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; @@ -63607,29 +63896,29 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 227 /* ClassDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } // pass through - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 206 /* VariableStatement */); + return checkModifiers(nodes, parent.kind === 207 /* VariableStatement */); } break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { @@ -63641,16 +63930,16 @@ var ts; return; } break; - case 144 /* Parameter */: + case 145 /* Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); return; } break; - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 199 /* ExpressionWithTypeArguments */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 200 /* ExpressionWithTypeArguments */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); @@ -63749,7 +64038,7 @@ var ts; // synthesize 'import "tslib"' declaration var externalHelpersModuleReference = ts.createSynthesizedNode(9 /* StringLiteral */); externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(236 /* ImportDeclaration */); + var importDecl = ts.createSynthesizedNode(237 /* ImportDeclaration */); importDecl.parent = file; externalHelpersModuleReference.parent = importDecl; imports = [externalHelpersModuleReference]; @@ -63767,9 +64056,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 236 /* ImportDeclaration */: - case 235 /* ImportEqualsDeclaration */: - case 242 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; @@ -63784,7 +64073,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2 /* Ambient */) || ts.isDeclarationFile(file))) { var moduleName = node.name; // Ambient module declarations can be interpreted as augmentations for some existing external modules. @@ -63884,18 +64173,18 @@ var ts; } // If the file was previously found via a node_modules search, but is now being processed as a root file, // then everything it sucks in may also be marked incorrectly, and needs to be checked again. - if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) { - sourceFilesFoundSearchingNodeModules[file_1.path] = false; + if (file_1 && sourceFilesFoundSearchingNodeModules.get(file_1.path) && currentNodeModulesDepth == 0) { + sourceFilesFoundSearchingNodeModules.set(file_1.path, false); if (!options.noResolve) { processReferencedFiles(file_1, isDefaultLib); processTypeReferenceDirectives(file_1); } - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } - else if (file_1 && modulesWithElidedImports[file_1.path]) { + else if (file_1 && modulesWithElidedImports.get(file_1.path)) { if (currentNodeModulesDepth < maxNodeModuleJsDepth) { - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } } @@ -63912,7 +64201,7 @@ var ts; }); filesByName.set(path, file); if (file) { - sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0); + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); file.path = path; if (host.useCaseSensitiveFileNames()) { // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case @@ -63961,7 +64250,7 @@ var ts; } function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { // If we already found this library as a primary reference - nothing to do - var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); if (previousResolution && previousResolution.primary) { return; } @@ -63995,7 +64284,7 @@ var ts; fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); } if (saveResolution) { - resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective); } } function createDiagnostic(refFile, refPos, refEnd, message) { @@ -64044,7 +64333,7 @@ var ts; // This may still end up being an untyped module -- the file won't be included but imports will be allowed. var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; if (elideImport) { - modulesWithElidedImports[file.path] = true; + modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); @@ -64063,8 +64352,8 @@ var ts; } function computeCommonSourceDirectory(sourceFiles) { var fileNames = []; - for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { - var file = sourceFiles_6[_i]; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var file = sourceFiles_5[_i]; if (!file.isDeclarationFile) { fileNames.push(file.fileName); } @@ -64075,8 +64364,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { - var sourceFile = sourceFiles_7[_i]; + for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { + var sourceFile = sourceFiles_6[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -64235,7 +64524,7 @@ var ts; if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); - ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) { + ts.forEachEmittedFile(emitHost, function (emitFileNames) { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); }); @@ -64367,12 +64656,13 @@ var ts; }, { name: "jsx", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "preserve": 1 /* Preserve */, + "react-native": 3 /* ReactNative */, "react": 2 /* React */ }), paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, }, { name: "reactNamespace", @@ -64402,7 +64692,7 @@ var ts; { name: "module", shortName: "m", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "none": ts.ModuleKind.None, "commonjs": ts.ModuleKind.CommonJS, "amd": ts.ModuleKind.AMD, @@ -64416,7 +64706,7 @@ var ts; }, { name: "newLine", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "crlf": 0 /* CarriageReturnLineFeed */, "lf": 1 /* LineFeed */ }), @@ -64514,8 +64804,8 @@ var ts; shortName: "p", type: "string", isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY }, { name: "removeComments", @@ -64565,7 +64855,7 @@ var ts; { name: "target", shortName: "t", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es3": 0 /* ES3 */, "es5": 1 /* ES5 */, "es6": 2 /* ES2015 */, @@ -64602,7 +64892,7 @@ var ts; }, { name: "moduleResolution", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "node": ts.ModuleResolutionKind.NodeJs, "classic": ts.ModuleResolutionKind.Classic, }), @@ -64711,7 +65001,7 @@ var ts; type: "list", element: { name: "lib", - type: ts.createMap({ + type: ts.createMapFromTemplate({ // JavaScript only "es5": "lib.es5.d.ts", "es6": "lib.es2015.d.ts", @@ -64822,9 +65112,9 @@ var ts; var optionNameMap = ts.createMap(); var shortOptionNames = ts.createMap(); ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; @@ -64833,7 +65123,7 @@ var ts; ts.getOptionNameMap = getOptionNameMap; /* @internal */ function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; @@ -64885,11 +65175,12 @@ var ts; else if (s.charCodeAt(0) === 45 /* minus */) { s = s.slice(s.charCodeAt(1) === 45 /* minus */ ? 2 : 1).toLowerCase(); // Try to translate short option names to their full equivalents. - if (s in shortOptionNames) { - s = shortOptionNames[s]; + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - var opt = optionNameMap[s]; + var opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -65037,21 +65328,20 @@ var ts; } function getNameOfCompilerOptionValue(value, customTypeMap) { // There is a typeMap associated with this command-line option so use it to map value back to its name - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { return key; } - } - return undefined; + }); } function serializeCompilerOptions(options) { - var result = ts.createMap(); + var result = {}; var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_44 in options) { - if (ts.hasProperty(options, name_44)) { + for (var name in options) { + if (ts.hasProperty(options, name)) { // tsconfig only options cannot be specified via command line, // so we can assume that only types that can appear here string | number | boolean - switch (name_44) { + switch (name) { case "init": case "watch": case "version": @@ -65059,14 +65349,14 @@ var ts; case "project": break; default: - var value = options[name_44]; - var optionDefinition = optionsNameMap[name_44.toLowerCase()]; + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { // There is no map associated with this compiler option then use the value as-is // This is the case if the value is expect to be string, number, boolean or list of string - result[name_44] = value; + result[name] = value; } else { if (optionDefinition.type === "list") { @@ -65075,11 +65365,11 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_44] = convertedValue; + result[name] = convertedValue; } else { // There is a typeMap associated with this command-line option so use it to map value back to its name - result[name_44] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -65305,8 +65595,8 @@ var ts; } var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; + var opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -65340,8 +65630,9 @@ var ts; } function convertJsonOptionOfCustomType(opt, value, errors) { var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + var val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -65465,7 +65756,7 @@ var ts; for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } if (include && include.length > 0) { @@ -65486,14 +65777,13 @@ var ts; // same directory, we should remove it. removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); return { fileNames: literalFiles.concat(wildcardFiles), wildcardDirectories: wildcardDirectories @@ -65501,8 +65791,8 @@ var ts; } function validateSpecs(specs, errors, allowTrailingRecursion) { var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } @@ -65536,7 +65826,7 @@ var ts; // /a/b/a?z - Watch /a/b directly to catch any new file matching a?z var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); + var wildcardDirectories = {}; if (include !== undefined) { var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { @@ -65558,14 +65848,16 @@ var ts; } } // Remove any subpaths under an existing recursively watched directory. - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } } } - } + ; } return wildcardDirectories; } @@ -65596,7 +65888,7 @@ var ts; for (var i = 0 /* Highest */; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i]; var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -65616,19 +65908,9 @@ var ts; for (var i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i]; var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - /** - * Adds a file to an array of files. - * - * @param output The output array. - * @param file The file path. - */ - function addFileToOutput(output, file) { - output.push(file); - return output; - } /** * Gets a case sensitive key. * @@ -65896,33 +66178,33 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 144 /* Parameter */: - case 224 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 258 /* PropertyAssignment */: - case 259 /* ShorthandPropertyAssignment */: - case 261 /* EnumMember */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 257 /* CatchClause */: + case 145 /* Parameter */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 259 /* PropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: + case 262 /* EnumMember */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 258 /* CatchClause */: return 1 /* Value */; - case 143 /* TypeParameter */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 161 /* TypeLiteral */: + case 144 /* TypeParameter */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 162 /* TypeLiteral */: return 2 /* Type */; - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -65932,22 +66214,25 @@ var ts; else { return 4 /* Namespace */; } - case 239 /* NamedImports */: - case 240 /* ImportSpecifier */: - case 235 /* ImportEqualsDeclaration */: - case 236 /* ImportDeclaration */: - case 241 /* ExportAssignment */: - case 242 /* ExportDeclaration */: + case 240 /* NamedImports */: + case 241 /* ImportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 237 /* ImportDeclaration */: + case 242 /* ExportAssignment */: + case 243 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 262 /* SourceFile */: + case 263 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 241 /* ExportAssignment */) { + if (node.kind === 263 /* SourceFile */) { + return 1 /* Value */; + } + else if (node.parent.kind === 242 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -65972,15 +66257,15 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 141 /* QualifiedName */ && + if (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 235 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 236 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function isInRightSideOfImport(node) { - while (node.parent.kind === 141 /* QualifiedName */) { + while (node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -65991,27 +66276,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 141 /* QualifiedName */) { - while (root.parent && root.parent.kind === 141 /* QualifiedName */) { + if (root.parent.kind === 142 /* QualifiedName */) { + while (root.parent && root.parent.kind === 142 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 157 /* TypeReference */ && !isLastClause; + return root.parent.kind === 158 /* TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 177 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 177 /* PropertyAccessExpression */) { + if (root.parent.kind === 178 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 178 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 256 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 200 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 257 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 227 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || - (decl.kind === 228 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); + return (decl.kind === 228 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || + (decl.kind === 229 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); } return false; } @@ -66019,17 +66304,17 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 157 /* TypeReference */ || - (node.parent.kind === 199 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + return node.parent.kind === 158 /* TypeReference */ || + (node.parent.kind === 200 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || (node.kind === 98 /* ThisKeyword */ && !ts.isPartOfExpression(node)) || - node.kind === 167 /* ThisType */; + node.kind === 168 /* ThisType */; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 179 /* CallExpression */); + return isCallOrNewExpressionTarget(node, 180 /* CallExpression */); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 180 /* NewExpression */); + return isCallOrNewExpressionTarget(node, 181 /* NewExpression */); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -66042,7 +66327,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 220 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 221 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -66052,13 +66337,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 /* Identifier */ && - (node.parent.kind === 216 /* BreakStatement */ || node.parent.kind === 215 /* ContinueStatement */) && + (node.parent.kind === 217 /* BreakStatement */ || node.parent.kind === 216 /* ContinueStatement */) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 /* Identifier */ && - node.parent.kind === 220 /* LabeledStatement */ && + node.parent.kind === 221 /* LabeledStatement */ && node.parent.label === node; } function isLabelName(node) { @@ -66066,15 +66351,15 @@ var ts; } ts.isLabelName = isLabelName; function isRightSideOfQualifiedName(node) { - return node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 231 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 232 /* ModuleDeclaration */ && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -66085,19 +66370,19 @@ var ts; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 258 /* PropertyAssignment */: - case 261 /* EnumMember */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 231 /* ModuleDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 259 /* PropertyAssignment */: + case 262 /* EnumMember */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 232 /* ModuleDeclaration */: return node.parent.name === node; - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return node.parent.argumentExpression === node; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return true; } } @@ -66146,17 +66431,17 @@ var ts; return undefined; } switch (node.kind) { - case 262 /* SourceFile */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 231 /* ModuleDeclaration */: + case 263 /* SourceFile */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: return node; } } @@ -66164,46 +66449,46 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 262 /* SourceFile */: + case 263 /* SourceFile */: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return ts.ScriptElementKind.moduleElement; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return ts.ScriptElementKind.classElement; - case 228 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; - case 229 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; - case 230 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; - case 224 /* VariableDeclaration */: + case 229 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; + case 230 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; + case 231 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; + case 225 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return ts.ScriptElementKind.functionElement; - case 151 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement; - case 152 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 152 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement; + case 153 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement; + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return ts.ScriptElementKind.memberFunctionElement; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return ts.ScriptElementKind.memberVariableElement; - case 155 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement; - case 154 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement; - case 153 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement; - case 150 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement; - case 143 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement; - case 261 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; - case 144 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 235 /* ImportEqualsDeclaration */: - case 240 /* ImportSpecifier */: - case 237 /* ImportClause */: - case 244 /* ExportSpecifier */: - case 238 /* NamespaceImport */: + case 156 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement; + case 155 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement; + case 154 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement; + case 151 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement; + case 144 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement; + case 262 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; + case 145 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; + case 236 /* ImportEqualsDeclaration */: + case 241 /* ImportSpecifier */: + case 238 /* ImportClause */: + case 245 /* ExportSpecifier */: + case 239 /* NamespaceImport */: return ts.ScriptElementKind.alias; - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -66218,7 +66503,7 @@ var ts; } ts.getNodeKind = getNodeKind; function getStringLiteralTypeForNode(node, typeChecker) { - var searchNode = node.parent.kind === 171 /* LiteralType */ ? node.parent : node; + var searchNode = node.parent.kind === 172 /* LiteralType */ ? node.parent : node; var type = typeChecker.getTypeAtLocation(searchNode); if (type && type.flags & 32 /* StringLiteral */) { return type; @@ -66233,7 +66518,7 @@ var ts; return true; case 70 /* Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 144 /* Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 145 /* Parameter */; default: return false; } @@ -66278,42 +66563,42 @@ var ts; return false; } switch (n.kind) { - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 176 /* ObjectLiteralExpression */: - case 172 /* ObjectBindingPattern */: - case 161 /* TypeLiteral */: - case 205 /* Block */: - case 232 /* ModuleBlock */: - case 233 /* CaseBlock */: - case 239 /* NamedImports */: - case 243 /* NamedExports */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 177 /* ObjectLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 162 /* TypeLiteral */: + case 206 /* Block */: + case 233 /* ModuleBlock */: + case 234 /* CaseBlock */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: return nodeEndsWith(n, 17 /* CloseBraceToken */, sourceFile); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 180 /* NewExpression */: + case 181 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 179 /* CallExpression */: - case 183 /* ParenthesizedExpression */: - case 166 /* ParenthesizedType */: + case 180 /* CallExpression */: + case 184 /* ParenthesizedExpression */: + case 167 /* ParenthesizedType */: return nodeEndsWith(n, 19 /* CloseParenToken */, sourceFile); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 154 /* ConstructSignature */: - case 153 /* CallSignature */: - case 185 /* ArrowFunction */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 155 /* ConstructSignature */: + case 154 /* CallSignature */: + case 186 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -66323,67 +66608,67 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 19 /* CloseParenToken */, sourceFile); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 209 /* IfStatement */: + case 210 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 24 /* SemicolonToken */); - case 175 /* ArrayLiteralExpression */: - case 173 /* ArrayBindingPattern */: - case 178 /* ElementAccessExpression */: - case 142 /* ComputedPropertyName */: - case 163 /* TupleType */: + case 176 /* ArrayLiteralExpression */: + case 174 /* ArrayBindingPattern */: + case 179 /* ElementAccessExpression */: + case 143 /* ComputedPropertyName */: + case 164 /* TupleType */: return nodeEndsWith(n, 21 /* CloseBracketToken */, sourceFile); - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 21 /* CloseBracketToken */, sourceFile); - case 254 /* CaseClause */: - case 255 /* DefaultClause */: + case 255 /* CaseClause */: + case 256 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 211 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 212 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 210 /* DoStatement */: + case 211 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; var hasWhileKeyword = findChildOfKind(n, 105 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 19 /* CloseParenToken */, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 187 /* TypeOfExpression */: - case 186 /* DeleteExpression */: - case 188 /* VoidExpression */: - case 195 /* YieldExpression */: - case 196 /* SpreadElement */: + case 188 /* TypeOfExpression */: + case 187 /* DeleteExpression */: + case 189 /* VoidExpression */: + case 196 /* YieldExpression */: + case 197 /* SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 203 /* TemplateSpan */: + case 204 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 242 /* ExportDeclaration */: - case 236 /* ImportDeclaration */: + case 243 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -66439,7 +66724,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 === 293 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 294 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -66611,7 +66896,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 262 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 263 /* 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. @@ -66670,17 +66955,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 253 /* JsxExpression */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 254 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 253 /* JsxExpression */) { + if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 254 /* JsxExpression */) { return true; } //
|
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 250 /* JsxClosingElement */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 251 /* JsxClosingElement */) { return true; } return false; @@ -66792,17 +67077,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 157 /* TypeReference */ || node.kind === 179 /* CallExpression */) { + if (node.kind === 158 /* TypeReference */ || node.kind === 180 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 227 /* ClassDeclaration */ || node.kind === 228 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 228 /* ClassDeclaration */ || node.kind === 229 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 140 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 141 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { @@ -66861,18 +67146,18 @@ var ts; } ts.compareDataObjects = compareDataObjects; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 175 /* ArrayLiteralExpression */ || - node.kind === 176 /* ObjectLiteralExpression */) { + if (node.kind === 176 /* ArrayLiteralExpression */ || + node.kind === 177 /* ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 192 /* BinaryExpression */ && + if (node.parent.kind === 193 /* BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 57 /* EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 214 /* ForOfStatement */ && + if (node.parent.kind === 215 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -66880,7 +67165,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 258 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 259 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -66908,12 +67193,32 @@ var ts; } } ts.isInNonReferenceComment = isInNonReferenceComment; + function createTextSpanFromNode(node, sourceFile) { + return ts.createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); + } + ts.createTextSpanFromNode = createTextSpanFromNode; + function isTypeKeyword(kind) { + switch (kind) { + case 118 /* AnyKeyword */: + case 121 /* BooleanKeyword */: + case 129 /* NeverKeyword */: + case 132 /* NumberKeyword */: + case 133 /* ObjectKeyword */: + case 135 /* StringKeyword */: + case 136 /* SymbolKeyword */: + case 104 /* VoidKeyword */: + return true; + default: + return false; + } + } + ts.isTypeKeyword = isTypeKeyword; })(ts || (ts = {})); // Display-part writer helpers /* @internal */ (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 145 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -67094,7 +67399,7 @@ var ts; return location.getText(); } else if (ts.isStringOrNumericLiteral(location) && - location.parent.kind === 142 /* ComputedPropertyName */) { + location.parent.kind === 143 /* ComputedPropertyName */) { return location.text; } // Try to get the local symbol if we're dealing with an 'export default' @@ -67106,7 +67411,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 240 /* ImportSpecifier */ || location.parent.kind === 244 /* ExportSpecifier */) && + (location.parent.kind === 241 /* ImportSpecifier */ || location.parent.kind === 245 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -67226,7 +67531,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 124 /* GetKeyword */ || - keyword2 === 133 /* SetKeyword */ || + keyword2 === 134 /* SetKeyword */ || keyword2 === 122 /* ConstructorKeyword */ || keyword2 === 114 /* StaticKeyword */) { // Allow things like "public get", "public constructor" and "public static". @@ -67385,10 +67690,10 @@ var ts; angleBracketStack--; } else if (token === 118 /* AnyKeyword */ || - token === 134 /* StringKeyword */ || + token === 135 /* StringKeyword */ || token === 132 /* NumberKeyword */ || token === 121 /* BooleanKeyword */ || - token === 135 /* SymbolKeyword */) { + token === 136 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -67560,7 +67865,7 @@ var ts; } } function isKeyword(token) { - return token >= 71 /* FirstKeyword */ && token <= 140 /* LastKeyword */; + return token >= 71 /* FirstKeyword */ && token <= 141 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -67617,10 +67922,10 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 231 /* ModuleDeclaration */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 226 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -67671,7 +67976,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 231 /* ModuleDeclaration */ && + return declaration.kind === 232 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -67686,7 +67991,7 @@ var ts; // Only bother calling into the typechecker if this is an identifier that // could possibly resolve to a type name. This makes classification run // in a third of the time it would normally take. - if (classifiableNames[identifier.text]) { + if (classifiableNames.get(identifier.text)) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var type = classifySymbol(symbol, ts.getMeaningFromLocation(node)); @@ -67835,16 +68140,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 282 /* JSDocParameterTag */: + case 283 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 285 /* JSDocTemplateTag */: + case 286 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 284 /* JSDocTypeTag */: + case 285 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 283 /* JSDocReturnTag */: + case 284 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -67931,22 +68236,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 249 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 250 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 251 /* JsxAttribute */: + case 252 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -67974,17 +68279,17 @@ var ts; if (token) { if (tokenKind === 57 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 224 /* VariableDeclaration */ || - token.parent.kind === 147 /* PropertyDeclaration */ || - token.parent.kind === 144 /* Parameter */ || - token.parent.kind === 251 /* JsxAttribute */) { + if (token.parent.kind === 225 /* VariableDeclaration */ || + token.parent.kind === 148 /* PropertyDeclaration */ || + token.parent.kind === 145 /* Parameter */ || + token.parent.kind === 252 /* JsxAttribute */) { return 5 /* operator */; } } - if (token.parent.kind === 192 /* BinaryExpression */ || - token.parent.kind === 190 /* PrefixUnaryExpression */ || - token.parent.kind === 191 /* PostfixUnaryExpression */ || - token.parent.kind === 193 /* ConditionalExpression */) { + if (token.parent.kind === 193 /* BinaryExpression */ || + token.parent.kind === 191 /* PrefixUnaryExpression */ || + token.parent.kind === 192 /* PostfixUnaryExpression */ || + token.parent.kind === 194 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -67994,7 +68299,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 251 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 252 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 11 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -68010,32 +68315,32 @@ var ts; else if (tokenKind === 70 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 144 /* Parameter */: + case 145 /* Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */; } @@ -68064,7 +68369,6 @@ var ts; } ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications; })(ts || (ts = {})); -/// /* @internal */ var ts; (function (ts) { @@ -68072,10 +68376,10 @@ var ts; (function (Completions) { function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { if (ts.isInReferenceComment(sourceFile, position)) { - return getTripleSlashReferenceCompletion(sourceFile, position); + return getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); } if (ts.isInString(sourceFile, position)) { - return getStringLiteralCompletionEntries(sourceFile, position); + return getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log); } var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (!completionData) { @@ -68088,13 +68392,13 @@ var ts; } var entries = []; if (ts.isSourceFileJavaScript(sourceFile)) { - var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true, typeChecker, compilerOptions.target, log); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target)); } else { if (!symbols || symbols.length === 0) { if (sourceFile.languageVariant === 1 /* JSX */ && - location.parent && location.parent.kind === 250 /* JsxClosingElement */) { + location.parent && location.parent.kind === 251 /* JsxClosingElement */) { // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. // For example: @@ -68111,632 +68415,642 @@ var ts; return undefined; } } - getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); + getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true, typeChecker, compilerOptions.target, log); } // Add keywords if this is not a member completion list if (!isMemberCompletion && !isJsDocTagName) { ts.addRange(entries, keywordCompletions); } return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { - var entries = []; - var nameTable = ts.getNameTable(sourceFile); - for (var name_45 in nameTable) { - // Skip identifiers produced only from the current location - if (nameTable[name_45] === position) { - continue; + } + Completions.getCompletionsAtPosition = getCompletionsAtPosition; + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames, target) { + var entries = []; + var nameTable = ts.getNameTable(sourceFile); + nameTable.forEach(function (pos, name) { + // Skip identifiers produced only from the current location + if (pos === position) { + return; + } + if (!uniqueNames.get(name)) { + uniqueNames.set(name, name); + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name), target, /*performCharacterChecks*/ true); + if (displayName) { + var entry = { + name: displayName, + kind: ts.ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } - if (!uniqueNames[name_45]) { - uniqueNames[name_45] = name_45; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, /*performCharacterChecks*/ true); - if (displayName) { - var entry = { - name: displayName, - kind: ts.ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; + } + }); + return entries; + } + function createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target) { + // 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(typeChecker, symbol, target, performCharacterChecks, 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 + // 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 + // '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). + return { + name: displayName, + kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), + kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), + sortText: "0", + }; + } + function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks, typeChecker, target, log) { + var start = ts.timestamp(); + var uniqueNames = ts.createMap(); + if (symbols) { + for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { + var symbol = symbols_4[_i]; + var entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!uniqueNames.get(id)) { entries.push(entry); + uniqueNames.set(id, id); } } } - return entries; } - function createCompletionEntry(symbol, location, performCharacterChecks) { - // 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(typeChecker, symbol, compilerOptions.target, performCharacterChecks, 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 - // 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 - // '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). - return { - name: displayName, - kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - sortText: "0", - }; + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); + return uniqueNames; + } + function getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log) { + var node = ts.findPrecedingToken(position, sourceFile); + if (!node || node.kind !== 9 /* StringLiteral */) { + return undefined; } - function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) { - var start = ts.timestamp(); - var uniqueNames = ts.createMap(); - if (symbols) { - for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { - var symbol = symbols_4[_i]; - var entry = createCompletionEntry(symbol, location, performCharacterChecks); - if (entry) { - var id = ts.escapeIdentifier(entry.name); - if (!uniqueNames[id]) { - entries.push(entry); - uniqueNames[id] = id; - } - } - } - } - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); - return uniqueNames; + if (node.parent.kind === 259 /* PropertyAssignment */ && + node.parent.parent.kind === 177 /* ObjectLiteralExpression */ && + node.parent.name === node) { + // Get quoted name of properties of the object literal expression + // i.e. interface ConfigFiles { + // 'jspm:dev': string + // } + // let files: ConfigFiles = { + // '/*completion position*/' + // } + // + // function foo(c: ConfigFiles) {} + // foo({ + // '/*completion position*/' + // }); + return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent, typeChecker, compilerOptions.target, log); + } + else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { + // Get all names of properties on the expression + // i.e. interface A { + // 'prop1': string + // } + // let a: A; + // a['/*completion position*/'] + return getStringLiteralCompletionEntriesFromElementAccess(node.parent, typeChecker, compilerOptions.target, log); + } + else if (node.parent.kind === 237 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { + // Get all known external module names or complete a path to a module + // i.e. import * as ns from "/*completion position*/"; + // import x = require("/*completion position*/"); + // var y = require("/*completion position*/"); + return getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker); + } + else if (isEqualityExpression(node.parent)) { + // Get completions from the type of the other operand + // i.e. switch (a) { + // case '/*completion position*/' + // } + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.left === node ? node.parent.right : node.parent.left), typeChecker); } - function getStringLiteralCompletionEntries(sourceFile, position) { - var node = ts.findPrecedingToken(position, sourceFile); - if (!node || node.kind !== 9 /* StringLiteral */) { - return undefined; - } - if (node.parent.kind === 258 /* PropertyAssignment */ && - node.parent.parent.kind === 176 /* ObjectLiteralExpression */ && - node.parent.name === node) { - // Get quoted name of properties of the object literal expression - // i.e. interface ConfigFiles { - // 'jspm:dev': string - // } - // let files: ConfigFiles = { - // '/*completion position*/' - // } - // - // function foo(c: ConfigFiles) {} - // foo({ - // '/*completion position*/' - // }); - return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); - } - else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { - // Get all names of properties on the expression - // i.e. interface A { - // 'prop1': string - // } - // let a: A; - // a['/*completion position*/'] - return getStringLiteralCompletionEntriesFromElementAccess(node.parent); - } - else if (node.parent.kind === 236 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { - // Get all known external module names or complete a path to a module - // i.e. import * as ns from "/*completion position*/"; - // import x = require("/*completion position*/"); - // var y = require("/*completion position*/"); - return getStringLiteralCompletionEntriesFromModuleNames(node); - } - else { - var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo) { - // Get string literal completions from specialized signatures of the target - // i.e. declare function f(a: 'A'); - // f("/*completion position*/") - return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo); - } - // Get completion for string literal from string literal type - // i.e. var x: "hi" | "hello" = "/*completion position*/" - return getStringLiteralCompletionEntriesFromContextualType(node); - } + else if (ts.isCaseOrDefaultClause(node.parent)) { + // Get completions from the type of the switch expression + // i.e. x === '/*completion position' + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.parent.parent.expression), typeChecker); } - function getStringLiteralCompletionEntriesFromPropertyAssignment(element) { - var type = typeChecker.getContextualType(element.parent); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/ false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } + else { + var argumentInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); + if (argumentInfo) { + // Get string literal completions from specialized signatures of the target + // i.e. declare function f(a: 'A'); + // f("/*completion position*/") + return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker); } + // Get completion for string literal from string literal type + // i.e. var x: "hi" | "hello" = "/*completion position*/" + return getStringLiteralCompletionEntriesFromType(typeChecker.getContextualType(node), typeChecker); } - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) { - var candidates = []; - var entries = []; - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); - for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { - var candidate = candidates_3[_i]; - if (candidate.parameters.length > argumentInfo.argumentIndex) { - var parameter = candidate.parameters[argumentInfo.argumentIndex]; - addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries); - } + } + function getStringLiteralCompletionEntriesFromPropertyAssignment(element, typeChecker, target, log) { + var type = typeChecker.getContextualType(element.parent); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/ false, typeChecker, target, log); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; } + } + } + function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker) { + var candidates = []; + var entries = []; + typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); + for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { + var candidate = candidates_3[_i]; + addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries, typeChecker); + } + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; + } + return undefined; + } + function getStringLiteralCompletionEntriesFromElementAccess(node, typeChecker, target, log) { + var type = typeChecker.getTypeAtLocation(node.expression); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/ false, typeChecker, target, log); if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; } - return undefined; } - function getStringLiteralCompletionEntriesFromElementAccess(node) { - var type = typeChecker.getTypeAtLocation(node.expression); + return undefined; + } + function getStringLiteralCompletionEntriesFromType(type, typeChecker) { + if (type) { var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/ false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } + addStringLiteralCompletionsFromType(type, entries, typeChecker); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; } - return undefined; } - function getStringLiteralCompletionEntriesFromContextualType(node) { - var type = typeChecker.getContextualType(node); - if (type) { - var entries_2 = []; - addStringLiteralCompletionsFromType(type, entries_2); - if (entries_2.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 }; - } - } - return undefined; + return undefined; + } + function addStringLiteralCompletionsFromType(type, result, typeChecker) { + if (type && type.flags & 16384 /* TypeParameter */) { + type = typeChecker.getApparentType(type); } - function addStringLiteralCompletionsFromType(type, result) { - if (type && type.flags & 16384 /* TypeParameter */) { - type = typeChecker.getApparentType(type); - } - if (!type) { - return; - } - if (type.flags & 65536 /* Union */) { - ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); }); - } - else { - if (type.flags & 32 /* StringLiteral */) { - result.push({ - name: type.text, - kindModifiers: ts.ScriptElementKindModifier.none, - kind: ts.ScriptElementKind.variableElement, - sortText: "0" - }); - } + if (!type) { + return; + } + if (type.flags & 65536 /* Union */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + addStringLiteralCompletionsFromType(t, result, typeChecker); } } - function getStringLiteralCompletionEntriesFromModuleNames(node) { - var literalValue = ts.normalizeSlashes(node.text); - var scriptPath = node.getSourceFile().path; - var scriptDirectory = ts.getDirectoryPath(scriptPath); - var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); - var entries; - if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { - if (compilerOptions.rootDirs) { - entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath); - } - else { - entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath); - } + else if (type.flags & 32 /* StringLiteral */) { + result.push({ + name: type.text, + kindModifiers: ts.ScriptElementKindModifier.none, + kind: ts.ScriptElementKind.variableElement, + sortText: "0" + }); + } + } + function getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker) { + var literalValue = ts.normalizeSlashes(node.text); + var scriptPath = node.getSourceFile().path; + var scriptDirectory = ts.getDirectoryPath(scriptPath); + var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); + var entries; + if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { + var extensions = ts.getSupportedExtensions(compilerOptions); + if (compilerOptions.rootDirs) { + entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, extensions, /*includeExtensions*/ false, span, compilerOptions, host, scriptPath); } else { - // Check for node modules - entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span); + entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensions, /*includeExtensions*/ false, span, host, scriptPath); } - return { - isGlobalCompletion: false, - isMemberCompletion: false, - isNewIdentifierLocation: true, - entries: entries - }; } - /** - * Takes a script path and returns paths for all potential folders that could be merged with its - * containing folder via the "rootDirs" compiler option - */ - function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { - // Make all paths absolute/normalized if they are not already - rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); - // Determine the path to the directory containing the script relative to the root directory it is contained within - var relativeDirectory; - for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) { - var rootDirectory = rootDirs_1[_i]; - if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { - relativeDirectory = scriptPath.substr(rootDirectory.length); - break; - } - } - // Now find a path for each potential directory that is to be merged with the one containing the script - return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); + else { + // Check for node modules + entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span, compilerOptions, host, typeChecker); } - function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) { - var basePath = compilerOptions.project || host.getCurrentDirectory(); - var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); - var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); - var result = []; - for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { - var baseDirectory = baseDirectories_1[_i]; - getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result); + return { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: true, + entries: entries + }; + } + /** + * Takes a script path and returns paths for all potential folders that could be merged with its + * containing folder via the "rootDirs" compiler option + */ + function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { + // Make all paths absolute/normalized if they are not already + rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); + // Determine the path to the directory containing the script relative to the root directory it is contained within + var relativeDirectory; + for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) { + var rootDirectory = rootDirs_1[_i]; + if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { + relativeDirectory = scriptPath.substr(rootDirectory.length); + break; } - return result; } + // Now find a path for each potential directory that is to be merged with the one containing the script + return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); + } + function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, compilerOptions, host, exclude) { + var basePath = compilerOptions.project || host.getCurrentDirectory(); + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); + var result = []; + for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { + var baseDirectory = baseDirectories_1[_i]; + getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, host, exclude, result); + } + return result; + } + /** + * Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename. + */ + function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, host, exclude, result) { + if (result === void 0) { result = []; } + if (fragment === undefined) { + fragment = ""; + } + fragment = ts.normalizeSlashes(fragment); /** - * Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename. + * Remove the basename from the path. Note that we don't use the basename to filter completions; + * the client is responsible for refining completions. */ - function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) { - if (result === void 0) { result = []; } - if (fragment === undefined) { - fragment = ""; - } - fragment = ts.normalizeSlashes(fragment); - /** - * Remove the basename from the path. Note that we don't use the basename to filter completions; - * the client is responsible for refining completions. - */ - fragment = ts.getDirectoryPath(fragment); - if (fragment === "") { - fragment = "." + ts.directorySeparator; - } - fragment = ts.ensureTrailingDirectorySeparator(fragment); - var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment)); - var baseDirectory = ts.getDirectoryPath(absolutePath); - var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); - if (tryDirectoryExists(host, baseDirectory)) { - // Enumerate the available files if possible - var files = tryReadDirectory(host, baseDirectory, extensions, /*exclude*/ undefined, /*include*/ ["./*"]); - if (files) { - /** - * Multiple file entries might map to the same truncated name once we remove extensions - * (happens iff includeExtensions === false)so we use a set-like data structure. Eg: - * - * both foo.ts and foo.tsx become foo - */ - var foundFiles = ts.createMap(); - for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { - var filePath = files_3[_i]; - filePath = ts.normalizePath(filePath); - if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0 /* EqualTo */) { - continue; - } - var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); - if (!foundFiles[foundFileName]) { - foundFiles[foundFileName] = true; - } + fragment = ts.getDirectoryPath(fragment); + if (fragment === "") { + fragment = "." + ts.directorySeparator; + } + fragment = ts.ensureTrailingDirectorySeparator(fragment); + var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment)); + var baseDirectory = ts.getDirectoryPath(absolutePath); + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + if (tryDirectoryExists(host, baseDirectory)) { + // Enumerate the available files if possible + var files = tryReadDirectory(host, baseDirectory, extensions, /*exclude*/ undefined, /*include*/ ["./*"]); + if (files) { + /** + * Multiple file entries might map to the same truncated name once we remove extensions + * (happens iff includeExtensions === false)so we use a set-like data structure. Eg: + * + * both foo.ts and foo.tsx become foo + */ + var foundFiles = ts.createMap(); + for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { + var filePath = files_3[_i]; + filePath = ts.normalizePath(filePath); + if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0 /* EqualTo */) { + continue; } - for (var foundFile in foundFiles) { - result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); + var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); + if (!foundFiles.get(foundFileName)) { + foundFiles.set(foundFileName, true); } } - // If possible, get folder completion as well - var directories = tryGetDirectories(host, baseDirectory); - if (directories) { - for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) { - var directory = directories_2[_a]; - var directoryName = ts.getBaseFileName(ts.normalizePath(directory)); - result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span)); - } + ts.forEachKey(foundFiles, function (foundFile) { + result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); + }); + } + // If possible, get folder completion as well + var directories = tryGetDirectories(host, baseDirectory); + if (directories) { + for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) { + var directory = directories_2[_a]; + var directoryName = ts.getBaseFileName(ts.normalizePath(directory)); + result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span)); } } - return result; } - /** - * Check all of the declared modules and those in node modules. Possible sources of modules: - * Modules that are found by the type checker - * Modules found relative to "baseUrl" compliler options (including patterns from "paths" compiler option) - * Modules from node_modules (i.e. those listed in package.json) - * This includes all files that are found in node_modules/moduleName/ with acceptable file extensions - */ - function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) { - var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; - var result; - if (baseUrl) { - var fileExtensions = ts.getSupportedExtensions(compilerOptions); - var projectDir = compilerOptions.project || host.getCurrentDirectory(); - var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); - result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, /*includeExtensions*/ false, span); - if (paths) { - for (var path in paths) { - if (paths.hasOwnProperty(path)) { - if (path === "*") { - if (paths[path]) { - for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { - var pattern = _a[_i]; - for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) { - var match = _c[_b]; - result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); - } + return result; + } + /** + * Check all of the declared modules and those in node modules. Possible sources of modules: + * Modules that are found by the type checker + * Modules found relative to "baseUrl" compliler options (including patterns from "paths" compiler option) + * Modules from node_modules (i.e. those listed in package.json) + * This includes all files that are found in node_modules/moduleName/ with acceptable file extensions + */ + function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span, compilerOptions, host, typeChecker) { + var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; + var result; + if (baseUrl) { + var fileExtensions = ts.getSupportedExtensions(compilerOptions); + var projectDir = compilerOptions.project || host.getCurrentDirectory(); + var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); + result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, /*includeExtensions*/ false, span, host); + if (paths) { + for (var path in paths) { + if (paths.hasOwnProperty(path)) { + if (path === "*") { + if (paths[path]) { + for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { + var pattern = _a[_i]; + for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host); _b < _c.length; _b++) { + var match = _c[_b]; + result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); } } } - else if (ts.startsWith(path, fragment)) { - var entry = paths[path] && paths[path].length === 1 && paths[path][0]; - if (entry) { - result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span)); - } + } + else if (ts.startsWith(path, fragment)) { + var entry = paths[path] && paths[path].length === 1 && paths[path][0]; + if (entry) { + result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span)); } } } } } - else { - result = []; - } - getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); - for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) { - var moduleName = _e[_d]; - result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); - } - return result; } - function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) { - if (host.readDirectory) { - var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; - if (parsed) { - // The prefix has two effective parts: the directory path and the base component after the filepath that is not a - // full directory component. For example: directory/path/of/prefix/base* - var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix); - var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix); - var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix); - var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1; - // Try and expand the prefix to include any path from the fragment so that we can limit the readDirectory call - var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory; - var normalizedSuffix = ts.normalizePath(parsed.suffix); - var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory); - var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; - // If we have a suffix, then we need to read the directory all the way down. We could create a glob - // that encodes the suffix, but we would have to escape the character "?" which readDirectory - // doesn't support. For now, this is safer but slower - var includeGlob = normalizedSuffix ? "**/*" : "./*"; - var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); - if (matches) { - var result = []; - // Trim away prefix and suffix - for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { - var match = matches_1[_i]; - var normalizedMatch = ts.normalizePath(match); - if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) { - continue; - } - var start = completePrefix.length; - var length_5 = normalizedMatch.length - start - normalizedSuffix.length; - result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); + else { + result = []; + } + getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); + for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host); _d < _e.length; _d++) { + var moduleName = _e[_d]; + result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); + } + return result; + } + function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) { + if (host.readDirectory) { + var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; + if (parsed) { + // The prefix has two effective parts: the directory path and the base component after the filepath that is not a + // full directory component. For example: directory/path/of/prefix/base* + var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix); + var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix); + var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix); + var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1; + // Try and expand the prefix to include any path from the fragment so that we can limit the readDirectory call + var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory; + var normalizedSuffix = ts.normalizePath(parsed.suffix); + var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory); + var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; + // If we have a suffix, then we need to read the directory all the way down. We could create a glob + // that encodes the suffix, but we would have to escape the character "?" which readDirectory + // doesn't support. For now, this is safer but slower + var includeGlob = normalizedSuffix ? "**/*" : "./*"; + var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); + if (matches) { + var result = []; + // Trim away prefix and suffix + for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { + var match = matches_1[_i]; + var normalizedMatch = ts.normalizePath(match); + if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) { + continue; } - return result; + var start = completePrefix.length; + var length_5 = normalizedMatch.length - start - normalizedSuffix.length; + result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); } + return result; } } - return undefined; } - function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) { - // Check If this is a nested module - var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; - var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; - // Get modules that the type checker picked up - var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); }); - var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); }); - // Nested modules of the form "module-name/sub" need to be adjusted to only return the string - // after the last '/' that appears in the fragment because that's where the replacement span - // starts - if (isNestedModule) { - var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment); - nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) { - if (ts.startsWith(fragment, moduleNameWithSeperator_1)) { - return moduleName.substr(moduleNameWithSeperator_1.length); - } - return moduleName; - }); - } - if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) { - for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) { - var visibleModule = _a[_i]; - if (!isNestedModule) { - nonRelativeModules.push(visibleModule.moduleName); - } - else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) { - var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, /*exclude*/ undefined, /*include*/ ["./*"]); - if (nestedFiles) { - for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) { - var f = nestedFiles_1[_b]; - f = ts.normalizePath(f); - var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f)); - nonRelativeModules.push(nestedModule); - } + return undefined; + } + function enumeratePotentialNonRelativeModules(fragment, scriptPath, options, typeChecker, host) { + // Check If this is a nested module + var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; + var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; + // Get modules that the type checker picked up + var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); }); + var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); }); + // Nested modules of the form "module-name/sub" need to be adjusted to only return the string + // after the last '/' that appears in the fragment because that's where the replacement span + // starts + if (isNestedModule) { + var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment); + nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) { + if (ts.startsWith(fragment, moduleNameWithSeperator_1)) { + return moduleName.substr(moduleNameWithSeperator_1.length); + } + return moduleName; + }); + } + if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) { + for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) { + var visibleModule = _a[_i]; + if (!isNestedModule) { + nonRelativeModules.push(visibleModule.moduleName); + } + else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) { + var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, /*exclude*/ undefined, /*include*/ ["./*"]); + if (nestedFiles) { + for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) { + var f = nestedFiles_1[_b]; + f = ts.normalizePath(f); + var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f)); + nonRelativeModules.push(nestedModule); } } } } - return ts.deduplicate(nonRelativeModules); } - function getTripleSlashReferenceCompletion(sourceFile, position) { - var token = ts.getTokenAtPosition(sourceFile, position); - if (!token) { - return undefined; - } - var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); - if (!commentRanges || !commentRanges.length) { - return undefined; + return ts.deduplicate(nonRelativeModules); + } + function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) { + var token = ts.getTokenAtPosition(sourceFile, position); + if (!token) { + return undefined; + } + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + if (!commentRanges || !commentRanges.length) { + return undefined; + } + var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; }); + if (!range) { + return undefined; + } + var completionInfo = { + /** + * We don't want the editor to offer any other completions, such as snippets, inside a comment. + */ + isGlobalCompletion: false, + isMemberCompletion: false, + /** + * The user may type in a path that doesn't yet exist, creating a "new identifier" + * with respect to the collection of identifiers the server is aware of. + */ + isNewIdentifierLocation: true, + entries: [] + }; + var text = sourceFile.text.substr(range.pos, position - range.pos); + var match = tripleSlashDirectiveFragmentRegex.exec(text); + if (match) { + var prefix = match[1]; + var kind = match[2]; + var toComplete = match[3]; + var scriptPath = ts.getDirectoryPath(sourceFile.path); + if (kind === "path") { + // Give completions for a relative path + var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); + completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ true, span_10, host, sourceFile.path); } - var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; }); - if (!range) { - return undefined; + else { + // Give completions based on the typings available + var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; + completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11); } - var completionInfo = { - /** - * We don't want the editor to offer any other completions, such as snippets, inside a comment. - */ - isGlobalCompletion: false, - isMemberCompletion: false, - /** - * The user may type in a path that doesn't yet exist, creating a "new identifier" - * with respect to the collection of identifiers the server is aware of. - */ - isNewIdentifierLocation: true, - entries: [] - }; - var text = sourceFile.text.substr(range.pos, position - range.pos); - var match = tripleSlashDirectiveFragmentRegex.exec(text); - if (match) { - var prefix = match[1]; - var kind = match[2]; - var toComplete = match[3]; - var scriptPath = ts.getDirectoryPath(sourceFile.path); - if (kind === "path") { - // Give completions for a relative path - var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); - completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ true, span_10, sourceFile.path); - } - else { - // Give completions based on the typings available - var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; - completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11); - } + } + return completionInfo; + } + function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { + if (result === void 0) { result = []; } + // Check for typings specified in compiler options + if (options.types) { + for (var _i = 0, _a = options.types; _i < _a.length; _i++) { + var moduleName = _a[_i]; + result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); } - return completionInfo; } - function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { - if (result === void 0) { result = []; } - // Check for typings specified in compiler options - if (options.types) { - for (var _i = 0, _a = options.types; _i < _a.length; _i++) { - var moduleName = _a[_i]; - result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); - } + else if (host.getDirectories) { + var typeRoots = void 0; + try { + // Wrap in try catch because getEffectiveTypeRoots touches the filesystem + typeRoots = ts.getEffectiveTypeRoots(options, host); } - else if (host.getDirectories) { - var typeRoots = void 0; - try { - // Wrap in try catch because getEffectiveTypeRoots touches the filesystem - typeRoots = ts.getEffectiveTypeRoots(options, host); - } - catch (e) { } - if (typeRoots) { - for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) { - var root = typeRoots_2[_b]; - getCompletionEntriesFromDirectories(host, root, span, result); - } + catch (e) { } + if (typeRoots) { + for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) { + var root = typeRoots_2[_b]; + getCompletionEntriesFromDirectories(host, root, span, result); } } - if (host.getDirectories) { - // Also get all @types typings installed in visible node_modules directories - for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) { - var packageJson = _d[_c]; - var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); - getCompletionEntriesFromDirectories(host, typesDir, span, result); - } + } + if (host.getDirectories) { + // Also get all @types typings installed in visible node_modules directories + for (var _c = 0, _d = findPackageJsons(scriptPath, host); _c < _d.length; _c++) { + var packageJson = _d[_c]; + var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); + getCompletionEntriesFromDirectories(host, typesDir, span, result); } - return result; } - function getCompletionEntriesFromDirectories(host, directory, span, result) { - if (host.getDirectories && tryDirectoryExists(host, directory)) { - var directories = tryGetDirectories(host, directory); - if (directories) { - for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) { - var typeDirectory = directories_3[_i]; - typeDirectory = ts.normalizePath(typeDirectory); - result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span)); - } + return result; + } + function getCompletionEntriesFromDirectories(host, directory, span, result) { + if (host.getDirectories && tryDirectoryExists(host, directory)) { + var directories = tryGetDirectories(host, directory); + if (directories) { + for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) { + var typeDirectory = directories_3[_i]; + typeDirectory = ts.normalizePath(typeDirectory); + result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span)); } } } - function findPackageJsons(currentDir) { - var paths = []; - var currentConfigPath; - while (true) { - currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, "package.json"); - if (currentConfigPath) { - paths.push(currentConfigPath); - currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_14 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_14) { - break; - } - currentDir = parent_14; - } - else { + } + function findPackageJsons(currentDir, host) { + var paths = []; + var currentConfigPath; + while (true) { + currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, "package.json"); + if (currentConfigPath) { + paths.push(currentConfigPath); + currentDir = ts.getDirectoryPath(currentConfigPath); + var parent = ts.getDirectoryPath(currentDir); + if (currentDir === parent) { break; } + currentDir = parent; } - return paths; - } - function enumerateNodeModulesVisibleToScript(host, scriptPath) { - var result = []; - if (host.readFile && host.fileExists) { - for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) { - var packageJson = _a[_i]; - var contents = tryReadingPackageJson(packageJson); - if (!contents) { - return; - } - var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules"); - var foundModuleNames = []; - // Provide completions for all non @types dependencies - for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) { - var key = nodeModulesDependencyKeys_1[_b]; - addPotentialPackageNames(contents[key], foundModuleNames); - } - for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) { - var moduleName = foundModuleNames_1[_c]; - var moduleDir = ts.combinePaths(nodeModulesDir, moduleName); - result.push({ - moduleName: moduleName, - moduleDir: moduleDir - }); - } - } + else { + break; } - return result; - function tryReadingPackageJson(filePath) { - try { - var fileText = tryReadFile(host, filePath); - return fileText ? JSON.parse(fileText) : undefined; + } + return paths; + } + function enumerateNodeModulesVisibleToScript(host, scriptPath) { + var result = []; + if (host.readFile && host.fileExists) { + for (var _i = 0, _a = findPackageJsons(scriptPath, host); _i < _a.length; _i++) { + var packageJson = _a[_i]; + var contents = tryReadingPackageJson(packageJson); + if (!contents) { + return; } - catch (e) { - return undefined; + var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules"); + var foundModuleNames = []; + // Provide completions for all non @types dependencies + for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) { + var key = nodeModulesDependencyKeys_1[_b]; + addPotentialPackageNames(contents[key], foundModuleNames); } - } - function addPotentialPackageNames(dependencies, result) { - if (dependencies) { - for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { - result.push(dep); - } - } + for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) { + var moduleName = foundModuleNames_1[_c]; + var moduleDir = ts.combinePaths(nodeModulesDir, moduleName); + result.push({ + moduleName: moduleName, + moduleDir: moduleDir + }); } } } - function createCompletionEntryForModule(name, kind, replacementSpan) { - return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan }; - } - // Replace everything after the last directory seperator that appears - function getDirectoryFragmentTextSpan(text, textStart) { - var index = text.lastIndexOf(ts.directorySeparator); - var offset = index !== -1 ? index + 1 : 0; - return { start: textStart + offset, length: text.length - offset }; + return result; + function tryReadingPackageJson(filePath) { + try { + var fileText = tryReadFile(host, filePath); + return fileText ? JSON.parse(fileText) : undefined; + } + catch (e) { + return undefined; + } } - // Returns true if the path is explicitly relative to the script (i.e. relative to . or ..) - function isPathRelativeToScript(path) { - if (path && path.length >= 2 && path.charCodeAt(0) === 46 /* dot */) { - var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 /* dot */ ? 2 : 1; - var slashCharCode = path.charCodeAt(slashIndex); - return slashCharCode === 47 /* slash */ || slashCharCode === 92 /* backslash */; + function addPotentialPackageNames(dependencies, result) { + if (dependencies) { + for (var dep in dependencies) { + if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + result.push(dep); + } + } } - return false; } - function normalizeAndPreserveTrailingSlash(path) { - return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); + } + function createCompletionEntryForModule(name, kind, replacementSpan) { + return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan }; + } + // Replace everything after the last directory seperator that appears + function getDirectoryFragmentTextSpan(text, textStart) { + var index = text.lastIndexOf(ts.directorySeparator); + var offset = index !== -1 ? index + 1 : 0; + return { start: textStart + offset, length: text.length - offset }; + } + // Returns true if the path is explicitly relative to the script (i.e. relative to . or ..) + function isPathRelativeToScript(path) { + if (path && path.length >= 2 && path.charCodeAt(0) === 46 /* dot */) { + var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 /* dot */ ? 2 : 1; + var slashCharCode = path.charCodeAt(slashIndex); + return slashCharCode === 47 /* slash */ || slashCharCode === 92 /* backslash */; } + return false; + } + function normalizeAndPreserveTrailingSlash(path) { + return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); } - Completions.getCompletionsAtPosition = getCompletionsAtPosition; function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) { // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_3 = completionData.location; + var symbols = completionData.symbols, location_1 = completionData.location; // Find the symbol with the matching entry name. // 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(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; }); + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_1) === entryName ? s : undefined; }); if (symbol) { - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_1, location_1, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { name: entryName, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), @@ -68764,12 +69078,12 @@ var ts; // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_4 = completionData.location; + var symbols = completionData.symbols, location_2 = completionData.location; // Find the symbol with the matching entry name. // 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. - return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_4) === entryName ? s : undefined; }); + return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_2) === entryName ? s : undefined; }); } return undefined; } @@ -68800,9 +69114,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 284 /* JSDocTypeTag */: - case 282 /* JSDocParameterTag */: - case 283 /* JSDocReturnTag */: + case 285 /* JSDocTypeTag */: + case 283 /* JSDocParameterTag */: + case 284 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -68847,13 +69161,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_15 = contextToken.parent, kind = contextToken.kind; + var parent = contextToken.parent, kind = contextToken.kind; if (kind === 22 /* DotToken */) { - if (parent_15.kind === 177 /* PropertyAccessExpression */) { + if (parent.kind === 178 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_15.kind === 141 /* QualifiedName */) { + else if (parent.kind === 142 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -68868,7 +69182,7 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 250 /* JsxClosingElement */) { + else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 251 /* JsxClosingElement */) { isStartingCloseTag = true; location = contextToken; } @@ -68917,7 +69231,7 @@ var ts; isGlobalCompletion = false; isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */) { + if (node.kind === 70 /* Identifier */ || node.kind === 142 /* QualifiedName */ || node.kind === 178 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -68973,7 +69287,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 248 /* JsxSelfClosingElement */) || (jsxContainer.kind === 249 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 249 /* JsxSelfClosingElement */) || (jsxContainer.kind === 250 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -69021,9 +69335,9 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 262 /* SourceFile */ || - scopeNode.kind === 194 /* TemplateExpression */ || - scopeNode.kind === 253 /* JsxExpression */ || + scopeNode.kind === 263 /* SourceFile */ || + scopeNode.kind === 195 /* TemplateExpression */ || + scopeNode.kind === 254 /* JsxExpression */ || ts.isStatement(scopeNode); } /// TODO filter meaning based on the current context @@ -69056,11 +69370,11 @@ var ts; return true; } if (contextToken.kind === 28 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 249 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 250 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 250 /* JsxClosingElement */ || contextToken.parent.kind === 248 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 247 /* JsxElement */; + if (contextToken.parent.kind === 251 /* JsxClosingElement */ || contextToken.parent.kind === 249 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 248 /* JsxElement */; } } return false; @@ -69070,40 +69384,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 25 /* CommaToken */: - return containingNodeKind === 179 /* CallExpression */ // func( a, | - || containingNodeKind === 150 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 180 /* NewExpression */ // new C(a, | - || containingNodeKind === 175 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 192 /* BinaryExpression */ // const x = (a, | - || containingNodeKind === 158 /* FunctionType */; // var x: (s: string, list| + return containingNodeKind === 180 /* CallExpression */ // func( a, | + || containingNodeKind === 151 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 181 /* NewExpression */ // new C(a, | + || containingNodeKind === 176 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 193 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 159 /* FunctionType */; // var x: (s: string, list| case 18 /* OpenParenToken */: - return containingNodeKind === 179 /* CallExpression */ // func( | - || containingNodeKind === 150 /* Constructor */ // constructor( | - || containingNodeKind === 180 /* NewExpression */ // new C(a| - || containingNodeKind === 183 /* ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 166 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 180 /* CallExpression */ // func( | + || containingNodeKind === 151 /* Constructor */ // constructor( | + || containingNodeKind === 181 /* NewExpression */ // new C(a| + || containingNodeKind === 184 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 167 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 20 /* OpenBracketToken */: - return containingNodeKind === 175 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 155 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 142 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + return containingNodeKind === 176 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 156 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 143 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 127 /* ModuleKeyword */: // module | case 128 /* NamespaceKeyword */: return true; case 22 /* DotToken */: - return containingNodeKind === 231 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 232 /* ModuleDeclaration */; // module A.| case 16 /* OpenBraceToken */: - return containingNodeKind === 227 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 228 /* ClassDeclaration */; // class A{ | case 57 /* EqualsToken */: - return containingNodeKind === 224 /* VariableDeclaration */ // const x = a| - || containingNodeKind === 192 /* BinaryExpression */; // x = a| + return containingNodeKind === 225 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 193 /* BinaryExpression */; // x = a| case 13 /* TemplateHead */: - return containingNodeKind === 194 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 195 /* TemplateExpression */; // `aa ${| case 14 /* TemplateMiddle */: - return containingNodeKind === 203 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 204 /* TemplateSpan */; // `aa ${10} dd ${| case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: - return containingNodeKind === 147 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 148 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -69146,7 +69460,7 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 176 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 177 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; @@ -69156,7 +69470,7 @@ var ts; typeForObject = typeForObject && typeForObject.getNonNullableType(); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 172 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 173 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -69167,11 +69481,11 @@ var ts; // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); - if (!canGetType && rootDeclaration.kind === 144 /* Parameter */) { + if (!canGetType && rootDeclaration.kind === 145 /* Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 149 /* MethodDeclaration */ || rootDeclaration.parent.kind === 152 /* SetAccessor */) { + else if (rootDeclaration.parent.kind === 150 /* MethodDeclaration */ || rootDeclaration.parent.kind === 153 /* SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -69213,9 +69527,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 239 /* NamedImports */ ? - 236 /* ImportDeclaration */ : - 242 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 240 /* NamedImports */ ? + 237 /* ImportDeclaration */ : + 243 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -69223,12 +69537,13 @@ var ts; } isMemberCompletion = true; isNewIdentifierLocation = false; - var exports; - var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier); - if (moduleSpecifierSymbol) { - exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol); + var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); + if (!moduleSpecifierSymbol) { + symbols = ts.emptyArray; + return true; } - symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : ts.emptyArray; + var exports = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol); + symbols = filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements); return true; } /** @@ -69240,9 +69555,9 @@ var ts; switch (contextToken.kind) { case 16 /* OpenBraceToken */: // const x = { | case 25 /* CommaToken */: - var parent_16 = contextToken.parent; - if (parent_16 && (parent_16.kind === 176 /* ObjectLiteralExpression */ || parent_16.kind === 172 /* ObjectBindingPattern */)) { - return parent_16; + var parent = contextToken.parent; + if (parent && (parent.kind === 177 /* ObjectLiteralExpression */ || parent.kind === 173 /* ObjectBindingPattern */)) { + return parent; } break; } @@ -69259,8 +69574,8 @@ var ts; case 16 /* OpenBraceToken */: // import { | case 25 /* CommaToken */: switch (contextToken.parent.kind) { - case 239 /* NamedImports */: - case 243 /* NamedExports */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: return contextToken.parent; } } @@ -69269,37 +69584,37 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_17 = contextToken.parent; + var parent = contextToken.parent; switch (contextToken.kind) { case 27 /* LessThanSlashToken */: case 40 /* SlashToken */: case 70 /* Identifier */: - case 251 /* JsxAttribute */: - case 252 /* JsxSpreadAttribute */: - if (parent_17 && (parent_17.kind === 248 /* JsxSelfClosingElement */ || parent_17.kind === 249 /* JsxOpeningElement */)) { - return parent_17; + case 252 /* JsxAttribute */: + case 253 /* JsxSpreadAttribute */: + if (parent && (parent.kind === 249 /* JsxSelfClosingElement */ || parent.kind === 250 /* JsxOpeningElement */)) { + return parent; } - else if (parent_17.kind === 251 /* JsxAttribute */) { - return parent_17.parent; + else if (parent.kind === 252 /* JsxAttribute */) { + return parent.parent; } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_17 && ((parent_17.kind === 251 /* JsxAttribute */) || (parent_17.kind === 252 /* JsxSpreadAttribute */))) { - return parent_17.parent; + if (parent && ((parent.kind === 252 /* JsxAttribute */) || (parent.kind === 253 /* JsxSpreadAttribute */))) { + return parent.parent; } break; case 17 /* CloseBraceToken */: - if (parent_17 && - parent_17.kind === 253 /* JsxExpression */ && - parent_17.parent && - (parent_17.parent.kind === 251 /* JsxAttribute */)) { - return parent_17.parent.parent; + if (parent && + parent.kind === 254 /* JsxExpression */ && + parent.parent && + (parent.parent.kind === 252 /* JsxAttribute */)) { + return parent.parent.parent; } - if (parent_17 && parent_17.kind === 252 /* JsxSpreadAttribute */) { - return parent_17.parent; + if (parent && parent.kind === 253 /* JsxSpreadAttribute */) { + return parent.parent; } break; } @@ -69308,16 +69623,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: return true; } return false; @@ -69329,66 +69644,66 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 25 /* CommaToken */: - return containingNodeKind === 224 /* VariableDeclaration */ || - containingNodeKind === 225 /* VariableDeclarationList */ || - containingNodeKind === 206 /* VariableStatement */ || - containingNodeKind === 230 /* EnumDeclaration */ || + return containingNodeKind === 225 /* VariableDeclaration */ || + containingNodeKind === 226 /* VariableDeclarationList */ || + containingNodeKind === 207 /* VariableStatement */ || + containingNodeKind === 231 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 227 /* ClassDeclaration */ || - containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 228 /* InterfaceDeclaration */ || - containingNodeKind === 173 /* ArrayBindingPattern */ || - containingNodeKind === 229 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 228 /* ClassDeclaration */ || + containingNodeKind === 198 /* ClassExpression */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 174 /* ArrayBindingPattern */ || + containingNodeKind === 230 /* TypeAliasDeclaration */; // type Map, K, | case 22 /* DotToken */: - return containingNodeKind === 173 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 174 /* ArrayBindingPattern */; // var [.| case 55 /* ColonToken */: - return containingNodeKind === 174 /* BindingElement */; // var {x :html| + return containingNodeKind === 175 /* BindingElement */; // var {x :html| case 20 /* OpenBracketToken */: - return containingNodeKind === 173 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 174 /* ArrayBindingPattern */; // var [x| case 18 /* OpenParenToken */: - return containingNodeKind === 257 /* CatchClause */ || + return containingNodeKind === 258 /* CatchClause */ || isFunction(containingNodeKind); case 16 /* OpenBraceToken */: - return containingNodeKind === 230 /* EnumDeclaration */ || - containingNodeKind === 228 /* InterfaceDeclaration */ || - containingNodeKind === 161 /* TypeLiteral */; // const x : { | + return containingNodeKind === 231 /* EnumDeclaration */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 162 /* TypeLiteral */; // const x : { | case 24 /* SemicolonToken */: - return containingNodeKind === 146 /* PropertySignature */ && + return containingNodeKind === 147 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 228 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 161 /* TypeLiteral */); // const x : { a; | + (contextToken.parent.parent.kind === 229 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 162 /* TypeLiteral */); // const x : { a; | case 26 /* LessThanToken */: - return containingNodeKind === 227 /* ClassDeclaration */ || - containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 228 /* InterfaceDeclaration */ || - containingNodeKind === 229 /* TypeAliasDeclaration */ || + return containingNodeKind === 228 /* ClassDeclaration */ || + containingNodeKind === 198 /* ClassExpression */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 230 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); case 114 /* StaticKeyword */: - return containingNodeKind === 147 /* PropertyDeclaration */; + return containingNodeKind === 148 /* PropertyDeclaration */; case 23 /* DotDotDotToken */: - return containingNodeKind === 144 /* Parameter */ || + return containingNodeKind === 145 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 173 /* ArrayBindingPattern */); // var [...z| + contextToken.parent.parent.kind === 174 /* ArrayBindingPattern */); // var [...z| case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: - return containingNodeKind === 144 /* Parameter */; + return containingNodeKind === 145 /* Parameter */; case 117 /* AsKeyword */: - return containingNodeKind === 240 /* ImportSpecifier */ || - containingNodeKind === 244 /* ExportSpecifier */ || - containingNodeKind === 238 /* NamespaceImport */; + return containingNodeKind === 241 /* ImportSpecifier */ || + containingNodeKind === 245 /* ExportSpecifier */ || + containingNodeKind === 239 /* NamespaceImport */; case 74 /* ClassKeyword */: case 82 /* EnumKeyword */: case 108 /* InterfaceKeyword */: case 88 /* FunctionKeyword */: case 103 /* VarKeyword */: case 124 /* GetKeyword */: - case 133 /* SetKeyword */: + case 134 /* SetKeyword */: case 90 /* ImportKeyword */: case 109 /* LetKeyword */: case 75 /* ConstKeyword */: case 115 /* YieldKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -69436,13 +69751,13 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_46 = element.propertyName || element.name; - existingImportsOrExports[name_46.text] = true; + var name = element.propertyName || element.name; + existingImportsOrExports.set(name.text, true); } - if (!ts.someProperties(existingImportsOrExports)) { + if (existingImportsOrExports.size === 0) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); } - return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports[e.name]; }); + return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports.get(e.name); }); } /** * Filters out completion suggestions for named imports or exports. @@ -69458,12 +69773,12 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 258 /* PropertyAssignment */ && - m.kind !== 259 /* ShorthandPropertyAssignment */ && - m.kind !== 174 /* BindingElement */ && - m.kind !== 149 /* MethodDeclaration */ && - m.kind !== 151 /* GetAccessor */ && - m.kind !== 152 /* SetAccessor */) { + if (m.kind !== 259 /* PropertyAssignment */ && + m.kind !== 260 /* ShorthandPropertyAssignment */ && + m.kind !== 175 /* BindingElement */ && + m.kind !== 150 /* MethodDeclaration */ && + m.kind !== 152 /* GetAccessor */ && + m.kind !== 153 /* SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -69471,7 +69786,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 174 /* BindingElement */ && m.propertyName) { + if (m.kind === 175 /* BindingElement */ && m.propertyName) { // include only identifiers in completion list if (m.propertyName.kind === 70 /* Identifier */) { existingName = m.propertyName.text; @@ -69483,9 +69798,9 @@ var ts; // things like '__proto__' are not filtered out. existingName = m.name.text; } - existingMemberNames[existingName] = true; + existingMemberNames.set(existingName, true); } - return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; }); + return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames.get(m.name); }); } /** * Filters out completion suggestions from 'symbols' according to existing JSX attributes. @@ -69501,11 +69816,11 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 251 /* JsxAttribute */) { - seenNames[attr.name.text] = true; + if (attr.kind === 252 /* JsxAttribute */) { + seenNames.set(attr.name.text, true); } } - return ts.filter(symbols, function (a) { return !seenNames[a.name]; }); + return ts.filter(symbols, function (a) { return !seenNames.get(a.name); }); } } /** @@ -69551,7 +69866,7 @@ var ts; } // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 71 /* FirstKeyword */; i <= 140 /* LastKeyword */; i++) { + for (var i = 71 /* FirstKeyword */; i <= 141 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ts.ScriptElementKind.keyword, @@ -69603,6 +69918,15 @@ var ts; catch (e) { } return undefined; } + function isEqualityExpression(node) { + return ts.isBinaryExpression(node) && isEqualityOperatorKind(node.operatorToken.kind); + } + function isEqualityOperatorKind(kind) { + return kind == 31 /* EqualsEqualsToken */ || + kind === 32 /* ExclamationEqualsToken */ || + kind === 33 /* EqualsEqualsEqualsToken */ || + kind === 34 /* ExclamationEqualsEqualsToken */; + } })(Completions = ts.Completions || (ts.Completions = {})); })(ts || (ts = {})); /* @internal */ @@ -69612,534 +69936,519 @@ var ts; (function (DocumentHighlights) { function getDocumentHighlights(typeChecker, cancellationToken, sourceFile, position, sourceFilesToSearch) { var node = ts.getTouchingWord(sourceFile, position); + return node && (getSemanticDocumentHighlights(node, typeChecker, cancellationToken, sourceFilesToSearch) || getSyntacticDocumentHighlights(node, sourceFile)); + } + DocumentHighlights.getDocumentHighlights = getDocumentHighlights; + function getHighlightSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var end = node.getEnd(); + return { + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + kind: ts.HighlightSpanKind.none + }; + } + function getSemanticDocumentHighlights(node, typeChecker, cancellationToken, sourceFilesToSearch) { + var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFilesToSearch); + return referencedSymbols && convertReferencedSymbols(referencedSymbols); + } + function convertReferencedSymbols(referencedSymbols) { + var fileNameToDocumentHighlights = ts.createMap(); + var result = []; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var referencedSymbol = referencedSymbols_1[_i]; + for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { + var referenceEntry = _b[_a]; + var fileName = referenceEntry.fileName; + var documentHighlights = fileNameToDocumentHighlights.get(fileName); + if (!documentHighlights) { + documentHighlights = { fileName: fileName, highlightSpans: [] }; + fileNameToDocumentHighlights.set(fileName, documentHighlights); + result.push(documentHighlights); + } + documentHighlights.highlightSpans.push({ + textSpan: referenceEntry.textSpan, + kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference + }); + } + } + return result; + } + function getSyntacticDocumentHighlights(node, sourceFile) { + var highlightSpans = getHighlightSpans(node, sourceFile); + if (!highlightSpans || highlightSpans.length === 0) { + return undefined; + } + return [{ fileName: sourceFile.fileName, highlightSpans: highlightSpans }]; + } + // returns true if 'node' is defined and has a matching 'kind'. + function hasKind(node, kind) { + return node !== undefined && node.kind === kind; + } + // Null-propagating 'parent' function. + function parent(node) { + return node && node.parent; + } + function getHighlightSpans(node, sourceFile) { if (!node) { return undefined; } - return getSemanticDocumentHighlights(node) || getSyntacticDocumentHighlights(node); - function getHighlightSpanForNode(node) { - var start = node.getStart(); - var end = node.getEnd(); - return { - fileName: sourceFile.fileName, - textSpan: ts.createTextSpanFromBounds(start, end), - kind: ts.HighlightSpanKind.none - }; + switch (node.kind) { + case 89 /* IfKeyword */: + case 81 /* ElseKeyword */: + if (hasKind(node.parent, 210 /* IfStatement */)) { + return getIfElseOccurrences(node.parent, sourceFile); + } + break; + case 95 /* ReturnKeyword */: + if (hasKind(node.parent, 218 /* ReturnStatement */)) { + return highlightSpans(getReturnOccurrences(node.parent)); + } + break; + case 99 /* ThrowKeyword */: + if (hasKind(node.parent, 222 /* ThrowStatement */)) { + return highlightSpans(getThrowOccurrences(node.parent)); + } + break; + case 101 /* TryKeyword */: + case 73 /* CatchKeyword */: + case 86 /* FinallyKeyword */: + var tryStatement = node.kind === 73 /* CatchKeyword */ ? parent(parent(node)) : parent(node); + if (hasKind(tryStatement, 223 /* TryStatement */)) { + return highlightSpans(getTryCatchFinallyOccurrences(tryStatement, sourceFile)); + } + break; + case 97 /* SwitchKeyword */: + if (hasKind(node.parent, 220 /* SwitchStatement */)) { + return highlightSpans(getSwitchCaseDefaultOccurrences(node.parent)); + } + break; + case 72 /* CaseKeyword */: + case 78 /* DefaultKeyword */: + if (hasKind(parent(parent(parent(node))), 220 /* SwitchStatement */)) { + return highlightSpans(getSwitchCaseDefaultOccurrences(node.parent.parent.parent)); + } + break; + case 71 /* BreakKeyword */: + case 76 /* ContinueKeyword */: + if (hasKind(node.parent, 217 /* BreakStatement */) || hasKind(node.parent, 216 /* ContinueStatement */)) { + return highlightSpans(getBreakOrContinueStatementOccurrences(node.parent)); + } + break; + case 87 /* ForKeyword */: + if (hasKind(node.parent, 213 /* ForStatement */) || + hasKind(node.parent, 214 /* ForInStatement */) || + hasKind(node.parent, 215 /* ForOfStatement */)) { + return highlightSpans(getLoopBreakContinueOccurrences(node.parent)); + } + break; + case 105 /* WhileKeyword */: + case 80 /* DoKeyword */: + if (hasKind(node.parent, 212 /* WhileStatement */) || hasKind(node.parent, 211 /* DoStatement */)) { + return highlightSpans(getLoopBreakContinueOccurrences(node.parent)); + } + break; + case 122 /* ConstructorKeyword */: + if (hasKind(node.parent, 151 /* Constructor */)) { + return highlightSpans(getConstructorOccurrences(node.parent)); + } + break; + case 124 /* GetKeyword */: + case 134 /* SetKeyword */: + if (hasKind(node.parent, 152 /* GetAccessor */) || hasKind(node.parent, 153 /* SetAccessor */)) { + return highlightSpans(getGetAndSetOccurrences(node.parent)); + } + break; + default: + if (ts.isModifierKind(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 207 /* VariableStatement */)) { + return highlightSpans(getModifierOccurrences(node.kind, node.parent)); + } } - function getSemanticDocumentHighlights(node) { - if (node.kind === 70 /* Identifier */ || - node.kind === 98 /* ThisKeyword */ || - node.kind === 167 /* ThisType */ || - node.kind === 96 /* SuperKeyword */ || - node.kind === 9 /* StringLiteral */ || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFilesToSearch, /*findInStrings*/ false, /*findInComments*/ false, /*implementations*/ false); - return convertReferencedSymbols(referencedSymbols); + function highlightSpans(nodes) { + return nodes && nodes.map(function (node) { return getHighlightSpanForNode(node, sourceFile); }); + } + } + /** + * Aggregates all throw-statements within this node *without* crossing + * into function boundaries and try-blocks with catch-clauses. + */ + function aggregateOwnedThrowStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 222 /* ThrowStatement */) { + statementAccumulator.push(node); } - return undefined; - function convertReferencedSymbols(referencedSymbols) { - if (!referencedSymbols) { - return undefined; + else if (node.kind === 223 /* TryStatement */) { + var tryStatement = node; + if (tryStatement.catchClause) { + aggregate(tryStatement.catchClause); } - var fileNameToDocumentHighlights = ts.createMap(); - var result = []; - for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { - var referencedSymbol = referencedSymbols_1[_i]; - for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { - var referenceEntry = _b[_a]; - var fileName = referenceEntry.fileName; - var documentHighlights = fileNameToDocumentHighlights[fileName]; - if (!documentHighlights) { - documentHighlights = { fileName: fileName, highlightSpans: [] }; - fileNameToDocumentHighlights[fileName] = documentHighlights; - result.push(documentHighlights); - } - documentHighlights.highlightSpans.push({ - textSpan: referenceEntry.textSpan, - kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference - }); - } + else { + // Exceptions thrown within a try block lacking a catch clause + // are "owned" in the current context. + aggregate(tryStatement.tryBlock); } - return result; + if (tryStatement.finallyBlock) { + aggregate(tryStatement.finallyBlock); + } + } + else if (!ts.isFunctionLike(node)) { + ts.forEachChild(node, aggregate); } } - function getSyntacticDocumentHighlights(node) { - var fileName = sourceFile.fileName; - var highlightSpans = getHighlightSpans(node); - if (!highlightSpans || highlightSpans.length === 0) { - return undefined; + } + /** + * For lack of a better name, this function takes a throw statement and returns the + * nearest ancestor that is a try-block (whose try statement has a catch clause), + * function-block, or source file. + */ + function getThrowStatementOwner(throwStatement) { + var child = throwStatement; + while (child.parent) { + var parent_2 = child.parent; + if (ts.isFunctionBlock(parent_2) || parent_2.kind === 263 /* SourceFile */) { + return parent_2; } - return [{ fileName: fileName, highlightSpans: highlightSpans }]; - // returns true if 'node' is defined and has a matching 'kind'. - function hasKind(node, kind) { - return node !== undefined && node.kind === kind; + // 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_2.kind === 223 /* TryStatement */) { + var tryStatement = parent_2; + if (tryStatement.tryBlock === child && tryStatement.catchClause) { + return child; + } } - // Null-propagating 'parent' function. - function parent(node) { - return node && node.parent; + child = parent_2; + } + return undefined; + } + function aggregateAllBreakAndContinueStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 217 /* BreakStatement */ || node.kind === 216 /* ContinueStatement */) { + statementAccumulator.push(node); } - function getHighlightSpans(node) { - if (node) { - switch (node.kind) { - case 89 /* IfKeyword */: - case 81 /* ElseKeyword */: - if (hasKind(node.parent, 209 /* IfStatement */)) { - return getIfElseOccurrences(node.parent); - } - break; - case 95 /* ReturnKeyword */: - if (hasKind(node.parent, 217 /* ReturnStatement */)) { - return getReturnOccurrences(node.parent); - } - break; - case 99 /* ThrowKeyword */: - if (hasKind(node.parent, 221 /* ThrowStatement */)) { - return getThrowOccurrences(node.parent); - } - break; - case 73 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 222 /* TryStatement */)) { - return getTryCatchFinallyOccurrences(node.parent.parent); - } - break; - case 101 /* TryKeyword */: - case 86 /* FinallyKeyword */: - if (hasKind(parent(node), 222 /* TryStatement */)) { - return getTryCatchFinallyOccurrences(node.parent); - } - break; - case 97 /* SwitchKeyword */: - if (hasKind(node.parent, 219 /* SwitchStatement */)) { - return getSwitchCaseDefaultOccurrences(node.parent); - } - break; - case 72 /* CaseKeyword */: - case 78 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 219 /* SwitchStatement */)) { - return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); - } - break; - case 71 /* BreakKeyword */: - case 76 /* ContinueKeyword */: - if (hasKind(node.parent, 216 /* BreakStatement */) || hasKind(node.parent, 215 /* ContinueStatement */)) { - return getBreakOrContinueStatementOccurrences(node.parent); - } - break; - case 87 /* ForKeyword */: - if (hasKind(node.parent, 212 /* ForStatement */) || - hasKind(node.parent, 213 /* ForInStatement */) || - hasKind(node.parent, 214 /* ForOfStatement */)) { - return getLoopBreakContinueOccurrences(node.parent); - } - break; - case 105 /* WhileKeyword */: - case 80 /* DoKeyword */: - if (hasKind(node.parent, 211 /* WhileStatement */) || hasKind(node.parent, 210 /* DoStatement */)) { - return getLoopBreakContinueOccurrences(node.parent); - } - break; - case 122 /* ConstructorKeyword */: - if (hasKind(node.parent, 150 /* Constructor */)) { - return getConstructorOccurrences(node.parent); - } - break; - case 124 /* GetKeyword */: - case 133 /* SetKeyword */: - if (hasKind(node.parent, 151 /* GetAccessor */) || hasKind(node.parent, 152 /* SetAccessor */)) { - return getGetAndSetOccurrences(node.parent); - } - break; - default: - if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 206 /* VariableStatement */)) { - return getModifierOccurrences(node.kind, node.parent); - } - } - } - return undefined; + else if (!ts.isFunctionLike(node)) { + ts.forEachChild(node, aggregate); } - /** - * Aggregates all throw-statements within this node *without* crossing - * into function boundaries and try-blocks with catch-clauses. - */ - function aggregateOwnedThrowStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 221 /* ThrowStatement */) { - statementAccumulator.push(node); - } - else if (node.kind === 222 /* TryStatement */) { - var tryStatement = node; - if (tryStatement.catchClause) { - aggregate(tryStatement.catchClause); - } - else { - // Exceptions thrown within a try block lacking a catch clause - // are "owned" in the current context. - aggregate(tryStatement.tryBlock); - } - if (tryStatement.finallyBlock) { - aggregate(tryStatement.finallyBlock); - } + } + } + function ownsBreakOrContinueStatement(owner, statement) { + var actualOwner = getBreakOrContinueOwner(statement); + return actualOwner && actualOwner === owner; + } + function getBreakOrContinueOwner(statement) { + for (var node = statement.parent; node; node = node.parent) { + switch (node.kind) { + case 220 /* SwitchStatement */: + if (statement.kind === 216 /* ContinueStatement */) { + continue; } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); + // Fall through. + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 212 /* WhileStatement */: + case 211 /* DoStatement */: + if (!statement.label || isLabeledBy(node, statement.label.text)) { + return node; } - } - } - /** - * For lack of a better name, this function takes a throw statement and returns the - * nearest ancestor that is a try-block (whose try statement has a catch clause), - * function-block, or source file. - */ - function getThrowStatementOwner(throwStatement) { - var child = throwStatement; - while (child.parent) { - var parent_18 = child.parent; - if (ts.isFunctionBlock(parent_18) || parent_18.kind === 262 /* SourceFile */) { - return parent_18; - } - // 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_18.kind === 222 /* TryStatement */) { - var tryStatement = parent_18; - if (tryStatement.tryBlock === child && tryStatement.catchClause) { - return child; - } + break; + default: + // Don't cross function boundaries. + if (ts.isFunctionLike(node)) { + return undefined; } - child = parent_18; - } + break; + } + } + return undefined; + } + function getModifierOccurrences(modifier, declaration) { + 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 === 228 /* ClassDeclaration */ || + container.kind === 198 /* ClassExpression */ || + (declaration.kind === 145 /* Parameter */ && hasKind(container, 151 /* Constructor */)))) { return undefined; } - function aggregateAllBreakAndContinueStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 216 /* BreakStatement */ || node.kind === 215 /* ContinueStatement */) { - statementAccumulator.push(node); - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); - } - } + } + else if (modifier === 114 /* StaticKeyword */) { + if (!(container.kind === 228 /* ClassDeclaration */ || container.kind === 198 /* ClassExpression */)) { + return undefined; } - function ownsBreakOrContinueStatement(owner, statement) { - var actualOwner = getBreakOrContinueOwner(statement); - return actualOwner && actualOwner === owner; + } + else if (modifier === 83 /* ExportKeyword */ || modifier === 123 /* DeclareKeyword */) { + if (!(container.kind === 233 /* ModuleBlock */ || container.kind === 263 /* SourceFile */)) { + return undefined; } - function getBreakOrContinueOwner(statement) { - for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { - switch (node_2.kind) { - case 219 /* SwitchStatement */: - if (statement.kind === 215 /* ContinueStatement */) { - continue; - } - // Fall through. - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 211 /* WhileStatement */: - case 210 /* DoStatement */: - if (!statement.label || isLabeledBy(node_2, statement.label.text)) { - return node_2; - } - break; - default: - // Don't cross function boundaries. - if (ts.isFunctionLike(node_2)) { - return undefined; - } - break; - } - } + } + else if (modifier === 116 /* AbstractKeyword */) { + if (!(container.kind === 228 /* ClassDeclaration */ || declaration.kind === 228 /* ClassDeclaration */)) { return undefined; } - function getModifierOccurrences(modifier, declaration) { - 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 === 227 /* ClassDeclaration */ || - container.kind === 197 /* ClassExpression */ || - (declaration.kind === 144 /* Parameter */ && hasKind(container, 150 /* Constructor */)))) { - return undefined; - } - } - else if (modifier === 114 /* StaticKeyword */) { - if (!(container.kind === 227 /* ClassDeclaration */ || container.kind === 197 /* ClassExpression */)) { - return undefined; - } - } - else if (modifier === 83 /* ExportKeyword */ || modifier === 123 /* DeclareKeyword */) { - if (!(container.kind === 232 /* ModuleBlock */ || container.kind === 262 /* SourceFile */)) { - return undefined; - } - } - else if (modifier === 116 /* AbstractKeyword */) { - if (!(container.kind === 227 /* ClassDeclaration */ || declaration.kind === 227 /* ClassDeclaration */)) { - return undefined; - } + } + else { + // unsupported modifier + return undefined; + } + var keywords = []; + var modifierFlag = getFlagFromModifier(modifier); + var nodes; + switch (container.kind) { + case 233 /* ModuleBlock */: + case 263 /* SourceFile */: + // Container is either a class declaration or the declaration is a classDeclaration + if (modifierFlag & 128 /* Abstract */) { + nodes = declaration.members.concat(declaration); } else { - // unsupported modifier - return undefined; - } - var keywords = []; - var modifierFlag = getFlagFromModifier(modifier); - var nodes; - switch (container.kind) { - case 232 /* ModuleBlock */: - case 262 /* SourceFile */: - // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* Abstract */) { - nodes = declaration.members.concat(declaration); - } - else { - nodes = container.statements; - } - break; - case 150 /* Constructor */: - nodes = container.parameters.concat(container.parent.members); - break; - case 227 /* ClassDeclaration */: - case 197 /* 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 & 28 /* AccessibilityModifier */) { - var constructor = ts.forEach(container.members, function (member) { - return member.kind === 150 /* Constructor */ && member; - }); - if (constructor) { - nodes = nodes.concat(constructor.parameters); - } - } - else if (modifierFlag & 128 /* Abstract */) { - nodes = nodes.concat(container); - } - break; - default: - ts.Debug.fail("Invalid container kind."); + nodes = container.statements; } - ts.forEach(nodes, function (node) { - if (ts.getModifierFlags(node) & modifierFlag) { - ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); - } - }); - return ts.map(keywords, getHighlightSpanForNode); - function getFlagFromModifier(modifier) { - switch (modifier) { - case 113 /* PublicKeyword */: - return 4 /* Public */; - case 111 /* PrivateKeyword */: - return 8 /* Private */; - case 112 /* ProtectedKeyword */: - return 16 /* Protected */; - case 114 /* StaticKeyword */: - return 32 /* Static */; - case 83 /* ExportKeyword */: - return 1 /* Export */; - case 123 /* DeclareKeyword */: - return 2 /* Ambient */; - case 116 /* AbstractKeyword */: - return 128 /* Abstract */; - default: - ts.Debug.fail(); + break; + case 151 /* Constructor */: + nodes = container.parameters.concat(container.parent.members); + break; + case 228 /* ClassDeclaration */: + case 198 /* 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 & 28 /* AccessibilityModifier */) { + var constructor = ts.forEach(container.members, function (member) { + return member.kind === 151 /* Constructor */ && member; + }); + if (constructor) { + nodes = nodes.concat(constructor.parameters); } } - } - function pushKeywordIf(keywordList, token) { - var expected = []; - for (var _i = 2; _i < arguments.length; _i++) { - expected[_i - 2] = arguments[_i]; - } - if (token && ts.contains(expected, token.kind)) { - keywordList.push(token); - return true; + else if (modifierFlag & 128 /* Abstract */) { + nodes = nodes.concat(container); } - return false; + break; + default: + ts.Debug.fail("Invalid container kind."); + } + ts.forEach(nodes, function (node) { + if (ts.getModifierFlags(node) & modifierFlag) { + ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); } - function getGetAndSetOccurrences(accessorDeclaration) { - var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 151 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 152 /* 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, 124 /* GetKeyword */, 133 /* SetKeyword */); }); - } - } + }); + return keywords; + function getFlagFromModifier(modifier) { + switch (modifier) { + case 113 /* PublicKeyword */: + return 4 /* Public */; + case 111 /* PrivateKeyword */: + return 8 /* Private */; + case 112 /* ProtectedKeyword */: + return 16 /* Protected */; + case 114 /* StaticKeyword */: + return 32 /* Static */; + case 83 /* ExportKeyword */: + return 1 /* Export */; + case 123 /* DeclareKeyword */: + return 2 /* Ambient */; + case 116 /* AbstractKeyword */: + return 128 /* Abstract */; + default: + ts.Debug.fail(); } - function getConstructorOccurrences(constructorDeclaration) { - var declarations = constructorDeclaration.symbol.getDeclarations(); - var keywords = []; - ts.forEach(declarations, function (declaration) { - ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 122 /* ConstructorKeyword */); - }); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getLoopBreakContinueOccurrences(loopNode) { - var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87 /* ForKeyword */, 105 /* WhileKeyword */, 80 /* DoKeyword */)) { - // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 210 /* DoStatement */) { - var loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) { - break; - } - } - } - } - var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */, 76 /* ContinueKeyword */); - } - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { - var owner = getBreakOrContinueOwner(breakOrContinueStatement); - if (owner) { - switch (owner.kind) { - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - return getLoopBreakContinueOccurrences(owner); - case 219 /* SwitchStatement */: - return getSwitchCaseDefaultOccurrences(owner); + } + } + function pushKeywordIf(keywordList, token) { + var expected = []; + for (var _i = 2; _i < arguments.length; _i++) { + expected[_i - 2] = arguments[_i]; + } + if (token && ts.contains(expected, token.kind)) { + keywordList.push(token); + return true; + } + return false; + } + function getGetAndSetOccurrences(accessorDeclaration) { + var keywords = []; + tryPushAccessorKeyword(accessorDeclaration.symbol, 152 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 153 /* SetAccessor */); + return keywords; + function tryPushAccessorKeyword(accessorSymbol, accessorKind) { + var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); + if (accessor) { + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124 /* GetKeyword */, 134 /* SetKeyword */); }); + } + } + } + function getConstructorOccurrences(constructorDeclaration) { + var declarations = constructorDeclaration.symbol.getDeclarations(); + var keywords = []; + ts.forEach(declarations, function (declaration) { + ts.forEach(declaration.getChildren(), function (token) { + return pushKeywordIf(keywords, token, 122 /* ConstructorKeyword */); + }); + }); + return keywords; + } + function getLoopBreakContinueOccurrences(loopNode) { + var keywords = []; + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87 /* ForKeyword */, 105 /* WhileKeyword */, 80 /* DoKeyword */)) { + // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. + if (loopNode.kind === 211 /* DoStatement */) { + var loopTokens = loopNode.getChildren(); + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) { + break; } } - return undefined; } - function getSwitchCaseDefaultOccurrences(switchStatement) { - var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 97 /* 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(), 72 /* CaseKeyword */, 78 /* DefaultKeyword */); - var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */); - } - }); - }); - return ts.map(keywords, getHighlightSpanForNode); + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */, 76 /* ContinueKeyword */); } - function getTryCatchFinallyOccurrences(tryStatement) { - var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 101 /* TryKeyword */); - if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73 /* CatchKeyword */); - } - if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 86 /* FinallyKeyword */); - } - return ts.map(keywords, getHighlightSpanForNode); + }); + return keywords; + } + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + return getLoopBreakContinueOccurrences(owner); + case 220 /* SwitchStatement */: + return getSwitchCaseDefaultOccurrences(owner); } - function getThrowOccurrences(throwStatement) { - var owner = getThrowStatementOwner(throwStatement); - if (!owner) { - return undefined; + } + return undefined; + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 97 /* 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(), 72 /* CaseKeyword */, 78 /* DefaultKeyword */); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */); } - var keywords = []; - ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* 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(), 95 /* ReturnKeyword */); - }); + }); + }); + return keywords; + } + function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 101 /* TryKeyword */); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73 /* CatchKeyword */); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 86 /* FinallyKeyword */); + } + return keywords; + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* 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(), 95 /* ReturnKeyword */); + }); + } + return keywords; + } + 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, 206 /* Block */))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); + }); + // Include 'throw' statements that do not occur within a try block. + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); + }); + return keywords; + } + function getIfElseOccurrences(ifStatement, sourceFile) { + var keywords = []; + // Traverse upwards through all parent if-statements linked by their else-branches. + while (hasKind(ifStatement.parent, 210 /* 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], 89 /* 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], 81 /* ElseKeyword */)) { + break; } - return ts.map(keywords, getHighlightSpanForNode); } - 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, 205 /* Block */))) { - return undefined; - } - var keywords = []; - ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); - }); - // Include 'throw' statements that do not occur within a try block. - ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* 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, 209 /* 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], 89 /* 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], 81 /* ElseKeyword */)) { - break; - } - } - if (!hasKind(ifStatement.elseStatement, 209 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 210 /* IfStatement */)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + // 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 === 81 /* ElseKeyword */ && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. + var shouldCombindElseAndIf = true; + // Avoid recalculating getStart() by iterating backwards. + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { + shouldCombindElseAndIf = false; break; } - ifStatement = ifStatement.elseStatement; } - var result = []; - // 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 === 81 /* ElseKeyword */ && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. - var shouldCombindElseAndIf = true; - // Avoid recalculating getStart() by iterating backwards. - for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { - if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { - shouldCombindElseAndIf = false; - break; - } - } - if (shouldCombindElseAndIf) { - result.push({ - fileName: fileName, - textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), - kind: ts.HighlightSpanKind.reference - }); - i++; // skip the next keyword - continue; - } - } - // Ordinary case: just highlight the keyword. - result.push(getHighlightSpanForNode(keywords[i])); + if (shouldCombindElseAndIf) { + result.push({ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + kind: ts.HighlightSpanKind.reference + }); + i++; // skip the next keyword + continue; } - return result; } + // Ordinary case: just highlight the keyword. + result.push(getHighlightSpanForNode(keywords[i], sourceFile)); } + return result; } - DocumentHighlights.getDocumentHighlights = getDocumentHighlights; /** * Whether or not a 'node' is preceded by a label of the given string. * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 220 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 221 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -70160,15 +70469,15 @@ var ts; return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); } function getBucketForCompilationSettings(key, createIfMissing) { - var bucket = buckets[key]; + var bucket = buckets.get(key); if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(); + buckets.set(key, bucket = ts.createFileMap()); } return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { - var entries = buckets[name]; + var bucketInfoArray = ts.arrayFrom(buckets.keys()).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { + var entries = buckets.get(name); var sourceFiles = []; entries.forEachValue(function (key, entry) { sourceFiles.push({ @@ -70266,57 +70575,26 @@ var ts; (function (ts) { var FindAllReferences; (function (FindAllReferences) { - function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) { + function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments, isForRename) { var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); - if (node === sourceFile) { - return undefined; - } - switch (node.kind) { - case 8 /* NumericLiteral */: - if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - break; - } - // Fallthrough - case 70 /* Identifier */: - case 98 /* ThisKeyword */: - // case SyntaxKind.SuperKeyword: TODO:GH#9268 - case 122 /* ConstructorKeyword */: - case 9 /* StringLiteral */: - return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, /*implementations*/ false); - } - return undefined; + return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, isForRename); } FindAllReferences.findReferencedSymbols = findReferencedSymbols; - function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) { + function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, isForRename, implementations) { if (!implementations) { - // Labels - if (ts.isLabelName(node)) { - if (ts.isJumpStatementTarget(node)) { - var labelDefinition = ts.getTargetLabel(node.parent, node.text); - // if we have a label definition, look within its statement for references, if not, then - // the label is undefined and we have no results.. - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; - } - else { - // it is a label definition and not a target, search within the parent labeledStatement - return getLabelReferencesInNode(node.parent, node); - } - } - if (ts.isThis(node)) { - return getReferencesForThisKeyword(node, sourceFiles); - } - if (node.kind === 96 /* SuperKeyword */) { - return getReferencesForSuperKeyword(node); + var special = getReferencedSymbolsSpecial(node, sourceFiles, typeChecker, cancellationToken); + if (special) { + return special; } } // `getSymbolAtLocation` normally returns the symbol of the class when given the constructor keyword, // so we have to specify that we want the constructor symbol. var symbol = typeChecker.getSymbolAtLocation(node); - if (!implementations && !symbol && node.kind === 9 /* StringLiteral */) { - return getReferencesForStringLiteral(node, sourceFiles); - } // Could not find a symbol e.g. unknown identifier if (!symbol) { + if (!implementations && node.kind === 9 /* StringLiteral */) { + return getReferencesForStringLiteral(node, sourceFiles, typeChecker, cancellationToken); + } // Can't have references to something that we have no symbol for. return undefined; } @@ -70325,1028 +70603,1118 @@ var ts; if (!declarations || !declarations.length) { return undefined; } - var result; + var _a = followAliases(symbol, node, typeChecker, isForRename), aliasedSymbol = _a.symbol, shorthandModuleSymbol = _a.shorthandModuleSymbol; + symbol = aliasedSymbol; + // Build the set of symbols to search for, initially it has only the current symbol + var searchSymbols = populateSearchSymbolSet(symbol, node, typeChecker, implementations); + if (shorthandModuleSymbol) { + searchSymbols.push(shorthandModuleSymbol); + } // Compute the meaning from the location and the symbol it references var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations); + var result = []; + // Maps from a symbol ID to the ReferencedSymbol entry in 'result'. + var symbolToIndex = []; + var inheritsFromCache = ts.createMap(); // Get the text to search for. // Note: if this is an external module symbol, the name doesn't include quotes. var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); // Try to get the smallest valid scope that we can limit our search to; // otherwise we'll need to search globally (i.e. include each file). var scope = getSymbolScope(symbol); - // Maps from a symbol ID to the ReferencedSymbol entry in 'result'. - var symbolToIndex = []; if (scope) { - result = []; - getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + getRefs(scope, declaredName); } else { - var internedName = getInternedName(symbol, node); - for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { - var sourceFile = sourceFiles_8[_i]; + var isDefault = ts.isExportDefaultSymbol(symbol); + var internedName = isDefault ? symbol.valueDeclaration.localSymbol.name : getInternedName(symbol, node); + for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { + var sourceFile = sourceFiles_7[_i]; cancellationToken.throwIfCancellationRequested(); - var nameTable = ts.getNameTable(sourceFile); - if (nameTable[internedName] !== undefined) { - result = result || []; - getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + var searchName = (isDefault ? getDefaultImportName(symbol, sourceFile, typeChecker) : undefined) || + (sourceFileHasName(sourceFile, internedName) ? declaredName : undefined); + if (searchName !== undefined) { + getRefs(sourceFile, searchName); } } } return result; - function getDefinition(symbol) { - var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node); - var name = ts.map(info.displayParts, function (p) { return p.text; }).join(""); - var declarations = symbol.declarations; - if (!declarations || declarations.length === 0) { - return undefined; + function getRefs(scope, searchName) { + getReferencesInNode(scope, symbol, searchName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex, implementations, typeChecker, cancellationToken, searchSymbols, inheritsFromCache); + } + } + FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; + /** getReferencedSymbols for special node kinds. */ + function getReferencedSymbolsSpecial(node, sourceFiles, typeChecker, cancellationToken) { + if (ts.isTypeKeyword(node.kind)) { + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken); + } + // Labels + if (ts.isLabelName(node)) { + if (ts.isJumpStatementTarget(node)) { + var labelDefinition = ts.getTargetLabel(node.parent, node.text); + // if we have a label definition, look within its statement for references, if not, then + // the label is undefined and we have no results.. + return labelDefinition && getLabelReferencesInNode(labelDefinition.parent, labelDefinition, cancellationToken); + } + else { + // it is a label definition and not a target, search within the parent labeledStatement + return getLabelReferencesInNode(node.parent, node, cancellationToken); } - return { - containerKind: "", - containerName: "", - name: name, - kind: info.symbolKind, - fileName: declarations[0].getSourceFile().fileName, - textSpan: ts.createTextSpan(declarations[0].getStart(), 0), - displayParts: info.displayParts - }; } - function getAliasSymbolForPropertyNameSymbol(symbol, location) { - if (symbol.flags & 8388608 /* Alias */) { - // Default import get alias - var defaultImport = ts.getDeclarationOfKind(symbol, 237 /* ImportClause */); - if (defaultImport) { - return typeChecker.getAliasedSymbol(symbol); - } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 240 /* ImportSpecifier */ || - declaration.kind === 244 /* ExportSpecifier */) ? declaration : undefined; }); - if (importOrExportSpecifier && - // export { a } - (!importOrExportSpecifier.propertyName || - // export {a as class } where a is location - importOrExportSpecifier.propertyName === location)) { - // If Import specifier -> get alias - // else Export specifier -> get local target - return importOrExportSpecifier.kind === 240 /* ImportSpecifier */ ? - typeChecker.getAliasedSymbol(symbol) : - typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); - } + if (ts.isThis(node)) { + return getReferencesForThisKeyword(node, sourceFiles, typeChecker, cancellationToken); + } + if (node.kind === 96 /* SuperKeyword */) { + return getReferencesForSuperKeyword(node, typeChecker, cancellationToken); + } + return undefined; + } + /** + * Follows aliases to get to the original declaration of a symbol. + * For a shorthand ambient module, we don't follow the alias to it, but we will need to add it to the set of search symbols. + */ + function followAliases(symbol, node, typeChecker, isForRename) { + while (true) { + // When renaming a default import, only rename in the current file + if (isForRename && isImportDefaultSymbol(symbol)) { + return { symbol: symbol }; + } + var aliasedSymbol = getAliasSymbolForPropertyNameSymbol(symbol, node, typeChecker); + // Don't follow alias if it goes to unknown symbol. This can happen if it points to an untyped module. + if (!aliasedSymbol || !aliasedSymbol.declarations) { + return { symbol: symbol }; } + if (ts.isShorthandAmbientModuleSymbol(aliasedSymbol)) { + return { symbol: symbol, shorthandModuleSymbol: aliasedSymbol }; + } + symbol = aliasedSymbol; + } + } + function sourceFileHasName(sourceFile, name) { + return ts.getNameTable(sourceFile).get(name) !== undefined; + } + /** + * Given a symbol, see if any of the imports in a source file reference it. + * Only call this if `symbol` is a default export. + */ + function getDefaultImportName(symbol, sourceFile, checker) { + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var importSpecifier = _a[_i]; + var importDecl = importSpecifier.parent; + ts.Debug.assert(importDecl.moduleSpecifier === importSpecifier); + var defaultName = importDecl.importClause.name; + var defaultReferencedSymbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName)); + if (symbol === defaultReferencedSymbol) { + return defaultName.text; + } + } + return undefined; + } + function getDefinition(symbol, node, typeChecker) { + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node), displayParts = _a.displayParts, symbolKind = _a.symbolKind; + var name = displayParts.map(function (p) { return p.text; }).join(""); + var declarations = symbol.declarations; + if (!declarations || declarations.length === 0) { + return undefined; + } + return { + containerKind: "", + containerName: "", + name: name, + kind: symbolKind, + fileName: declarations[0].getSourceFile().fileName, + textSpan: ts.createTextSpan(declarations[0].getStart(), 0), + displayParts: displayParts + }; + } + function getAliasSymbolForPropertyNameSymbol(symbol, location, typeChecker) { + if (!(symbol.flags & 8388608 /* Alias */)) { return undefined; } - function followAliasIfNecessary(symbol, location) { - return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol; + // Default import get alias + var defaultImport = ts.getDeclarationOfKind(symbol, 238 /* ImportClause */); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); + } + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 241 /* ImportSpecifier */ || + declaration.kind === 245 /* ExportSpecifier */) ? declaration : undefined; }); + if (importOrExportSpecifier && + // export { a } + (!importOrExportSpecifier.propertyName || + // export {a as class } where a is location + importOrExportSpecifier.propertyName === location)) { + // If Import specifier -> get alias + // else Export specifier -> get local target + return importOrExportSpecifier.kind === 241 /* ImportSpecifier */ ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + } + } + function followAliasIfNecessary(symbol, location, typeChecker) { + return getAliasSymbolForPropertyNameSymbol(symbol, location, typeChecker) || symbol; + } + function getPropertySymbolOfDestructuringAssignment(location, typeChecker) { + return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + function isObjectBindingPatternElementWithoutPropertyName(symbol) { + var bindingElement = ts.getDeclarationOfKind(symbol, 175 /* BindingElement */); + return bindingElement && + bindingElement.parent.kind === 173 /* ObjectBindingPattern */ && + !bindingElement.propertyName; + } + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, typeChecker) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + var bindingElement = ts.getDeclarationOfKind(symbol, 175 /* BindingElement */); + var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); } - function getPropertySymbolOfDestructuringAssignment(location) { - return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && - typeChecker.getPropertySymbolOfDestructuringAssignment(location); + return undefined; + } + function getInternedName(symbol, location) { + // If this is an export or import specifier it could have been renamed using the 'as' syntax. + // If so we want to search for whatever under the cursor. + if (ts.isImportOrExportSpecifierName(location)) { + return location.text; } - function isObjectBindingPatternElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */); - return bindingElement && - bindingElement.parent.kind === 172 /* ObjectBindingPattern */ && - !bindingElement.propertyName; + return ts.stripQuotes(symbol.name); + } + /** + * Determines the smallest scope in which a symbol may have named references. + * Note that not every construct has been accounted for. This function can + * probably be improved. + * + * @returns undefined if the scope cannot be determined, implying that + * a reference to a symbol can occur anywhere. + */ + function getSymbolScope(symbol) { + // 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 === 185 /* FunctionExpression */ || valueDeclaration.kind === 198 /* ClassExpression */)) { + return valueDeclaration; } - function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */); - var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); - return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + // 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 (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; }); + if (privateDeclaration) { + return ts.getAncestor(privateDeclaration, 228 /* ClassDeclaration */); } + } + // If the symbol is an import we would like to find it if we are looking for what it imports. + // So consider it visible outside its declaration scope. + if (symbol.flags & 8388608 /* Alias */) { return undefined; } - function getInternedName(symbol, location) { - // If this is an export or import specifier it could have been renamed using the 'as' syntax. - // If so we want to search for whatever under the cursor. - if (ts.isImportOrExportSpecifierName(location)) { - return location.getText(); - } - // Try to get the local symbol if we're dealing with an 'export default' - // since that symbol has the "true" name. - var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - symbol = localExportDefaultSymbol || symbol; - return ts.stripQuotes(symbol.name); + // If symbol is of object binding pattern element without property name we would want to + // look for property too and that could be anywhere + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + return undefined; } - /** - * Determines the smallest scope in which a symbol may have named references. - * Note that not every construct has been accounted for. This function can - * probably be improved. - * - * @returns undefined if the scope cannot be determined, implying that - * a reference to a symbol can occur anywhere. - */ - function getSymbolScope(symbol) { - // 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 === 184 /* FunctionExpression */ || valueDeclaration.kind === 197 /* 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 (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; }); - if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 227 /* ClassDeclaration */); + // if this symbol is visible from its parent container, e.g. exported, then bail out + // if symbol correspond to the union property - bail out + if (symbol.parent || (symbol.flags & 268435456 /* SyntheticProperty */)) { + return undefined; + } + var scope; + var declarations = symbol.getDeclarations(); + if (declarations) { + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + var container = ts.getContainerNode(declaration); + if (!container) { + return undefined; } + if (scope && scope !== container) { + // Different declarations have different containers, bail out + return undefined; + } + if (container.kind === 263 /* 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; + } + // The search scope is the container node + scope = container; } - // If the symbol is an import we would like to find it if we are looking for what it imports. - // So consider it visible outside its declaration scope. - if (symbol.flags & 8388608 /* Alias */) { - return undefined; - } - // If symbol is of object binding pattern element without property name we would want to - // look for property too and that could be anywhere - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - return undefined; + } + return scope; + } + function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end, cancellationToken) { + var positions = []; + /// TODO: Cache symbol existence for files to save text search + // Also, need to make this work for unicode escapes. + // Be resilient in the face of a symbol with no name or zero length name + if (!symbolName || !symbolName.length) { + return positions; + } + var text = sourceFile.text; + var sourceLength = text.length; + var symbolNameLength = symbolName.length; + var position = text.indexOf(symbolName, start); + while (position >= 0) { + cancellationToken.throwIfCancellationRequested(); + // If 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 + // before and after it have to be a non-identifier char). + var endPosition = position + symbolNameLength; + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5 /* Latest */)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5 /* Latest */))) { + // Found a real match. Keep searching. + positions.push(position); + } + position = text.indexOf(symbolName, position + symbolNameLength + 1); + } + return positions; + } + function getLabelReferencesInNode(container, targetLabel, cancellationToken) { + var references = []; + var sourceFile = container.getSourceFile(); + var labelName = targetLabel.text; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd(), cancellationToken); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.getWidth() !== labelName.length) { + return; } - // if this symbol is visible from its parent container, e.g. exported, then bail out - // if symbol correspond to the union property - bail out - if (symbol.parent || (symbol.flags & 268435456 /* SyntheticProperty */)) { - return undefined; + // Only pick labels that are either the target label, or have a target that is the target label + if (node === targetLabel || + (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { + references.push(getReferenceEntryFromNode(node)); } - var scope; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; - var container = ts.getContainerNode(declaration); - if (!container) { - return undefined; - } - if (scope && scope !== container) { - // Different declarations have different containers, bail out - return undefined; - } - if (container.kind === 262 /* 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; - } - // The search scope is the container node - scope = container; - } + }); + var definition = { + containerKind: "", + containerName: "", + fileName: targetLabel.getSourceFile().fileName, + kind: ts.ScriptElementKind.label, + name: labelName, + textSpan: ts.createTextSpanFromNode(targetLabel, sourceFile), + displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] + }; + return [{ definition: definition, references: references }]; + } + function isValidReferencePosition(node, searchSymbolName) { + // Compare the length so we filter out strict superstrings of the symbol we are looking for + switch (node && node.kind) { + case 70 /* Identifier */: + return node.getWidth() === searchSymbolName.length; + case 9 /* StringLiteral */: + return (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) && + // For string literals we have two additional chars for the quotes + node.getWidth() === searchSymbolName.length + 2; + case 8 /* NumericLiteral */: + return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.getWidth() === searchSymbolName.length; + default: + return false; + } + } + function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) { + var name = ts.tokenToString(keywordKind); + var definition = { + containerKind: "", + containerName: "", + fileName: "", + kind: ts.ScriptElementKind.keyword, + name: name, + textSpan: ts.createTextSpan(0, 1), + displayParts: [{ text: name, kind: ts.ScriptElementKind.keyword }] + }; + var references = []; + for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { + var sourceFile = sourceFiles_8[_i]; + cancellationToken.throwIfCancellationRequested(); + addReferencesForKeywordInFile(sourceFile, keywordKind, name, cancellationToken, references); + } + return [{ definition: definition, references: references }]; + } + function addReferencesForKeywordInFile(sourceFile, kind, searchText, cancellationToken, references) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; + cancellationToken.throwIfCancellationRequested(); + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (referenceLocation.kind === kind) { + references.push({ + textSpan: ts.createTextSpanFromNode(referenceLocation), + fileName: sourceFile.fileName, + isWriteAccess: false, + isDefinition: false, + }); } - return scope; } - function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { - var positions = []; - /// TODO: Cache symbol existence for files to save text search - // Also, need to make this work for unicode escapes. - // Be resilient in the face of a symbol with no name or zero length name - if (!symbolName || !symbolName.length) { - return positions; - } - var text = sourceFile.text; - var sourceLength = text.length; - var symbolNameLength = symbolName.length; - var position = text.indexOf(symbolName, start); - while (position >= 0) { - cancellationToken.throwIfCancellationRequested(); - // If 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 - // before and after it have to be a non-identifier char). - var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5 /* Latest */)) && - (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5 /* Latest */))) { - // Found a real match. Keep searching. - positions.push(position); + } + /** 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 + */ + function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex, implementations, typeChecker, cancellationToken, searchSymbols, inheritsFromCache) { + var sourceFile = container.getSourceFile(); + var start = findInComments ? container.getFullStart() : container.getStart(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd(), cancellationToken); + var parents = getParentSymbolsOfPropertyAccess(); + for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) { + var position = possiblePositions_2[_i]; + 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 + // match in a comment or string if that's what the caller is asking + // for. + if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || + (findInComments && ts.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 + // 'FindReferences' will just filter out these results. + result.push({ + definition: undefined, + references: [{ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpan(position, searchText.length), + isWriteAccess: false, + isDefinition: false + }] + }); } - position = text.indexOf(symbolName, position + symbolNameLength + 1); + continue; } - return positions; - } - function getLabelReferencesInNode(container, targetLabel) { - var references = []; - var sourceFile = container.getSourceFile(); - var labelName = targetLabel.text; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.getWidth() !== labelName.length) { - return; + if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { + continue; + } + var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); + if (referenceSymbol) { + var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; + var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); + var relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, + /*searchLocationIsConstructor*/ searchLocation.kind === 122 /* ConstructorKeyword */, parents, inheritsFromCache, typeChecker); + if (relatedSymbol) { + addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); } - // Only pick labels that are either the target label, or have a target that is the target label - if (node === targetLabel || - (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { - references.push(getReferenceEntryFromNode(node)); + else if (!(referenceSymbol.flags & 67108864 /* Transient */) && ts.contains(searchSymbols, shorthandValueSymbol)) { + addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); } - }); - var definition = { - containerKind: "", - containerName: "", - fileName: targetLabel.getSourceFile().fileName, - kind: ts.ScriptElementKind.label, - name: labelName, - textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()), - displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] - }; - return [{ definition: definition, references: references }]; - } - function isValidReferencePosition(node, searchSymbolName) { - if (node) { - // Compare the length so we filter out strict superstrings of the symbol we are looking for - switch (node.kind) { - case 70 /* Identifier */: - return node.getWidth() === searchSymbolName.length; - case 9 /* StringLiteral */: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - // For string literals we have two additional chars for the quotes - return node.getWidth() === searchSymbolName.length + 2; - } - break; - case 8 /* NumericLiteral */: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - return node.getWidth() === searchSymbolName.length; - } - break; + else if (searchLocation.kind === 122 /* ConstructorKeyword */) { + findAdditionalConstructorReferences(referenceSymbol, referenceLocation); } } - return false; } - /** 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 - */ - function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) { - var sourceFile = container.getSourceFile(); - var start = findInComments ? container.getFullStart() : container.getStart(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd()); - var parents = getParentSymbolsOfPropertyAccess(); - var inheritsFromCache = ts.createMap(); - if (possiblePositions.length) { - // Build the set of symbols to search for, initially it has only the current symbol - var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation); - ts.forEach(possiblePositions, function (position) { - 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 - // match in a comment or string if that's what the caller is asking - // for. - if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || - (findInComments && ts.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 - // 'FindReferences' will just filter out these results. - result.push({ - definition: undefined, - references: [{ - fileName: sourceFile.fileName, - textSpan: ts.createTextSpan(position, searchText.length), - isWriteAccess: false, - isDefinition: false - }] - }); - } - return; - } - if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { - return; - } - var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); - if (referenceSymbol) { - var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); - var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, - /*searchLocationIsConstructor*/ searchLocation.kind === 122 /* ConstructorKeyword */, parents, inheritsFromCache); - if (relatedSymbol) { - addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); - } - else if (!(referenceSymbol.flags & 67108864 /* Transient */) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { - addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); - } - else if (searchLocation.kind === 122 /* ConstructorKeyword */) { - findAdditionalConstructorReferences(referenceSymbol, referenceLocation); + return; + /* If we are just looking for implementations and this is a property access expression, we need to get the + * symbol of the local type of the symbol the property is being accessed on. This is because our search + * symbol may have a different parent symbol if the local type's symbol does not declare the property + * being accessed (i.e. it is declared in some parent class or interface) + */ + function getParentSymbolsOfPropertyAccess() { + if (implementations) { + var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); + if (propertyAccessExpression) { + var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); + if (localParentType) { + if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== searchSymbol.parent) { + return [localParentType.symbol]; } - } - }); - } - return; - /* If we are just looking for implementations and this is a property access expression, we need to get the - * symbol of the local type of the symbol the property is being accessed on. This is because our search - * symbol may have a different parent symbol if the local type's symbol does not declare the property - * being accessed (i.e. it is declared in some parent class or interface) - */ - function getParentSymbolsOfPropertyAccess() { - if (implementations) { - var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); - if (propertyAccessExpression) { - var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); - if (localParentType) { - if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== searchSymbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 196608 /* UnionOrIntersection */) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } + else if (localParentType.flags & 196608 /* UnionOrIntersection */) { + return getSymbolsForClassAndInterfaceComponents(localParentType); } } } } - function getPropertyAccessExpressionFromRightHandSide(node) { - return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */ + function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { + ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); + var referenceClass = referenceLocation.parent; + if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { + ts.Debug.assert(referenceClass.name === referenceLocation); + // This is the class declaration containing the constructor. + addReferences(findOwnConstructorCalls(searchSymbol, sourceFile)); } - /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */ - function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { - ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); - var referenceClass = referenceLocation.parent; - if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { - ts.Debug.assert(referenceClass.name === referenceLocation); - // This is the class declaration containing the constructor. - addReferences(findOwnConstructorCalls(searchSymbol)); - } - else { - // If this class appears in `extends C`, then the extending class' "super" calls are references. - var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); - if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) { - addReferences(superConstructorAccesses(classExtending)); - } + else { + // If this class appears in `extends C`, then the extending class' "super" calls are references. + var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); + if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation, typeChecker) === searchSymbol) { + addReferences(superConstructorAccesses(classExtending)); } } - function addReferences(references) { - if (references.length) { - var referencedSymbol = getReferencedSymbol(searchSymbol); - ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); - } + } + function addReferences(references) { + if (references.length) { + var referencedSymbol = getReferencedSymbol(searchSymbol); + ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); } - /** `classSymbol` is the class where the constructor was defined. - * Reference the constructor and all calls to `new this()`. - */ - function findOwnConstructorCalls(classSymbol) { - var result = []; - for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150 /* Constructor */); - var ctrKeyword = decl.getChildAt(0); - ts.Debug.assert(ctrKeyword.kind === 122 /* ConstructorKeyword */); - result.push(ctrKeyword); - } - ts.forEachProperty(classSymbol.exports, function (member) { - var decl = member.valueDeclaration; - if (decl && decl.kind === 149 /* MethodDeclaration */) { - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) { - if (ts.isNewExpressionTarget(thisKeyword)) { - result.push(thisKeyword); - } - }); - } - } + } + function getReferencedSymbol(symbol) { + var symbolId = ts.getSymbolId(symbol); + var index = symbolToIndex[symbolId]; + if (index === undefined) { + index = result.length; + symbolToIndex[symbolId] = index; + result.push({ + definition: getDefinition(symbol, searchLocation, typeChecker), + references: [] }); - return result; } - /** Find references to `super` in the constructor of an extending class. */ - function superConstructorAccesses(cls) { - var symbol = cls.symbol; - var ctr = symbol.members["__constructor"]; - if (!ctr) { - return []; - } - var result = []; - for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150 /* Constructor */); - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) { - if (ts.isCallExpressionTarget(node)) { - result.push(node); - } - }); - } - } - ; - return result; + return result[index]; + } + function addReferenceToRelatedSymbol(node, relatedSymbol) { + var references = getReferencedSymbol(relatedSymbol).references; + if (implementations) { + getImplementationReferenceEntryForNode(node, references, typeChecker); } - function getReferencedSymbol(symbol) { - var symbolId = ts.getSymbolId(symbol); - var index = symbolToIndex[symbolId]; - if (index === undefined) { - index = result.length; - symbolToIndex[symbolId] = index; - result.push({ - definition: getDefinition(symbol), - references: [] + else { + references.push(getReferenceEntryFromNode(node)); + } + } + } + function getPropertyAccessExpressionFromRightHandSide(node) { + return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + /** `classSymbol` is the class where the constructor was defined. + * Reference the constructor and all calls to `new this()`. + */ + function findOwnConstructorCalls(classSymbol, sourceFile) { + var result = []; + for (var _i = 0, _a = classSymbol.members.get("__constructor").declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var ctrKeyword = ts.findChildOfKind(decl, 122 /* ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 151 /* Constructor */ && !!ctrKeyword); + result.push(ctrKeyword); + } + classSymbol.exports.forEach(function (member) { + var decl = member.valueDeclaration; + if (decl && decl.kind === 150 /* MethodDeclaration */) { + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) { + if (ts.isNewExpressionTarget(thisKeyword)) { + result.push(thisKeyword); + } }); } - return result[index]; } - function addReferenceToRelatedSymbol(node, relatedSymbol) { - var references = getReferencedSymbol(relatedSymbol).references; - if (implementations) { - getImplementationReferenceEntryForNode(node, references); - } - else { - references.push(getReferenceEntryFromNode(node)); - } + }); + return result; + } + /** Find references to `super` in the constructor of an extending class. */ + function superConstructorAccesses(cls) { + var symbol = cls.symbol; + var ctr = symbol.members.get("__constructor"); + if (!ctr) { + return []; + } + var result = []; + for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts.Debug.assert(decl.kind === 151 /* Constructor */); + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) { + if (ts.isCallExpressionTarget(node)) { + result.push(node); + } + }); } } - function getImplementationReferenceEntryForNode(refNode, result) { - // Check if we found a function/propertyAssignment/method with an implementation or initializer - if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { - result.push(getReferenceEntryFromNode(refNode.parent)); + ; + return result; + } + function getImplementationReferenceEntryForNode(refNode, result, typeChecker) { + // Check if we found a function/propertyAssignment/method with an implementation or initializer + if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { + result.push(getReferenceEntryFromNode(refNode.parent)); + } + else if (refNode.kind === 70 /* Identifier */) { + if (refNode.parent.kind === 260 /* ShorthandPropertyAssignment */) { + // Go ahead and dereference the shorthand assignment by going to its definition + getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); } - else if (refNode.kind === 70 /* Identifier */) { - if (refNode.parent.kind === 259 /* ShorthandPropertyAssignment */) { - // Go ahead and dereference the shorthand assignment by going to its definition - getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); - } - // Check if the node is within an extends or implements clause - var containingClass = getContainingClassIfInHeritageClause(refNode); - if (containingClass) { - result.push(getReferenceEntryFromNode(containingClass)); - return; - } - // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface - var containingTypeReference = getContainingTypeReference(refNode); - if (containingTypeReference) { - var parent_19 = containingTypeReference.parent; - if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); - } - else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { - if (parent_19.body.kind === 205 /* Block */) { - ts.forEachReturnStatement(parent_19.body, function (returnStatement) { - if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { - maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); - } - }); - } - else if (isImplementationExpression(parent_19.body)) { - maybeAdd(getReferenceEntryFromNode(parent_19.body)); - } + // Check if the node is within an extends or implements clause + var containingClass = getContainingClassIfInHeritageClause(refNode); + if (containingClass) { + result.push(getReferenceEntryFromNode(containingClass)); + return; + } + // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface + var containingTypeReference = getContainingTypeReference(refNode); + if (containingTypeReference) { + var parent = containingTypeReference.parent; + if (ts.isVariableLike(parent) && parent.type === containingTypeReference && parent.initializer && isImplementationExpression(parent.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent.initializer)); + } + else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { + if (parent.body.kind === 206 /* Block */) { + ts.forEachReturnStatement(parent.body, function (returnStatement) { + if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { + maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); + } + }); } - else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_19.expression)); + else if (isImplementationExpression(parent.body)) { + maybeAdd(getReferenceEntryFromNode(parent.body)); } } - } - // Type nodes can contain multiple references to the same type. For example: - // let x: Foo & (Foo & Bar) = ... - // Because we are returning the implementation locations and not the identifier locations, - // duplicate entries would be returned here as each of the type references is part of - // the same implementation. For that reason, check before we add a new entry - function maybeAdd(a) { - if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { - result.push(a); + else if (ts.isAssertionExpression(parent) && isImplementationExpression(parent.expression)) { + maybeAdd(getReferenceEntryFromNode(parent.expression)); } } } - function getSymbolsForClassAndInterfaceComponents(type, result) { - if (result === void 0) { result = []; } - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var componentType = _a[_i]; - if (componentType.symbol && componentType.symbol.getFlags() & (32 /* Class */ | 64 /* Interface */)) { - result.push(componentType.symbol); - } - if (componentType.getFlags() & 196608 /* UnionOrIntersection */) { - getSymbolsForClassAndInterfaceComponents(componentType, result); - } + // Type nodes can contain multiple references to the same type. For example: + // let x: Foo & (Foo & Bar) = ... + // Because we are returning the implementation locations and not the identifier locations, + // duplicate entries would be returned here as each of the type references is part of + // the same implementation. For that reason, check before we add a new entry + function maybeAdd(a) { + if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { + result.push(a); } - return result; } - function getContainingTypeReference(node) { - var topLevelTypeReference = undefined; - while (node) { - if (ts.isTypeNode(node)) { - topLevelTypeReference = node; - } - node = node.parent; + } + function getSymbolsForClassAndInterfaceComponents(type, result) { + if (result === void 0) { result = []; } + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var componentType = _a[_i]; + if (componentType.symbol && componentType.symbol.getFlags() & (32 /* Class */ | 64 /* Interface */)) { + result.push(componentType.symbol); + } + if (componentType.getFlags() & 196608 /* UnionOrIntersection */) { + getSymbolsForClassAndInterfaceComponents(componentType, result); } - return topLevelTypeReference; } - function getContainingClassIfInHeritageClause(node) { - if (node && node.parent) { - if (node.kind === 199 /* ExpressionWithTypeArguments */ - && node.parent.kind === 256 /* HeritageClause */ - && ts.isClassLike(node.parent.parent)) { - return node.parent.parent; - } - else if (node.kind === 70 /* Identifier */ || node.kind === 177 /* PropertyAccessExpression */) { - return getContainingClassIfInHeritageClause(node.parent); - } + return result; + } + function getContainingTypeReference(node) { + var topLevelTypeReference = undefined; + while (node) { + if (ts.isTypeNode(node)) { + topLevelTypeReference = node; } - return undefined; + node = node.parent; } - /** - * Returns true if this is an expression that can be considered an implementation - */ - function isImplementationExpression(node) { - // Unwrap parentheses - if (node.kind === 183 /* ParenthesizedExpression */) { - return isImplementationExpression(node.expression); + return topLevelTypeReference; + } + function getContainingClassIfInHeritageClause(node) { + if (node && node.parent) { + if (node.kind === 200 /* ExpressionWithTypeArguments */ + && node.parent.kind === 257 /* HeritageClause */ + && ts.isClassLike(node.parent.parent)) { + return node.parent.parent; + } + else if (node.kind === 70 /* Identifier */ || node.kind === 178 /* PropertyAccessExpression */) { + return getContainingClassIfInHeritageClause(node.parent); } - return node.kind === 185 /* ArrowFunction */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 176 /* ObjectLiteralExpression */ || - node.kind === 197 /* ClassExpression */ || - node.kind === 175 /* ArrayLiteralExpression */; } - /** - * Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol - * is an interface, determines if some ancestor of the child symbol extends or inherits from it. - * Also takes in a cache of previous results which makes this slightly more efficient and is - * necessary to avoid potential loops like so: - * class A extends B { } - * class B extends A { } - * - * We traverse the AST rather than using the type checker because users are typically only interested - * in explicit implementations of an interface/class when calling "Go to Implementation". Sibling - * implementations of types that share a common ancestor with the type whose implementation we are - * searching for need to be filtered out of the results. The type checker doesn't let us make the - * distinction between structurally compatible implementations and explicit implementations, so we - * must use the AST. - * - * @param child A class or interface Symbol - * @param parent Another class or interface Symbol - * @param cachedResults A map of symbol id pairs (i.e. "child,parent") to booleans indicating previous results - */ - function explicitlyInheritsFrom(child, parent, cachedResults) { - var parentIsInterface = parent.getFlags() & 64 /* Interface */; - return searchHierarchy(child); - function searchHierarchy(symbol) { - if (symbol === parent) { - return true; - } - var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); - if (key in cachedResults) { - return cachedResults[key]; - } - // Set the key so that we don't infinitely recurse - cachedResults[key] = false; - var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { - if (ts.isClassLike(declaration)) { - if (parentIsInterface) { - var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration); - if (interfaceReferences) { - for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) { - var typeReference = interfaceReferences_1[_i]; - if (searchTypeReference(typeReference)) { - return true; - } + return undefined; + } + /** + * Returns true if this is an expression that can be considered an implementation + */ + function isImplementationExpression(node) { + switch (node.kind) { + case 184 /* ParenthesizedExpression */: + return isImplementationExpression(node.expression); + case 186 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 177 /* ObjectLiteralExpression */: + case 198 /* ClassExpression */: + case 176 /* ArrayLiteralExpression */: + return true; + default: + return false; + } + } + /** + * Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol + * is an interface, determines if some ancestor of the child symbol extends or inherits from it. + * Also takes in a cache of previous results which makes this slightly more efficient and is + * necessary to avoid potential loops like so: + * class A extends B { } + * class B extends A { } + * + * We traverse the AST rather than using the type checker because users are typically only interested + * in explicit implementations of an interface/class when calling "Go to Implementation". Sibling + * implementations of types that share a common ancestor with the type whose implementation we are + * searching for need to be filtered out of the results. The type checker doesn't let us make the + * distinction between structurally compatible implementations and explicit implementations, so we + * must use the AST. + * + * @param child A class or interface Symbol + * @param parent Another class or interface Symbol + * @param cachedResults A map of symbol id pairs (i.e. "child,parent") to booleans indicating previous results + */ + function explicitlyInheritsFrom(child, parent, cachedResults, typeChecker) { + var parentIsInterface = parent.getFlags() & 64 /* Interface */; + return searchHierarchy(child); + function searchHierarchy(symbol) { + if (symbol === parent) { + return true; + } + var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); + var cached = cachedResults.get(key); + if (cached !== undefined) { + return cached; + } + // Set the key so that we don't infinitely recurse + cachedResults.set(key, false); + var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { + if (ts.isClassLike(declaration)) { + if (parentIsInterface) { + var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration); + if (interfaceReferences) { + for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) { + var typeReference = interfaceReferences_1[_i]; + if (searchTypeReference(typeReference)) { + return true; } } } - return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); } - else if (declaration.kind === 228 /* InterfaceDeclaration */) { - if (parentIsInterface) { - return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); - } - } - return false; - }); - cachedResults[key] = inherits; - return inherits; - } - function searchTypeReference(typeReference) { - if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); - if (type && type.symbol) { - return searchHierarchy(type.symbol); + return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + } + else if (declaration.kind === 229 /* InterfaceDeclaration */) { + if (parentIsInterface) { + return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } } return false; + }); + cachedResults.set(key, inherits); + return inherits; + } + function searchTypeReference(typeReference) { + if (typeReference) { + var type = typeChecker.getTypeAtLocation(typeReference); + if (type && type.symbol) { + return searchHierarchy(type.symbol); + } } + return false; + } + } + function getReferencesForSuperKeyword(superKeyword, typeChecker, cancellationToken) { + var searchSpaceNode = ts.getSuperContainer(superKeyword, /*stopOnFunctions*/ false); + if (!searchSpaceNode) { + return undefined; } - function getReferencesForSuperKeyword(superKeyword) { - var searchSpaceNode = ts.getSuperContainer(superKeyword, /*stopOnFunctions*/ false); - if (!searchSpaceNode) { + // Whether 'super' occurs in a static context within a class. + var staticFlag = 32 /* Static */; + switch (searchSpaceNode.kind) { + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + staticFlag &= ts.getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class + break; + default: return undefined; + } + var references = []; + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd(), cancellationToken); + for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) { + var position = possiblePositions_3[_i]; + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 96 /* SuperKeyword */) { + continue; } - // Whether 'super' occurs in a static context within a class. - var staticFlag = 32 /* Static */; - switch (searchSpaceNode.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - staticFlag &= ts.getModifierFlags(searchSpaceNode); - searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class + var container = ts.getSuperContainer(node, /*stopOnFunctions*/ 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. + if (container && (32 /* Static */ & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + references.push(getReferenceEntryFromNode(node)); + } + } + var definition = getDefinition(searchSpaceNode.symbol, superKeyword, typeChecker); + return [{ definition: definition, references: references }]; + } + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, typeChecker, cancellationToken) { + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); + // Whether 'this' occurs in a static context within a class. + var staticFlag = 32 /* Static */; + switch (searchSpaceNode.kind) { + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; - default: + } + // fall through + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + staticFlag &= ts.getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class + break; + case 263 /* SourceFile */: + if (ts.isExternalModule(searchSpaceNode)) { return undefined; - } - var references = []; + } + // Fall through + case 227 /* FunctionDeclaration */: + case 185 /* 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. + default: + return undefined; + } + var references = []; + var possiblePositions; + if (searchSpaceNode.kind === 263 /* SourceFile */) { + ts.forEach(sourceFiles, function (sourceFile) { + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); + }); + } + else { var sourceFile = searchSpaceNode.getSourceFile(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd(), cancellationToken); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); + } + var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); + var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: thisOrSuperKeyword.getSourceFile().fileName, + kind: ts.ScriptElementKind.variableElement, + name: "this", + textSpan: ts.createTextSpanFromNode(thisOrSuperKeyword), + displayParts: displayParts + }, + references: references + }]; + function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 96 /* SuperKeyword */) { + if (!node || !ts.isThis(node)) { return; } - var container = ts.getSuperContainer(node, /*stopOnFunctions*/ 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. - if (container && (32 /* Static */ & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - references.push(getReferenceEntryFromNode(node)); + var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); + switch (searchSpaceNode.kind) { + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + if (searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 198 /* ClassExpression */: + case 228 /* 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 && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 263 /* SourceFile */: + if (container.kind === 263 /* SourceFile */ && !ts.isExternalModule(container)) { + result.push(getReferenceEntryFromNode(node)); + } + break; } }); - var definition = getDefinition(searchSpaceNode.symbol); - return [{ definition: definition, references: references }]; - } - function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { - var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); - // Whether 'this' occurs in a static context within a class. - var staticFlag = 32 /* Static */; - switch (searchSpaceNode.kind) { - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - if (ts.isObjectLiteralMethod(searchSpaceNode)) { - break; - } - // fall through - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - staticFlag &= ts.getModifierFlags(searchSpaceNode); - searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class - break; - case 262 /* SourceFile */: - if (ts.isExternalModule(searchSpaceNode)) { - return undefined; - } - // Fall through - case 226 /* FunctionDeclaration */: - case 184 /* 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. - default: - return undefined; - } - var references = []; - var possiblePositions; - if (searchSpaceNode.kind === 262 /* SourceFile */) { - ts.forEach(sourceFiles, function (sourceFile) { - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); - getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); - }); - } - else { - var sourceFile = searchSpaceNode.getSourceFile(); - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); + } + } + function getReferencesForStringLiteral(node, sourceFiles, typeChecker, cancellationToken) { + var type = ts.getStringLiteralTypeForNode(node, typeChecker); + if (!type) { + // nothing to do here. moving on + return undefined; + } + var references = []; + for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { + var sourceFile = sourceFiles_9[_i]; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ts.ScriptElementKind.variableElement, + name: type.text, + textSpan: ts.createTextSpanFromNode(node), + displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] + }, + references: references + }]; + function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { + for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { + var position = possiblePositions_4[_i]; + cancellationToken.throwIfCancellationRequested(); + var node_2 = ts.getTouchingWord(sourceFile, position); + if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { + return; + } + var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + if (type_2 === searchType) { + references.push(getReferenceEntryFromNode(node_2)); + } } - var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); - var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: "this", - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: displayParts - }, - references: references - }]; - function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || !ts.isThis(node)) { - return; - } - var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); - switch (searchSpaceNode.kind) { - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 197 /* ClassExpression */: - case 227 /* 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 && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 262 /* SourceFile */: - if (container.kind === 262 /* SourceFile */ && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); - } - break; - } - }); + } + } + function populateSearchSymbolSet(symbol, location, typeChecker, implementations) { + // The search set contains at least the current symbol + var result = [symbol]; + // If the location is name of property symbol from object literal destructuring pattern + // Search the property symbol + // for ( { property: p2 } of elems) { } + var containingObjectLiteralElement = getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 260 /* ShorthandPropertyAssignment */) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, typeChecker); + if (propertySymbol) { + result.push(propertySymbol); } } - function getReferencesForStringLiteral(node, sourceFiles) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (!type) { - // nothing to do here. moving on - return undefined; + // If the location is in a context sensitive location (i.e. in an object literal) try + // to get a contextual type for it, and add the property symbol from the contextual + // type to the search set + if (containingObjectLiteralElement) { + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, typeChecker), function (contextualSymbol) { + ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); + }); + /* Because in short-hand property assignment, location has two meaning : property name and as value of the property + * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of + * property name and variable declaration of the identifier. + * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service + * should show both 'name' in 'obj' and 'name' in variable declaration + * const name = "Foo"; + * const obj = { name }; + * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment + * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration + * will be included correctly. + */ + var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol) { + result.push(shorthandValueSymbol); } - var references = []; - for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { - var sourceFile = sourceFiles_9[_i]; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); - getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + // If the symbol.valueDeclaration is a property parameter declaration, + // we should include both parameter declaration symbol and property declaration symbol + // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. + // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 145 /* Parameter */ && + ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { + ts.addRange(result, typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + // If this is symbol of binding element without propertyName declaration in Object binding pattern + // Include the property in the search + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, typeChecker); + if (bindingElementPropertySymbol) { + result.push(bindingElementPropertySymbol); + } + // If this is a union property, add all the symbols from all its source symbols in all unioned types. + // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list + for (var _i = 0, _a = typeChecker.getRootSymbols(symbol); _i < _a.length; _i++) { + var rootSymbol = _a[_i]; + if (rootSymbol !== symbol) { + result.push(rootSymbol); } - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: type.text, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] - }, - references: references - }]; - function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { - for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { - var position = possiblePositions_1[_i]; - cancellationToken.throwIfCancellationRequested(); - var node_3 = ts.getTouchingWord(sourceFile, position); - if (!node_3 || node_3.kind !== 9 /* StringLiteral */) { - return; - } - var type_1 = ts.getStringLiteralTypeForNode(node_3, typeChecker); - if (type_1 === searchType) { - references.push(getReferenceEntryFromNode(node_3)); - } - } + // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions + if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap(), typeChecker); } } - function populateSearchSymbolSet(symbol, location) { - // The search set contains at least the current symbol - var result = [symbol]; - // If the location is name of property symbol from object literal destructuring pattern - // Search the property symbol - // for ( { property: p2 } of elems) { } - var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 259 /* ShorthandPropertyAssignment */) { - var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); - if (propertySymbol) { - result.push(propertySymbol); - } - } - // If the symbol is an alias, add what it aliases to the list - // import {a} from "mod"; - // export {a} - // If the symbol is an alias to default declaration, add what it aliases to the list - // declare "mod" { export default class B { } } - // import B from "mod"; - //// For export specifiers, the exported name can be referring to a local symbol, e.g.: - //// import {a} from "mod"; - //// export {a as somethingElse} - //// We want the *local* declaration of 'a' as declared in the import, - //// *not* as declared within "mod" (or farther) - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); - if (aliasSymbol) { - result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); - } - // If the location is in a context sensitive location (i.e. in an object literal) try - // to get a contextual type for it, and add the property symbol from the contextual - // type to the search set - if (containingObjectLiteralElement) { - ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); - }); - /* Because in short-hand property assignment, location has two meaning : property name and as value of the property - * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of - * property name and variable declaration of the identifier. - * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service - * should show both 'name' in 'obj' and 'name' in variable declaration - * const name = "Foo"; - * const obj = { name }; - * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment - * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration - * will be included correctly. - */ - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); - if (shorthandValueSymbol) { - result.push(shorthandValueSymbol); - } - } - // If the symbol.valueDeclaration is a property parameter declaration, - // we should include both parameter declaration symbol and property declaration symbol - // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. - // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members - if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 /* Parameter */ && - ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { - result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); - } - // If this is symbol of binding element without propertyName declaration in Object binding pattern - // Include the property in the search - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); - if (bindingElementPropertySymbol) { - result.push(bindingElementPropertySymbol); - } - // If this is a union property, add all the symbols from all its source symbols in all unioned types. - // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list - ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { - if (rootSymbol !== symbol) { - result.push(rootSymbol); - } - // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions - if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap()); + return result; + } + /** + * Find symbol of the given property-name and add the symbol to the given result array + * @param symbol a symbol to start searching for the given propertyName + * @param propertyName a name of property to search for + * @param result an array of symbol of found property symbols + * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. + * The value of previousIterationSymbol is undefined when the function is first called. + */ + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, typeChecker) { + if (!symbol) { + return; + } + // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited + // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. + // For example: + // interface C extends C { + // /*findRef*/propName: string; + // } + // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, + // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, + // the function will add any found symbol of the property-name, then its sub-routine will call + // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already + // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. + if (previousIterationSymbolsCache.has(symbol.name)) { + return; + } + if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { + ts.forEach(symbol.getDeclarations(), function (declaration) { + if (ts.isClassLike(declaration)) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); + } + else if (declaration.kind === 229 /* InterfaceDeclaration */) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); - return result; } - /** - * Find symbol of the given property-name and add the symbol to the given result array - * @param symbol a symbol to start searching for the given propertyName - * @param propertyName a name of property to search for - * @param result an array of symbol of found property symbols - * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. - * The value of previousIterationSymbol is undefined when the function is first called. - */ - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { - if (!symbol) { - return; - } - // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited - // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. - // For example: - // interface C extends C { - // /*findRef*/propName: string; - // } - // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, - // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, - // the function will add any found symbol of the property-name, then its sub-routine will call - // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already - // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. - if (symbol.name in previousIterationSymbolsCache) { - return; - } - if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { - ts.forEach(symbol.getDeclarations(), function (declaration) { - if (ts.isClassLike(declaration)) { - getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); - ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); - } - else if (declaration.kind === 228 /* InterfaceDeclaration */) { - ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); - } - }); - } - return; - function getPropertySymbolFromTypeReference(typeReference) { - if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); - if (type) { - var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); - if (propertySymbol) { - result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); - } - // Visit the typeReference as well to see if it directly or indirectly use that property - previousIterationSymbolsCache[symbol.name] = symbol; - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); + return; + function getPropertySymbolFromTypeReference(typeReference) { + if (typeReference) { + var type = typeChecker.getTypeAtLocation(typeReference); + if (type) { + var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); + if (propertySymbol) { + result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); } + // Visit the typeReference as well to see if it directly or indirectly use that property + previousIterationSymbolsCache.set(symbol.name, symbol); + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, typeChecker); } } } - function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) { - if (ts.contains(searchSymbols, referenceSymbol)) { - // If we are searching for constructor uses, they must be 'new' expressions. - return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol; - } - // If the reference symbol is an alias, check if what it is aliasing is one of the search - // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); - if (aliasSymbol) { - return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache); + } + function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache, typeChecker) { + if (ts.contains(searchSymbols, referenceSymbol)) { + // If we are searching for constructor uses, they must be 'new' expressions. + return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) ? referenceSymbol : undefined; + } + // If the reference symbol is an alias, check if what it is aliasing is one of the search + // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation, typeChecker); + if (aliasSymbol) { + return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache, typeChecker); + } + // 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 + var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + if (containingObjectLiteralElement) { + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, typeChecker), function (contextualSymbol) { + return ts.find(typeChecker.getRootSymbols(contextualSymbol), function (symbol) { return ts.contains(searchSymbols, symbol); }); + }); + if (contextualSymbol) { + return contextualSymbol; } - // 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 - var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); - if (containingObjectLiteralElement) { - var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); - }); - if (contextualSymbol) { - return contextualSymbol; - } - // If the reference location is the name of property from object literal destructuring pattern - // Get the property symbol from the object literal's type and look if thats the search symbol - // In below eg. get 'property' from type of elems iterating type - // for ( { property: p2 } of elems) { } - var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); - if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { - return propertySymbol; - } - } - // If the reference location is the binding element and doesn't have property name - // then include the binding element in the related symbols - // let { a } : { a }; - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); - if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { - return bindingElementPropertySymbol; - } - // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) - // Or a union property, use its underlying unioned symbols - return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { - // if it is in the list, then we are done - 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 - // see if any is in the list. If we were passed a parent symbol, only include types that are subtypes of the - // parent symbol - if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - // Parents will only be defined if implementations is true - if (parents) { - if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) { - return undefined; - } + // If the reference location is the name of property from object literal destructuring pattern + // Get the property symbol from the object literal's type and look if thats the search symbol + // In below eg. get 'property' from type of elems iterating type + // for ( { property: p2 } of elems) { } + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, typeChecker); + if (propertySymbol && ts.contains(searchSymbols, propertySymbol)) { + return propertySymbol; + } + } + // If the reference location is the binding element and doesn't have property name + // then include the binding element in the related symbols + // let { a } : { a }; + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, typeChecker); + if (bindingElementPropertySymbol && ts.contains(searchSymbols, bindingElementPropertySymbol)) { + return bindingElementPropertySymbol; + } + // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) + // Or a union property, use its underlying unioned symbols + return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { + // if it is in the list, then we are done + if (ts.contains(searchSymbols, rootSymbol)) { + return rootSymbol; + } + // 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 we were passed a parent symbol, only include types that are subtypes of the + // parent symbol + if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { + // Parents will only be defined if implementations is true + if (parents) { + if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache, typeChecker); })) { + return undefined; } - var result_4 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, /*previousIterationSymbolsCache*/ ts.createMap()); - return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); } - return undefined; - }); - } - function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 142 /* ComputedPropertyName */) { - var nameExpression = node.name.expression; - // treat computed property names where expression is string/numeric literal as just string/numeric literal - if (ts.isStringOrNumericLiteral(nameExpression)) { - return nameExpression.text; - } - return undefined; + var result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap(), typeChecker); + return ts.find(result, function (symbol) { return ts.contains(searchSymbols, symbol); }); } - return node.name.text; - } - function getPropertySymbolsFromContextualType(node) { - var objectLiteral = node.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); - var name = getNameFromObjectLiteralElement(node); - if (name && contextualType) { - var result_5 = []; - var symbol_2 = contextualType.getProperty(name); - if (symbol_2) { - result_5.push(symbol_2); - } - if (contextualType.flags & 65536 /* Union */) { - ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name); - if (symbol) { - result_5.push(symbol); - } - }); - } - return result_5; + return undefined; + }); + } + function getNameFromObjectLiteralElement(node) { + if (node.name.kind === 143 /* ComputedPropertyName */) { + var nameExpression = node.name.expression; + // treat computed property names where expression is string/numeric literal as just string/numeric literal + if (ts.isStringOrNumericLiteral(nameExpression)) { + return nameExpression.text; } return undefined; } - /** Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations - * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class - * then we need to widen the search to include type positions as well. - * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated - * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) - * do not intersect in any of the three spaces. - */ - function getIntersectingMeaningFromDeclarations(meaning, declarations) { - if (declarations) { - var lastIterationMeaning = void 0; - do { - // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module] - // we need to consider both as they initialMeaning intersects with the module in the namespace space, and the module - // intersects with the class in the value space. - // To achieve that we will keep iterating until the result stabilizes. - // Remember the last meaning - lastIterationMeaning = meaning; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; - var declarationMeaning = ts.getMeaningFromDeclaration(declaration); - if (declarationMeaning & meaning) { - meaning |= declarationMeaning; - } + return node.name.text; + } + /** Gets all symbols for one property. Does not get symbols for every property. */ + function getPropertySymbolsFromContextualType(node, typeChecker) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = getNameFromObjectLiteralElement(node); + if (name && contextualType) { + var result_4 = []; + var symbol = contextualType.getProperty(name); + if (symbol) { + result_4.push(symbol); + } + if (contextualType.flags & 65536 /* Union */) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_4.push(symbol); } - } while (meaning !== lastIterationMeaning); + }); } - return meaning; + return result_4; } + return undefined; + } + /** + * Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations + * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class + * then we need to widen the search to include type positions as well. + * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated + * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) + * do not intersect in any of the three spaces. + */ + function getIntersectingMeaningFromDeclarations(meaning, declarations) { + if (declarations) { + var lastIterationMeaning = void 0; + do { + // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module] + // we need to consider both as they initialMeaning intersects with the module in the namespace space, and the module + // intersects with the class in the value space. + // To achieve that we will keep iterating until the result stabilizes. + // Remember the last meaning + lastIterationMeaning = meaning; + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; + var declarationMeaning = ts.getMeaningFromDeclaration(declaration); + if (declarationMeaning & meaning) { + meaning |= declarationMeaning; + } + } + } while (meaning !== lastIterationMeaning); + } + return meaning; } - FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; function convertReferences(referenceSymbols) { if (!referenceSymbols) { return undefined; @@ -71367,7 +71735,7 @@ var ts; if (node.initializer) { return true; } - else if (node.kind === 224 /* VariableDeclaration */) { + else if (node.kind === 225 /* VariableDeclaration */) { var parentStatement = getParentStatementOfVariableDeclaration(node); return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */); } @@ -71377,18 +71745,18 @@ var ts; } else { switch (node.kind) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 230 /* EnumDeclaration */: - case 231 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: return true; } } return false; } function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 206 /* VariableStatement */) { - ts.Debug.assert(node.parent.kind === 225 /* VariableDeclarationList */); + if (node.parent && node.parent.parent && node.parent.parent.kind === 207 /* VariableStatement */) { + ts.Debug.assert(node.parent.kind === 226 /* VariableDeclarationList */); return node.parent.parent; } } @@ -71427,10 +71795,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 191 /* PostfixUnaryExpression */ || parent.kind === 190 /* PrefixUnaryExpression */) { + if (parent.kind === 192 /* PostfixUnaryExpression */ || parent.kind === 191 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 192 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 193 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; return 57 /* FirstAssignment */ <= operator && operator <= 69 /* LastAssignment */; } @@ -71452,7 +71820,7 @@ var ts; switch (node.kind) { case 9 /* StringLiteral */: case 8 /* NumericLiteral */: - if (node.parent.kind === 142 /* ComputedPropertyName */) { + if (node.parent.kind === 143 /* ComputedPropertyName */) { return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; } // intential fall through @@ -71463,11 +71831,11 @@ var ts; } function isObjectLiteralPropertyDeclaration(node) { switch (node.kind) { - case 258 /* PropertyAssignment */: - case 259 /* ShorthandPropertyAssignment */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 259 /* PropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return true; } return false; @@ -71482,6 +71850,9 @@ var ts; } return false; } + function isImportDefaultSymbol(symbol) { + return symbol.declarations[0].kind === 238 /* ImportClause */; + } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); /* @internal */ @@ -71502,11 +71873,9 @@ var ts; // Type reference directives var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { - var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; - if (referenceFile && referenceFile.resolvedFileName) { - return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; - } - return undefined; + var referenceFile = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName); + return referenceFile && referenceFile.resolvedFileName && + [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } var node = ts.getTouchingPropertyName(sourceFile, position); if (node === sourceFile) { @@ -71516,7 +71885,7 @@ var ts; if (ts.isJumpStatementTarget(node)) { var labelName = node.text; var label = ts.getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; + return label ? [createDefinitionInfoFromName(label, ts.ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } var typeChecker = program.getTypeChecker(); var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); @@ -71542,7 +71911,7 @@ var ts; // if (node.kind === 70 /* Identifier */ && (node.parent === declaration || - (declaration.kind === 240 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 239 /* NamedImports */))) { + (declaration.kind === 241 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 240 /* NamedImports */))) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -71551,7 +71920,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 259 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 260 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -71580,13 +71949,13 @@ var ts; return undefined; } if (type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */)) { - var result_6 = []; + var result_5 = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(/*to*/ result_6, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node)); + ts.addRange(/*to*/ result_5, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node)); } }); - return result_6; + return result_5; } if (!type.symbol) { return undefined; @@ -71633,29 +72002,42 @@ var ts; function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { var declarations = []; var definition; - ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 150 /* Constructor */) || - (!selectConstructors && (d.kind === 226 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) { + for (var _i = 0, signatureDeclarations_1 = signatureDeclarations; _i < signatureDeclarations_1.length; _i++) { + var d = signatureDeclarations_1[_i]; + if (selectConstructors ? d.kind === 151 /* Constructor */ : isSignatureDeclaration(d)) { declarations.push(d); if (d.body) definition = d; } - }); - if (definition) { - result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); - return true; } - else if (declarations.length) { - result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); + if (declarations.length) { + result.push(createDefinitionInfo(definition || ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); return true; } return false; } } + function isSignatureDeclaration(node) { + switch (node.kind) { + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + return true; + default: + return false; + } + } + /** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */ function createDefinitionInfo(node, symbolKind, symbolName, containerName) { + return createDefinitionInfoFromName(node.name || node, symbolKind, symbolName, containerName); + } + /** Creates a DefinitionInfo directly from the name of a declaration. */ + function createDefinitionInfoFromName(name, symbolKind, symbolName, containerName) { + var sourceFile = name.getSourceFile(); return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromNode(name, sourceFile), kind: symbolKind, name: symbolName, containerKind: undefined, @@ -71703,7 +72085,12 @@ var ts; } function tryGetSignatureDeclaration(typeChecker, node) { var callLike = getAncestorCallLikeExpression(node); - return callLike && typeChecker.getResolvedSignature(callLike).declaration; + var decl = callLike && typeChecker.getResolvedSignature(callLike).declaration; + if (decl && isSignatureDeclaration(decl)) { + return decl; + } + // Don't go to a function type, go to the value having that type. + return undefined; } })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); })(ts || (ts = {})); @@ -71715,7 +72102,7 @@ var ts; function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 259 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 260 /* ShorthandPropertyAssignment */) { var result = []; ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); return result.length > 0 ? result : undefined; @@ -71728,7 +72115,7 @@ var ts; } else { // Perform "Find all References" and retrieve only those that are implementations - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, /*findInStrings*/ false, /*findInComments*/ false, /*implementations*/ true); + var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, /*findInStrings*/ false, /*findInComments*/ false, /*isForRename*/ false, /*implementations*/ true); var result = ts.flatMap(referencedSymbols, function (symbol) { return ts.map(symbol.references, function (_a) { var textSpan = _a.textSpan, fileName = _a.fileName; @@ -71882,19 +72269,19 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 150 /* Constructor */: - case 227 /* ClassDeclaration */: - case 206 /* VariableStatement */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 151 /* Constructor */: + case 228 /* ClassDeclaration */: + case 207 /* VariableStatement */: break findOwner; - case 262 /* SourceFile */: + case 263 /* SourceFile */: return undefined; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - if (commentOwner.parent.kind === 231 /* ModuleDeclaration */) { + if (commentOwner.parent.kind === 232 /* ModuleDeclaration */) { return undefined; } break findOwner; @@ -71941,7 +72328,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 206 /* VariableStatement */) { + if (commentOwner.kind === 207 /* VariableStatement */) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -71959,17 +72346,17 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 183 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 184 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return rightHandSide.parameters; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150 /* Constructor */) { + if (member.kind === 151 /* Constructor */) { return member.parameters; } } @@ -72027,7 +72414,7 @@ var ts; }); if (!safeList) { var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMap(result.config) : EmptySafeList; + safeList = result.config ? ts.createMapFromTemplate(result.config) : EmptySafeList; } var filesToWatch = []; // Directories to search for package.json, bower.json and other typing information @@ -72054,33 +72441,33 @@ var ts; if (unresolvedImports) { for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { var moduleId = unresolvedImports_1[_a]; - var typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; + var typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); } } } // Add the cached typing locations for inferred typings that are already installed - for (var name_47 in packageNameToTypingLocation) { - if (name_47 in inferredTypings && !inferredTypings[name_47]) { - inferredTypings[name_47] = packageNameToTypingLocation[name_47]; + packageNameToTypingLocation.forEach(function (typingLocation, name) { + if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { + inferredTypings.set(name, typingLocation); } - } + }); // Remove typings that the user has added to the exclude list for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { var excludeTypingName = exclude_1[_b]; - delete inferredTypings[excludeTypingName]; + inferredTypings.delete(excludeTypingName); } var newTypingNames = []; var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); + inferredTypings.forEach(function (inferred, typing) { + if (inferred !== undefined) { + cachedTypingPaths.push(inferred); } else { newTypingNames.push(typing); } - } + }); return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; /** * Merge a given list of typingNames to the inferredTypings map @@ -72091,8 +72478,8 @@ var ts; } for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; + if (!inferredTypings.has(typing)) { + inferredTypings.set(typing, undefined); } } } @@ -72131,7 +72518,7 @@ var ts; var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); if (safeList !== EmptySafeList) { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return safeList.has(f); })); } var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2 /* JSX */; }); if (hasJsxFile) { @@ -72174,7 +72561,7 @@ var ts; } if (packageJson.typings) { var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; + inferredTypings.set(packageJson.name, absolutePath); } else { typingNames.push(packageJson.name); @@ -72194,21 +72581,18 @@ var ts; function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; - // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] - ts.forEach(sourceFiles, function (sourceFile) { + var _loop_4 = function (sourceFile) { cancellationToken.throwIfCancellationRequested(); if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) { - return; + return "continue"; } - var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_48 in nameToDeclarations) { - var declarations = nameToDeclarations[name_48]; + ts.forEachEntry(sourceFile.getNamedDeclarations(), function (declarations, name) { if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_48); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); if (!matches) { - continue; + return; // continue to next named declarations } for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; @@ -72217,24 +72601,29 @@ var ts; if (patternMatcher.patternContainsDots) { var containers = getContainers(declaration); if (!containers) { - return undefined; + return true; // Break out of named declarations and go to the next source file. } - matches = patternMatcher.getMatches(containers, name_48); + matches = patternMatcher.getMatches(containers, name); if (!matches) { - continue; + return; // continue to next named declarations } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_48, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } - } - }); + }); + }; + // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] + for (var _i = 0, sourceFiles_10 = sourceFiles; _i < sourceFiles_10.length; _i++) { + var sourceFile = sourceFiles_10[_i]; + _loop_4(sourceFile); + } // Remove imports when the imported declaration is already in the list and has the same name. rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 237 /* ImportClause */ || decl.kind === 240 /* ImportSpecifier */ || decl.kind === 235 /* ImportEqualsDeclaration */) { + if (decl.kind === 238 /* ImportClause */ || decl.kind === 241 /* ImportSpecifier */ || decl.kind === 236 /* ImportEqualsDeclaration */) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -72276,7 +72665,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 142 /* ComputedPropertyName */) { + else if (declaration.name.kind === 143 /* ComputedPropertyName */) { return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true); } else { @@ -72297,7 +72686,7 @@ var ts; } return true; } - if (expression.kind === 177 /* PropertyAccessExpression */) { + if (expression.kind === 178 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -72310,7 +72699,7 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 142 /* ComputedPropertyName */) { + if (declaration.name.kind === 143 /* ComputedPropertyName */) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) { return undefined; } @@ -72356,7 +72745,7 @@ var ts; matchKind: ts.PatternMatchKind[rawItem.matchKind], isCaseSensitive: rawItem.isCaseSensitive, fileName: rawItem.fileName, - textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + textSpan: ts.createTextSpanFromNode(declaration), // TODO(jfreeman): What should be the containerName when the container has a computed name? containerName: container && container.name ? container.name.text : "", containerKind: container && container.name ? ts.getNodeKind(container) : "" @@ -72463,7 +72852,7 @@ var ts; return; } switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -72475,21 +72864,21 @@ var ts; } } break; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 149 /* MethodSignature */: if (!ts.hasDynamicName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: if (!ts.hasDynamicName(node)) { addLeafNode(node); } break; - case 237 /* ImportClause */: + case 238 /* ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -72501,7 +72890,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 238 /* NamespaceImport */) { + if (namedBindings.kind === 239 /* NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -72512,12 +72901,12 @@ var ts; } } break; - case 174 /* BindingElement */: - case 224 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 225 /* VariableDeclaration */: var decl = node; - var name_49 = decl.name; - if (ts.isBindingPattern(name_49)) { - addChildrenRecursively(name_49); + var name = decl.name; + if (ts.isBindingPattern(name)) { + addChildrenRecursively(name); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { // For `const x = function() {}`, just use the function node, not the const. @@ -72527,12 +72916,12 @@ var ts; addNodeWithRecursiveChild(decl, decl.initializer); } break; - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -72542,9 +72931,9 @@ var ts; } endNode(); break; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -72552,21 +72941,21 @@ var ts; } endNode(); break; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 244 /* ExportSpecifier */: - case 235 /* ImportEqualsDeclaration */: - case 155 /* IndexSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 229 /* TypeAliasDeclaration */: + case 245 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 156 /* IndexSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 230 /* TypeAliasDeclaration */: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 286 /* JSDocTypedefTag */) { + if (tag.kind === 287 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -72584,9 +72973,9 @@ var ts; // Anonymous items are never merged. return true; } - var itemsWithSameName = nameToItems[name]; + var itemsWithSameName = nameToItems.get(name); if (!itemsWithSameName) { - nameToItems[name] = child; + nameToItems.set(name, child); return true; } if (itemsWithSameName instanceof Array) { @@ -72604,7 +72993,7 @@ var ts; if (tryMerge(itemWithSameName, child)) { return false; } - nameToItems[name] = [itemWithSameName, child]; + nameToItems.set(name, [itemWithSameName, child]); return true; } function tryMerge(a, b) { @@ -72617,14 +73006,14 @@ var ts; }); /** a and b have the same name, but they may not be mergeable. */ function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 231 /* ModuleDeclaration */ || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 232 /* ModuleDeclaration */ || areSameModule(a, b)); // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes. // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'! function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 231 /* ModuleDeclaration */) { + if (a.body.kind !== 232 /* ModuleDeclaration */) { return true; } return areSameModule(a.body, b.body); @@ -72652,39 +73041,20 @@ var ts; function compareChildren(child1, child2) { var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node); if (name1 && name2) { - var cmp = localeCompareFix(name1, name2); + var cmp = ts.compareStringsCaseInsensitive(name1, name2); return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } else { return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } } - // Intl is missing in Safari, and node 0.10 treats "a" as greater than "B". - var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; - var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) { - // This isn't perfect, but it passes all of our tests. - for (var i = 0; i < Math.min(a.length, b.length); i++) { - var chA = a.charAt(i), chB = b.charAt(i); - if (chA === "\"" && chB === "'") { - return 1; - } - if (chA === "'" && chB === "\"") { - return -1; - } - var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase()); - if (cmp !== 0) { - return cmp; - } - } - return a.length - b.length; - }; /** * This differs from getItemName because this is just used for sorting. * We only sort nodes by name that have a more-or-less "direct" name, as opposed to `new()` and the like. * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 231 /* ModuleDeclaration */) { + if (node.kind === 232 /* ModuleDeclaration */) { return getModuleName(node); } var decl = node; @@ -72692,18 +73062,18 @@ var ts; return ts.getPropertyNameForPropertyNameNode(decl.name); } switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 197 /* ClassExpression */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 198 /* ClassExpression */: return getFunctionOrClassName(node); - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 231 /* ModuleDeclaration */) { + if (node.kind === 232 /* ModuleDeclaration */) { return getModuleName(node); } var name = node.name; @@ -72714,16 +73084,16 @@ var ts; } } switch (node.kind) { - case 262 /* SourceFile */: + case 263 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; } @@ -72731,15 +73101,15 @@ var ts; // (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the // navigation bar. return getFunctionOrClassName(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return "constructor"; - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: return "new()"; - case 153 /* CallSignature */: + case 154 /* CallSignature */: return "()"; - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return "[]"; - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -72751,7 +73121,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 206 /* VariableStatement */) { + if (parentNode && parentNode.kind === 207 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -72780,24 +73150,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 230 /* EnumDeclaration */: - case 228 /* InterfaceDeclaration */: - case 231 /* ModuleDeclaration */: - case 262 /* SourceFile */: - case 229 /* TypeAliasDeclaration */: - case 286 /* JSDocTypedefTag */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 231 /* EnumDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 263 /* SourceFile */: + case 230 /* TypeAliasDeclaration */: + case 287 /* JSDocTypedefTag */: return true; - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 224 /* VariableDeclaration */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 225 /* VariableDeclaration */: return hasSomeImportantChild(item); - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -72807,10 +73177,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 232 /* ModuleBlock */: - case 262 /* SourceFile */: - case 149 /* MethodDeclaration */: - case 150 /* Constructor */: + case 233 /* ModuleBlock */: + case 263 /* SourceFile */: + case 150 /* MethodDeclaration */: + case 151 /* Constructor */: return true; default: return hasSomeImportantChild(item); @@ -72819,7 +73189,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 224 /* VariableDeclaration */ && childKind !== 174 /* BindingElement */; + return childKind !== 225 /* VariableDeclaration */ && childKind !== 175 /* BindingElement */; }); } } @@ -72830,7 +73200,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToTree) }; @@ -72839,7 +73209,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray, indent: n.indent, @@ -72877,7 +73247,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 231 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 232 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -72888,28 +73258,34 @@ var ts; * We store 'A' as associated with a NavNode, and use getModuleName to traverse down again. */ function getInteriorModule(decl) { - return decl.body.kind === 231 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 232 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 142 /* ComputedPropertyName */; + return !member.name || member.name.kind === 143 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 262 /* SourceFile */ + return node.kind === 263 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); + : ts.createTextSpanFromNode(node, curSourceFile); + } + function getModifiers(node) { + if (node.parent && node.parent.kind === 225 /* VariableDeclaration */) { + node = node.parent; + } + return ts.getNodeModifiers(node); } function getFunctionOrClassName(node) { if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 224 /* VariableDeclaration */) { + else if (node.parent.kind === 225 /* VariableDeclaration */) { return ts.declarationNameToString(node.parent.name); } - else if (node.parent.kind === 192 /* BinaryExpression */ && + else if (node.parent.kind === 193 /* BinaryExpression */ && node.parent.operatorToken.kind === 57 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 258 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 259 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512 /* Default */) { @@ -72920,7 +73296,7 @@ var ts; } } function isFunctionOrClassExpression(node) { - return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */ || node.kind === 197 /* ClassExpression */; + return node.kind === 185 /* FunctionExpression */ || node.kind === 186 /* ArrowFunction */ || node.kind === 198 /* ClassExpression */; } /** * Matches all whitespace characters in a string. Eg: @@ -72950,7 +73326,7 @@ var ts; if (hintSpanNode && startElement && endElement) { var span_12 = { textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), - hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + hintSpan: ts.createTextSpanFromNode(hintSpanNode, sourceFile), bannerText: collapseText, autoCollapse: autoCollapse }; @@ -73010,7 +73386,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 185 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 186 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -73022,30 +73398,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 205 /* Block */: + case 206 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_20 = n.parent; + var parent = n.parent; var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_20.kind === 210 /* DoStatement */ || - parent_20.kind === 213 /* ForInStatement */ || - parent_20.kind === 214 /* ForOfStatement */ || - parent_20.kind === 212 /* ForStatement */ || - parent_20.kind === 209 /* IfStatement */ || - parent_20.kind === 211 /* WhileStatement */ || - parent_20.kind === 218 /* WithStatement */ || - parent_20.kind === 257 /* CatchClause */) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + if (parent.kind === 211 /* DoStatement */ || + parent.kind === 214 /* ForInStatement */ || + parent.kind === 215 /* ForOfStatement */ || + parent.kind === 213 /* ForStatement */ || + parent.kind === 210 /* IfStatement */ || + parent.kind === 212 /* WhileStatement */ || + parent.kind === 219 /* WithStatement */ || + parent.kind === 258 /* CatchClause */) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_20.kind === 222 /* TryStatement */) { + if (parent.kind === 223 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_20; + var tryStatement = parent; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -73058,7 +73434,7 @@ var ts; } // Block was a standalone block. In this case we want to only collapse // the span of the block, independent of any parent span. - var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end); + var span_14 = ts.createTextSpanFromNode(n); elements.push({ textSpan: span_14, hintSpan: span_14, @@ -73068,23 +73444,23 @@ var ts; break; } // Fallthrough. - case 232 /* ModuleBlock */: { + case 233 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 176 /* ObjectLiteralExpression */: - case 233 /* CaseBlock */: { + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 177 /* ObjectLiteralExpression */: + case 234 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 20 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 21 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -73180,10 +73556,11 @@ var ts; return totalMatch; } function getWordSpans(word) { - if (!(word in stringToWordSpans)) { - stringToWordSpans[word] = breakIntoWordSpans(word); + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - return stringToWordSpans[word]; + return spans; } function matchTextChunk(candidate, chunk, punctuationStripped) { var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); @@ -73758,7 +74135,7 @@ var ts; else { if (token === 70 /* Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import d from "mod"; @@ -73789,7 +74166,7 @@ var ts; } if (token === 17 /* CloseBraceToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import {a as A} from "mod"; @@ -73805,7 +74182,7 @@ var ts; token = nextToken(); if (token === 70 /* Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import * as NS from "mod" @@ -73835,7 +74212,7 @@ var ts; } if (token === 17 /* CloseBraceToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // export {a as A} from "mod"; @@ -73847,7 +74224,7 @@ var ts; } else if (token === 38 /* AsteriskToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // export * from "mod" @@ -73999,93 +74376,85 @@ var ts; var Rename; (function (Rename) { function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) { - var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); + var getCanonicalDefaultLibName = ts.memoize(function () { return getCanonicalFileName(ts.normalizePath(defaultLibFileName)); }); var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true); - if (node) { - if (node.kind === 70 /* Identifier */ || - node.kind === 9 /* StringLiteral */ || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - ts.isThis(node)) { - var symbol = typeChecker.getSymbolAtLocation(node); - // Only allow a symbol to be renamed if it actually has at least one declaration. - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - // Disallow rename for elements that are defined in the standard TypeScript library. - if (ts.forEach(declarations, isDefinedInLibraryFile)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - if (kind) { - return { - canRename: true, - kind: kind, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } - else if (node.kind === 9 /* StringLiteral */) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (type) { - if (isDefinedInLibraryFile(node)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - else { - var displayName = ts.stripQuotes(type.text); - return { - canRename: true, - kind: ts.ScriptElementKind.variableElement, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: displayName, - kindModifiers: ts.ScriptElementKindModifier.none, - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } + var renameInfo = node && nodeIsEligibleForRename(node) + ? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) + : undefined; + return renameInfo || getRenameInfoError(ts.Diagnostics.You_cannot_rename_this_element); + function isDefinedInLibraryFile(declaration) { + if (!defaultLibFileName) { + return false; } + var sourceFile = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName)); + return canonicalName === getCanonicalDefaultLibName(); } - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element)); - function getRenameInfoError(localizedErrorMessage) { - return { - canRename: false, - localizedErrorMessage: localizedErrorMessage, - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }; - } - function isDefinedInLibraryFile(declaration) { - if (defaultLibFileName) { - var sourceFile_1 = declaration.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)); - if (canonicalName === canonicalDefaultLibName) { - return true; + } + Rename.getRenameInfo = getRenameInfo; + function getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) { + var symbol = typeChecker.getSymbolAtLocation(node); + // Only allow a symbol to be renamed if it actually has at least one declaration. + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + // Disallow rename for elements that are defined in the standard TypeScript library. + if (ts.some(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); + return kind ? getRenameInfoSuccess(displayName, typeChecker.getFullyQualifiedName(symbol), kind, ts.SymbolDisplay.getSymbolModifiers(symbol), node, sourceFile) : undefined; } - return false; } - function createTriggerSpanForNode(node, sourceFile) { - var start = node.getStart(sourceFile); - var width = node.getWidth(sourceFile); - if (node.kind === 9 /* StringLiteral */) { - // Exclude the quotes - start += 1; - width -= 2; + else if (node.kind === 9 /* StringLiteral */) { + var type = ts.getStringLiteralTypeForNode(node, typeChecker); + if (type) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); + } + var displayName = ts.stripQuotes(type.text); + return getRenameInfoSuccess(displayName, displayName, ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, node, sourceFile); } - return ts.createTextSpan(start, width); } } - Rename.getRenameInfo = getRenameInfo; + function getRenameInfoSuccess(displayName, fullDisplayName, kind, kindModifiers, node, sourceFile) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: fullDisplayName, + kindModifiers: kindModifiers, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + function getRenameInfoError(diagnostic) { + return { + canRename: false, + localizedErrorMessage: ts.getLocaleSpecificMessage(diagnostic), + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9 /* StringLiteral */) { + // Exclude the quotes + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } + function nodeIsEligibleForRename(node) { + return node.kind === 70 /* Identifier */ || node.kind === 9 /* StringLiteral */ || + ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + ts.isThis(node); + } })(Rename = ts.Rename || (ts.Rename = {})); })(ts || (ts = {})); /// @@ -74263,7 +74632,7 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 179 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 180 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -74271,7 +74640,7 @@ var ts; var expression = callExpression.expression; var name = expression.kind === 70 /* Identifier */ ? expression - : expression.kind === 177 /* PropertyAccessExpression */ + : expression.kind === 178 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -74281,7 +74650,7 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameToDeclarations = sourceFile.getNamedDeclarations(); - var declarations = nameToDeclarations[name.text]; + var declarations = nameToDeclarations.get(name.text); if (declarations) { for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) { var declaration = declarations_10[_b]; @@ -74304,7 +74673,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { - if (node.parent.kind === 179 /* CallExpression */ || node.parent.kind === 180 /* NewExpression */) { + if (node.parent.kind === 180 /* CallExpression */ || node.parent.kind === 181 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -74358,25 +74727,25 @@ var ts; } return undefined; } - else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 182 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0, sourceFile); } } - else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 182 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 195 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 203 /* TemplateSpan */ && node.parent.parent.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 204 /* TemplateSpan */ && node.parent.parent.parent.kind === 182 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 195 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 15 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -74387,6 +74756,7 @@ var ts; } return undefined; } + SignatureHelp.getImmediatelyContainingArgumentInfo = getImmediatelyContainingArgumentInfo; function getArgumentIndex(argumentsList, node) { // The list we got back can include commas. In the presence of errors it may // also just have nodes without commas. For example "Foo(a b c)" will have 3 @@ -74494,7 +74864,7 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 194 /* TemplateExpression */) { + if (template.kind === 195 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -74503,7 +74873,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 262 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 263 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -74648,7 +75018,7 @@ var ts; function getSymbolKind(typeChecker, symbol, location) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 198 /* ClassExpression */) ? ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ts.ScriptElementKind.enumElement; @@ -74754,7 +75124,7 @@ var ts; var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 177 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 178 /* 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)) { @@ -74763,7 +75133,7 @@ var ts; } // try get the call/construct signature from the type if it matches var callExpression = void 0; - if (location.kind === 179 /* CallExpression */ || location.kind === 180 /* NewExpression */) { + if (location.kind === 180 /* CallExpression */ || location.kind === 181 /* NewExpression */) { callExpression = location; } else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) { @@ -74776,7 +75146,7 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 180 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 181 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -74829,24 +75199,24 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 150 /* Constructor */)) { + (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 151 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 150 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration.kind === 151 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 150 /* Constructor */) { + if (functionDeclaration.kind === 151 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ts.ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 154 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -74855,7 +75225,7 @@ var ts; } } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { - if (ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 198 /* 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 @@ -74878,7 +75248,7 @@ var ts; } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(136 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(137 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -74899,7 +75269,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 231 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 232 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 70 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 128 /* NamespaceKeyword */ : 127 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -74920,28 +75290,28 @@ var ts; } else { // Method/function type parameter - var declaration = ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */); + var declaration = ts.getDeclarationOfKind(symbol, 144 /* TypeParameter */); ts.Debug.assert(declaration !== undefined); declaration = declaration.parent; if (declaration) { if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 154 /* ConstructSignature */) { + if (declaration.kind === 155 /* ConstructSignature */) { displayParts.push(ts.keywordPart(93 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 153 /* CallSignature */ && declaration.name) { + else if (declaration.kind !== 154 /* CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 229 /* TypeAliasDeclaration */) { + else if (declaration.kind === 230 /* TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(136 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(137 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -74952,7 +75322,7 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 261 /* EnumMember */) { + if (declaration.kind === 262 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -74964,7 +75334,7 @@ var ts; } if (symbolFlags & 8388608 /* Alias */) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 234 /* NamespaceExportDeclaration */) { + if (symbol.declarations[0].kind === 235 /* NamespaceExportDeclaration */) { displayParts.push(ts.keywordPart(83 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128 /* NamespaceKeyword */)); @@ -74975,7 +75345,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 235 /* ImportEqualsDeclaration */) { + if (declaration.kind === 236 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -75048,10 +75418,10 @@ var ts; // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 262 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 263 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 192 /* BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 193 /* BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -75132,16 +75502,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 184 /* FunctionExpression */) { + if (declaration.kind === 185 /* FunctionExpression */) { return true; } - if (declaration.kind !== 224 /* VariableDeclaration */ && declaration.kind !== 226 /* FunctionDeclaration */) { + if (declaration.kind !== 225 /* VariableDeclaration */ && declaration.kind !== 227 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { + for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent_21.kind === 262 /* SourceFile */ || parent_21.kind === 232 /* ModuleBlock */) { + if (parent.kind === 263 /* SourceFile */ || parent.kind === 233 /* ModuleBlock */) { return false; } } @@ -75194,7 +75564,7 @@ var ts; sourceFile.moduleName = transpileOptions.moduleName; } if (transpileOptions.renamedDependencies) { - sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies); + sourceFile.renamedDependencies = ts.createMapFromTemplate(transpileOptions.renamedDependencies); } var newLine = ts.getNewLineCharacter(options); // Output @@ -75249,10 +75619,10 @@ var ts; function fixupCompilerOptions(options, diagnostics) { // Lazily create this value to fix module loading errors. commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { - return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); + return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_3 = function (opt) { + var _loop_5 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -75263,7 +75633,7 @@ var ts; options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics); } else { - if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) { + if (!ts.forEachEntry(opt.type, function (v) { return v === value; })) { // Supplied value isn't a valid enum value. diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt)); } @@ -75271,7 +75641,7 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_3(opt); + _loop_5(opt); } return options; } @@ -75379,10 +75749,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 251 /* JsxAttribute */: - case 249 /* JsxOpeningElement */: - case 250 /* JsxClosingElement */: - case 248 /* JsxSelfClosingElement */: + case 252 /* JsxAttribute */: + case 250 /* JsxOpeningElement */: + case 251 /* JsxClosingElement */: + case 249 /* JsxSelfClosingElement */: return node.kind === 70 /* Identifier */; } } @@ -75794,7 +76164,7 @@ var ts; this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Space after }. - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromRange(0 /* FirstToken */, 140 /* LastToken */, [19 /* CloseParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromRange(0 /* FirstToken */, 141 /* LastToken */, [19 /* CloseParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, 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(17 /* CloseBraceToken */, 81 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 105 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); @@ -75859,7 +76229,7 @@ var ts; this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101 /* TryKeyword */, 86 /* FinallyKeyword */]), 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 133 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 134 /* SetKeyword */]), 70 /* 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.IsNonJsxSameLineTokenContext, 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.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); @@ -75870,8 +76240,8 @@ var ts; // 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([127 /* ModuleKeyword */, 131 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 130 /* ReadonlyKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */, 126 /* KeyOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 138 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 130 /* ReadonlyKeyword */, 134 /* SetKeyword */, 114 /* StaticKeyword */, 137 /* TypeKeyword */, 139 /* FromKeyword */, 126 /* KeyOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 139 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); // Lambda expressions @@ -75891,7 +76261,7 @@ var ts; // decorators this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 133 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 134 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115 /* YieldKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); @@ -76021,9 +76391,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_50 in o) { - if (o[name_50] === rule) { - return name_50; + for (var name in o) { + if (o[name] === rule) { + return name; } } throw new Error("Unknown rule"); @@ -76032,44 +76402,44 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 212 /* ForStatement */; + return context.contextNode.kind === 213 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 192 /* BinaryExpression */: - case 193 /* ConditionalExpression */: - case 200 /* AsExpression */: - case 244 /* ExportSpecifier */: - case 240 /* ImportSpecifier */: - case 156 /* TypePredicate */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 193 /* BinaryExpression */: + case 194 /* ConditionalExpression */: + case 201 /* AsExpression */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 157 /* TypePredicate */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 174 /* BindingElement */: + case 175 /* BindingElement */: // equals in type X = ... - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: // equal in p = 0; - case 144 /* Parameter */: - case 261 /* EnumMember */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 145 /* Parameter */: + case 262 /* EnumMember */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return context.currentTokenSpan.kind === 57 /* EqualsToken */ || context.nextTokenSpan.kind === 57 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: // "in" keyword in [P in keyof T]: T[P] - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return context.currentTokenSpan.kind === 91 /* InKeyword */ || context.nextTokenSpan.kind === 91 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 214 /* ForOfStatement */: - return context.currentTokenSpan.kind === 140 /* OfKeyword */ || context.nextTokenSpan.kind === 140 /* OfKeyword */; + case 215 /* ForOfStatement */: + return context.currentTokenSpan.kind === 141 /* OfKeyword */ || context.nextTokenSpan.kind === 141 /* OfKeyword */; } return false; }; @@ -76077,7 +76447,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 193 /* ConditionalExpression */; + return context.contextNode.kind === 194 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -76099,7 +76469,7 @@ var ts; return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; Rules.IsBraceWrappedContext = function (context) { - return context.contextNode.kind === 172 /* ObjectBindingPattern */ || Rules.IsSingleLineBlockContext(context); + return context.contextNode.kind === 173 /* ObjectBindingPattern */ || Rules.IsSingleLineBlockContext(context); }; // This check is done before an open brace in a control construct, a function, or a typescript block declaration Rules.IsBeforeMultilineBlockContext = function (context) { @@ -76124,70 +76494,70 @@ var ts; return true; } switch (node.kind) { - case 205 /* Block */: - case 233 /* CaseBlock */: - case 176 /* ObjectLiteralExpression */: - case 232 /* ModuleBlock */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 177 /* ObjectLiteralExpression */: + case 233 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: // case SyntaxKind.MethodSignature: - case 153 /* CallSignature */: - case 184 /* FunctionExpression */: - case 150 /* Constructor */: - case 185 /* ArrowFunction */: + case 154 /* CallSignature */: + case 185 /* FunctionExpression */: + case 151 /* Constructor */: + case 186 /* ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 226 /* FunctionDeclaration */ || context.contextNode.kind === 184 /* FunctionExpression */; + return context.contextNode.kind === 227 /* FunctionDeclaration */ || context.contextNode.kind === 185 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 161 /* TypeLiteral */: - case 231 /* ModuleDeclaration */: - case 242 /* ExportDeclaration */: - case 243 /* NamedExports */: - case 236 /* ImportDeclaration */: - case 239 /* NamedImports */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 162 /* TypeLiteral */: + case 232 /* ModuleDeclaration */: + case 243 /* ExportDeclaration */: + case 244 /* NamedExports */: + case 237 /* ImportDeclaration */: + case 240 /* NamedImports */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 227 /* ClassDeclaration */: - case 231 /* ModuleDeclaration */: - case 230 /* EnumDeclaration */: - case 257 /* CatchClause */: - case 232 /* ModuleBlock */: - case 219 /* SwitchStatement */: + case 228 /* ClassDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 258 /* CatchClause */: + case 233 /* ModuleBlock */: + case 220 /* SwitchStatement */: return true; - case 205 /* Block */: { + case 206 /* Block */: { var blockParent = context.currentTokenParent.parent; - if (blockParent.kind !== 185 /* ArrowFunction */ && - blockParent.kind !== 184 /* FunctionExpression */) { + if (blockParent.kind !== 186 /* ArrowFunction */ && + blockParent.kind !== 185 /* FunctionExpression */) { return true; } } @@ -76196,31 +76566,31 @@ var ts; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 209 /* IfStatement */: - case 219 /* SwitchStatement */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 211 /* WhileStatement */: - case 222 /* TryStatement */: - case 210 /* DoStatement */: - case 218 /* WithStatement */: + case 210 /* IfStatement */: + case 220 /* SwitchStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 212 /* WhileStatement */: + case 223 /* TryStatement */: + case 211 /* DoStatement */: + case 219 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 257 /* CatchClause */: + case 258 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 176 /* ObjectLiteralExpression */; + return context.contextNode.kind === 177 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 179 /* CallExpression */; + return context.contextNode.kind === 180 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 180 /* NewExpression */; + return context.contextNode.kind === 181 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -76232,25 +76602,25 @@ var ts; return context.nextTokenSpan.kind !== 21 /* CloseBracketToken */; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 185 /* ArrowFunction */; + return context.contextNode.kind === 186 /* ArrowFunction */; }; Rules.IsNonJsxSameLineTokenContext = function (context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 247 /* JsxElement */; + return context.contextNode.kind !== 248 /* JsxElement */; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 253 /* JsxExpression */; + return context.contextNode.kind === 254 /* JsxExpression */; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 251 /* JsxAttribute */; + return context.nextTokenParent.kind === 252 /* JsxAttribute */; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 251 /* JsxAttribute */; + return context.contextNode.kind === 252 /* JsxAttribute */; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 248 /* JsxSelfClosingElement */; + return context.contextNode.kind === 249 /* JsxSelfClosingElement */; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -76265,42 +76635,42 @@ var ts; while (ts.isPartOfExpression(node)) { node = node.parent; } - return node.kind === 145 /* Decorator */; + return node.kind === 146 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 225 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 226 /* 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 === 231 /* ModuleDeclaration */; + return context.contextNode.kind === 232 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 161 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 162 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 26 /* LessThanToken */ && token.kind !== 28 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 157 /* TypeReference */: - case 182 /* TypeAssertionExpression */: - case 229 /* TypeAliasDeclaration */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 199 /* ExpressionWithTypeArguments */: + case 158 /* TypeReference */: + case 183 /* TypeAssertionExpression */: + case 230 /* TypeAliasDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 200 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -76311,16 +76681,16 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 182 /* TypeAssertionExpression */; + return context.contextNode.kind === 183 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 188 /* VoidExpression */; + return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 189 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 195 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 196 /* YieldExpression */ && context.contextNode.expression !== undefined; }; Rules.IsNonNullAssertionContext = function (context) { - return context.contextNode.kind === 201 /* NonNullExpression */; + return context.contextNode.kind === 202 /* NonNullExpression */; }; return Rules; }()); @@ -76344,7 +76714,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 140 /* LastToken */ + 1; + this.mapRowLength = 141 /* 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); @@ -76358,7 +76728,7 @@ var ts; }); }; RulesMap.prototype.GetRuleBucketIndex = function (row, column) { - ts.Debug.assert(row <= 140 /* LastKeyword */ && column <= 140 /* LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 141 /* LastKeyword */ && column <= 141 /* LastKeyword */, "Must compute formatting context from tokens"); var rulesBucketIndex = (row * this.mapRowLength) + column; return rulesBucketIndex; }; @@ -76539,7 +76909,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 140 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 141 /* LastToken */; token++) { result.push(token); } return result; @@ -76583,9 +76953,9 @@ var ts; }()); TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 140 /* LastKeyword */); + TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 141 /* LastKeyword */); TokenRange.BinaryOperators = TokenRange.FromRange(26 /* FirstBinaryOperator */, 69 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 140 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 141 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42 /* PlusPlusToken */, 43 /* MinusMinusToken */, 51 /* TildeToken */, 50 /* ExclamationToken */]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 70 /* Identifier */, 18 /* OpenParenToken */, 20 /* OpenBracketToken */, 16 /* OpenBraceToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); @@ -76593,7 +76963,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 19 /* CloseParenToken */, 21 /* CloseBracketToken */, 93 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 134 /* StringKeyword */, 121 /* BooleanKeyword */, 135 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 135 /* StringKeyword */, 121 /* BooleanKeyword */, 136 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -76864,17 +77234,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 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 232 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 262 /* SourceFile */: - case 205 /* Block */: - case 232 /* ModuleBlock */: + return body && body.kind === 233 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 263 /* SourceFile */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -77079,20 +77449,20 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 227 /* ClassDeclaration */: return 74 /* ClassKeyword */; - case 228 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; - case 226 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; - case 230 /* EnumDeclaration */: return 230 /* EnumDeclaration */; - case 151 /* GetAccessor */: return 124 /* GetKeyword */; - case 152 /* SetAccessor */: return 133 /* SetKeyword */; - case 149 /* MethodDeclaration */: + case 228 /* ClassDeclaration */: return 74 /* ClassKeyword */; + case 229 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; + case 227 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; + case 231 /* EnumDeclaration */: return 231 /* EnumDeclaration */; + case 152 /* GetAccessor */: return 124 /* GetKeyword */; + case 153 /* SetAccessor */: return 134 /* SetKeyword */; + case 150 /* MethodDeclaration */: if (node.asteriskToken) { return 38 /* AsteriskToken */; } /* fall-through */ - case 147 /* PropertyDeclaration */: - case 144 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 145 /* Parameter */: return node.name.kind; } } @@ -77130,16 +77500,16 @@ var ts; return indentation; case 40 /* SlashToken */: case 28 /* GreaterThanToken */: { - if (container.kind === 249 /* JsxOpeningElement */ || - container.kind === 250 /* JsxClosingElement */ || - container.kind === 248 /* JsxSelfClosingElement */) { + if (container.kind === 250 /* JsxOpeningElement */ || + container.kind === 251 /* JsxClosingElement */ || + container.kind === 249 /* JsxSelfClosingElement */) { return indentation; } break; } case 20 /* OpenBracketToken */: case 21 /* CloseBracketToken */: { - if (container.kind !== 170 /* MappedType */) { + if (container.kind !== 171 /* MappedType */) { return indentation; } break; @@ -77249,11 +77619,11 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 145 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 146 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 175 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + if (isFirstListItem && parent.kind === 176 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -77610,12 +77980,12 @@ var ts; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 150 /* Constructor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 185 /* ArrowFunction */: + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 186 /* ArrowFunction */: if (node.typeParameters === list) { return 26 /* LessThanToken */; } @@ -77623,8 +77993,8 @@ var ts; return 18 /* OpenParenToken */; } break; - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: if (node.typeArguments === list) { return 26 /* LessThanToken */; } @@ -77632,7 +78002,7 @@ var ts; return 18 /* OpenParenToken */; } break; - case 157 /* TypeReference */: + case 158 /* TypeReference */: if (node.typeArguments === list) { return 26 /* LessThanToken */; } @@ -77748,7 +78118,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 192 /* BinaryExpression */) { + if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 193 /* 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 */) { @@ -77871,7 +78241,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.isStatementButNotDeclaration(current)) && - (parent.kind === 262 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 263 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -77904,7 +78274,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 209 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 210 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -77916,23 +78286,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 157 /* TypeReference */: + case 158 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return node.parent.properties; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return node.parent.elements; - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: { + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -77943,8 +78313,8 @@ var ts; } break; } - case 180 /* NewExpression */: - case 179 /* CallExpression */: { + case 181 /* NewExpression */: + case 180 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -77974,8 +78344,8 @@ var ts; if (node.kind === 19 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 179 /* CallExpression */ || - node.parent.kind === 180 /* NewExpression */) && + if (node.parent && (node.parent.kind === 180 /* CallExpression */ || + node.parent.kind === 181 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -77993,10 +78363,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: node = node.expression; break; default: @@ -78060,49 +78430,49 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 208 /* ExpressionStatement */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 175 /* ArrayLiteralExpression */: - case 205 /* Block */: - case 232 /* ModuleBlock */: - case 176 /* ObjectLiteralExpression */: - case 161 /* TypeLiteral */: - case 170 /* MappedType */: - case 163 /* TupleType */: - case 233 /* CaseBlock */: - case 255 /* DefaultClause */: - case 254 /* CaseClause */: - case 183 /* ParenthesizedExpression */: - case 177 /* PropertyAccessExpression */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 206 /* VariableStatement */: - case 224 /* VariableDeclaration */: - case 241 /* ExportAssignment */: - case 217 /* ReturnStatement */: - case 193 /* ConditionalExpression */: - case 173 /* ArrayBindingPattern */: - case 172 /* ObjectBindingPattern */: - case 249 /* JsxOpeningElement */: - case 248 /* JsxSelfClosingElement */: - case 253 /* JsxExpression */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 144 /* Parameter */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 166 /* ParenthesizedType */: - case 181 /* TaggedTemplateExpression */: - case 189 /* AwaitExpression */: - case 243 /* NamedExports */: - case 239 /* NamedImports */: - case 244 /* ExportSpecifier */: - case 240 /* ImportSpecifier */: + case 209 /* ExpressionStatement */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 176 /* ArrayLiteralExpression */: + case 206 /* Block */: + case 233 /* ModuleBlock */: + case 177 /* ObjectLiteralExpression */: + case 162 /* TypeLiteral */: + case 171 /* MappedType */: + case 164 /* TupleType */: + case 234 /* CaseBlock */: + case 256 /* DefaultClause */: + case 255 /* CaseClause */: + case 184 /* ParenthesizedExpression */: + case 178 /* PropertyAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 207 /* VariableStatement */: + case 225 /* VariableDeclaration */: + case 242 /* ExportAssignment */: + case 218 /* ReturnStatement */: + case 194 /* ConditionalExpression */: + case 174 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 250 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 254 /* JsxExpression */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 145 /* Parameter */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 167 /* ParenthesizedType */: + case 182 /* TaggedTemplateExpression */: + case 190 /* AwaitExpression */: + case 244 /* NamedExports */: + case 240 /* NamedImports */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: return true; } return false; @@ -78111,27 +78481,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 212 /* ForStatement */: - case 209 /* IfStatement */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 185 /* ArrowFunction */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - return childKind !== 205 /* Block */; - case 242 /* ExportDeclaration */: - return childKind !== 243 /* NamedExports */; - case 236 /* ImportDeclaration */: - return childKind !== 237 /* ImportClause */ || - (child.namedBindings && child.namedBindings.kind !== 239 /* NamedImports */); - case 247 /* JsxElement */: - return childKind !== 250 /* JsxClosingElement */; + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 213 /* ForStatement */: + case 210 /* IfStatement */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 186 /* ArrowFunction */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return childKind !== 206 /* Block */; + case 243 /* ExportDeclaration */: + return childKind !== 244 /* NamedExports */; + case 237 /* ImportDeclaration */: + return childKind !== 238 /* ImportClause */ || + (child.namedBindings && child.namedBindings.kind !== 240 /* NamedImports */); + case 248 /* JsxElement */: + return childKind !== 251 /* JsxClosingElement */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -78152,7 +78522,7 @@ var ts; (function (ts) { var codefix; (function (codefix) { - var codeFixes = ts.createMap(); + var codeFixes = []; function registerCodeFix(action) { ts.forEach(action.errorCodes, function (error) { var fixes = codeFixes[error]; @@ -78228,9 +78598,9 @@ var ts; if (IndexInfoOfKind) { var writer = ts.getSingleLineStringWriter(); checker.getSymbolDisplayBuilder().buildIndexSignatureDisplay(IndexInfoOfKind, writer, kind, enclosingDeclaration); - var result_7 = writer.string(); + var result_6 = writer.string(); ts.releaseStringWriter(writer); - return result_7; + return result_6; } } return ""; @@ -78324,7 +78694,7 @@ var ts; } // figure out if the this access is actuall inside the supercall // i.e. super(this.a), since in that case we won't suggest a fix - if (superCall.expression && superCall.expression.kind == 179 /* CallExpression */) { + if (superCall.expression && superCall.expression.kind == 180 /* CallExpression */) { var arguments_1 = superCall.expression.arguments; for (var i = 0; i < arguments_1.length; i++) { if (arguments_1[i].expression === token) { @@ -78348,7 +78718,7 @@ var ts; changes: changes }]; function findSuperCall(n) { - if (n.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { + if (n.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -78431,6 +78801,25 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + var start = token.getStart(sourceFile); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_this_to_unresolved_variable), + changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "this.", span: { start: start, length: 0 } }] }] + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -78450,9 +78839,9 @@ var ts; switch (token.kind) { case 70 /* Identifier */: switch (token.parent.kind) { - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: switch (token.parent.parent.parent.kind) { - case 212 /* ForStatement */: + case 213 /* ForStatement */: var forStatement = token.parent.parent.parent; var forInitializer = forStatement.initializer; if (forInitializer.declarations.length === 1) { @@ -78461,18 +78850,18 @@ var ts; else { return removeSingleItem(forInitializer.declarations, token); } - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 225 /* VariableDeclarationList */) { + if (forOfStatement.initializer.kind === 226 /* VariableDeclarationList */) { var forOfInitializer = forOfStatement.initializer; return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); } break; - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: // There is no valid fix in the case of: // for .. in return undefined; - case 257 /* CatchClause */: + case 258 /* CatchClause */: var catchClause = token.parent.parent; var parameter = catchClause.variableDeclaration.getChildren()[0]; return createCodeFix("", parameter.pos, parameter.end - parameter.pos); @@ -78486,7 +78875,7 @@ var ts; return removeSingleItem(declarations, token); } } - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: var typeParameters = token.parent.parent.typeParameters; if (typeParameters.length === 1) { return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); @@ -78494,7 +78883,7 @@ var ts; else { return removeSingleItem(typeParameters, token); } - case 144 /* Parameter */: + case 145 /* Parameter */: var functionDeclaration = token.parent.parent; if (functionDeclaration.parameters.length === 1) { return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); @@ -78503,10 +78892,10 @@ var ts; return removeSingleItem(functionDeclaration.parameters, token); } // handle case where 'import a = A;' - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: var importEquals = findImportDeclaration(token); return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 240 /* ImportSpecifier */: + case 241 /* ImportSpecifier */: var namedImports = token.parent.parent; if (namedImports.elements.length === 1) { // Only 1 import and it is unused. So the entire declaration should be removed. @@ -78518,7 +78907,7 @@ var ts; } // handle case where "import d, * as ns from './file'" // or "'import {a, b as ns} from './file'" - case 237 /* ImportClause */: + case 238 /* ImportClause */: var importClause = token.parent; if (!importClause.namedBindings) { var importDecl = findImportDeclaration(importClause); @@ -78527,7 +78916,7 @@ var ts; else { return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); } - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: var namespaceImport = token.parent; if (namespaceImport.name == token && !namespaceImport.parent.name) { var importDecl = findImportDeclaration(namespaceImport); @@ -78539,9 +78928,9 @@ var ts; } } break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); } if (ts.isDeclarationName(token)) { @@ -78555,14 +78944,14 @@ var ts; } function findImportDeclaration(token) { var importDecl = token; - while (importDecl.kind != 236 /* ImportDeclaration */ && importDecl.parent) { + while (importDecl.kind != 237 /* ImportDeclaration */ && importDecl.parent) { importDecl = importDecl.parent; } return importDecl; } function createCodeFix(newText, start, length) { return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_declaration_for_Colon_0), { 0: token.getText() }), changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: newText, span: { start: start, length: length } }] @@ -78594,18 +78983,19 @@ var ts; })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); var ImportCodeActionMap = (function () { function ImportCodeActionMap() { - this.symbolIdToActionMap = ts.createMap(); + this.symbolIdToActionMap = []; } ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { if (!newAction) { return; } - if (!this.symbolIdToActionMap[symbolId]) { + var actions = this.symbolIdToActionMap[symbolId]; + if (!actions) { this.symbolIdToActionMap[symbolId] = [newAction]; return; } if (newAction.kind === "CodeChange") { - this.symbolIdToActionMap[symbolId].push(newAction); + actions.push(newAction); return; } var updatedNewImports = []; @@ -78649,8 +79039,8 @@ var ts; }; ImportCodeActionMap.prototype.getAllActions = function () { var result = []; - for (var symbolId in this.symbolIdToActionMap) { - result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + for (var key in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[key]); } return result; }; @@ -78695,7 +79085,7 @@ var ts; var name = token.getText(); var symbolIdActionMap = new ImportCodeActionMap(); // this is a module id -> module import declaration map - var cachedImportDeclarations = ts.createMap(); + var cachedImportDeclarations = []; var cachedNewImportInsertPosition; var currentTokenMeaning = ts.getMeaningFromLocation(token); if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -78732,8 +79122,9 @@ var ts; return symbolIdActionMap.getAllActions(); function getImportDeclarations(moduleSymbol) { var moduleSymbolId = getUniqueSymbolId(moduleSymbol); - if (cachedImportDeclarations[moduleSymbolId]) { - return cachedImportDeclarations[moduleSymbolId]; + var cached = cachedImportDeclarations[moduleSymbolId]; + if (cached) { + return cached; } var existingDeclarations = []; for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { @@ -78748,10 +79139,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 236 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { return node; } - if (node.kind === 235 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } node = node.parent; @@ -78797,9 +79188,9 @@ var ts; var existingModuleSpecifier; for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { var declaration = declarations_11[_i]; - if (declaration.kind === 236 /* ImportDeclaration */) { + if (declaration.kind === 237 /* ImportDeclaration */) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 238 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 239 /* NamespaceImport */) { // case: // import * as ns from "foo" namespaceImportDeclaration = declaration; @@ -78839,7 +79230,7 @@ var ts; } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 246 /* ExternalModuleReference */) { + if (declaration.moduleReference && declaration.moduleReference.kind === 247 /* ExternalModuleReference */) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); @@ -78887,7 +79278,7 @@ var ts; } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 236 /* ImportDeclaration */) { + if (declaration.kind === 237 /* ImportDeclaration */) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { @@ -78940,13 +79331,13 @@ var ts; var sourceDirectory = ts.getDirectoryPath(fileName); var options = context.program.getCompilerOptions(); return tryGetModuleNameFromAmbientModule() || - tryGetModuleNameFromBaseUrl() || - tryGetModuleNameFromRootDirs() || tryGetModuleNameFromTypeRoots() || tryGetModuleNameAsNodeModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 262 /* SourceFile */) { + if (moduleSymbol.valueDeclaration.kind !== 263 /* SourceFile */) { return moduleSymbol.name; } } @@ -79109,7 +79500,7 @@ var ts; */ function getMissingMembersInsertion(classDeclaration, possiblyMissingSymbols, checker, newlineChar) { var classMembers = classDeclaration.symbol.members; - var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !(symbol.getName() in classMembers); }); + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !classMembers.has(symbol.getName()); }); var insertion = ""; for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { var symbol = missingMembers_1[_i]; @@ -79132,14 +79523,14 @@ var ts; var name = declaration.name ? declaration.name.getText() : undefined; var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration)); switch (declaration.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 146 /* PropertySignature */: - case 147 /* PropertyDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 147 /* PropertySignature */: + case 148 /* PropertyDeclaration */: var typeString = checker.typeToString(type, enclosingDeclaration, 0 /* None */); return "" + visibility + name + ": " + typeString + ";" + newlineChar; - case 148 /* MethodSignature */: - case 149 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 150 /* MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -79179,7 +79570,7 @@ var ts; } } function createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker) { - var newSignatureDeclaration = ts.createNode(153 /* CallSignature */); + var newSignatureDeclaration = ts.createNode(154 /* CallSignature */); newSignatureDeclaration.parent = enclosingDeclaration; newSignatureDeclaration.name = signatures[0].getDeclaration().name; var maxNonRestArgs = -1; @@ -79210,7 +79601,7 @@ var ts; } return checker.getSignatureFromDeclaration(newSignatureDeclaration); function createParameterDeclarationWithoutType(index, minArgCount, enclosingSignatureDeclaration) { - var newParameter = ts.createNode(144 /* Parameter */); + var newParameter = ts.createNode(145 /* Parameter */); newParameter.symbol = new SymbolConstructor(1 /* FunctionScopedVariable */, maxArgsParameterSymbolNames[index] || "rest"); newParameter.symbol.valueDeclaration = newParameter; newParameter.symbol.declarations = [newParameter]; @@ -79241,6 +79632,7 @@ var ts; /// /// /// +/// /// /// /// @@ -79276,7 +79668,7 @@ var ts; /** The version of the language service API */ ts.servicesVersion = "0.5"; function createNode(kind, pos, end, parent) { - var node = kind >= 141 /* FirstNode */ ? new NodeObject(kind, pos, end) : + var node = kind >= 142 /* FirstNode */ ? new NodeObject(kind, pos, end) : kind === 70 /* Identifier */ ? new IdentifierObject(70 /* Identifier */, pos, end) : new TokenObject(kind, pos, end); node.parent = parent; @@ -79334,7 +79726,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(293 /* SyntaxList */, nodes.pos, nodes.end, this); + var list = createNode(294 /* SyntaxList */, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -79353,11 +79745,11 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 141 /* FirstNode */) { + if (this.kind >= 142 /* FirstNode */) { ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 279 /* FirstJSDocTagNode */ && this.kind <= 292 /* LastJSDocTagNode */; + var useJSDocScanner_1 = this.kind >= 280 /* FirstJSDocTagNode */ && this.kind <= 293 /* LastJSDocTagNode */; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -79414,8 +79806,10 @@ var ts; if (!children.length) { return undefined; } - var child = children[0]; - return child.kind < 141 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + var child = ts.find(children, function (kid) { return kid.kind < 264 /* FirstJSDocNode */ || kid.kind > 293 /* LastJSDocNode */; }); + return child.kind < 142 /* FirstNode */ ? + child : + child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -79423,7 +79817,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 141 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 142 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; return NodeObject; }()); @@ -79622,27 +80016,31 @@ var ts; return this.namedDeclarations; }; SourceFileObject.prototype.computeNamedDeclarations = function () { - var result = ts.createMap(); + var result = ts.createMultiMap(); ts.forEachChild(this, visit); return result; function addDeclaration(declaration) { var name = getDeclarationName(declaration); if (name) { - ts.multiMapAdd(result, name, declaration); + result.add(name, declaration); } } function getDeclarations(name) { - return result[name] || (result[name] = []); + var declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; } function getDeclarationName(declaration) { if (declaration.name) { - var result_8 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_8 !== undefined) { - return result_8; + var result_7 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_7 !== undefined) { + return result_7; } - if (declaration.name.kind === 142 /* ComputedPropertyName */) { + if (declaration.name.kind === 143 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 177 /* PropertyAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -79662,10 +80060,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -79685,32 +80083,32 @@ var ts; } ts.forEachChild(node, visit); break; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 230 /* EnumDeclaration */: - case 231 /* ModuleDeclaration */: - case 235 /* ImportEqualsDeclaration */: - case 244 /* ExportSpecifier */: - case 240 /* ImportSpecifier */: - case 235 /* ImportEqualsDeclaration */: - case 237 /* ImportClause */: - case 238 /* NamespaceImport */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 161 /* TypeLiteral */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 162 /* TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 144 /* Parameter */: + case 145 /* Parameter */: // Only consider parameter properties if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) { break; } // fall through - case 224 /* VariableDeclaration */: - case 174 /* BindingElement */: { + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -79719,19 +80117,19 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 261 /* EnumMember */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 262 /* EnumMember */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: addDeclaration(node); break; - case 242 /* ExportDeclaration */: + case 243 /* 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 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -79743,7 +80141,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 238 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 239 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -80273,10 +80671,10 @@ var ts; // Try getting just type at this position and show switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: case 98 /* ThisKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: case 96 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); @@ -80318,10 +80716,10 @@ var ts; function getOccurrencesAtPosition(fileName, position) { var results = getOccurrencesAtPositionCore(fileName, position); if (results) { - var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); + var sourceFile_1 = getCanonicalFileName(ts.normalizeSlashes(fileName)); // 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_2; }); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_1; }); } return results; } @@ -80356,21 +80754,21 @@ var ts; } } function findRenameLocations(fileName, position, findInStrings, findInComments) { - var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments); + var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments, /*isForRename*/ true); return ts.FindAllReferences.convertReferences(referencedSymbols); } function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false, /*isForRename*/ false); return ts.FindAllReferences.convertReferences(referencedSymbols); } function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false, /*isForRename*/ false); // Only include referenced symbols that have a valid definition. return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); } - function findReferencedSymbols(fileName, position, findInStrings, findInComments) { + function findReferencedSymbols(fileName, position, findInStrings, findInComments, isForRename) { synchronizeHostData(); - return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments); + return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments, isForRename); } /// NavigateTo function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { @@ -80419,15 +80817,15 @@ var ts; return; } switch (node.kind) { - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: case 9 /* StringLiteral */: case 85 /* FalseKeyword */: case 100 /* TrueKeyword */: case 94 /* NullKeyword */: case 96 /* SuperKeyword */: case 98 /* ThisKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: case 70 /* Identifier */: break; // Cant create the text span @@ -80444,7 +80842,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 231 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 232 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -80821,7 +81219,7 @@ var ts; function walk(node) { switch (node.kind) { case 70 /* Identifier */: - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); break; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -80830,10 +81228,10 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 246 /* ExternalModuleReference */ || + node.parent.kind === 247 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); } break; default: @@ -80846,11 +81244,14 @@ var ts; } } } + function setNameTable(text, node) { + nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); + } } function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 178 /* ElementAccessExpression */ && + node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -80934,113 +81335,113 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 224 /* VariableDeclaration */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 225 /* VariableDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return spanInVariableDeclaration(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return spanInParameterDeclaration(node); - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 205 /* Block */: + case 206 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: return spanInBlock(node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return spanInBlock(node.block); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 210 /* DoStatement */: + case 211 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 223 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 209 /* IfStatement */: + case 210 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 216 /* BreakStatement */: - case 215 /* ContinueStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return spanInForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 254 /* CaseClause */: - case 255 /* DefaultClause */: + case 255 /* CaseClause */: + case 256 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 222 /* TryStatement */: + case 223 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: - case 261 /* EnumMember */: - case 174 /* BindingElement */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 262 /* EnumMember */: + case 175 /* BindingElement */: // span on complete node return textSpan(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: // span in statement return spanInNode(node.statement); - case 145 /* Decorator */: + case 146 /* Decorator */: return spanInNodeArray(node.parent.decorators); - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: return undefined; // Tokens: case 24 /* SemicolonToken */: @@ -81070,7 +81471,7 @@ var ts; case 73 /* CatchKeyword */: case 86 /* FinallyKeyword */: return spanInNextNode(node); - case 140 /* OfKeyword */: + case 141 /* OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -81083,13 +81484,13 @@ var ts; // a or ...c or d: x from // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern if ((node.kind === 70 /* Identifier */ || - node.kind == 196 /* SpreadElement */ || - node.kind === 258 /* PropertyAssignment */ || - node.kind === 259 /* ShorthandPropertyAssignment */) && + node.kind == 197 /* SpreadElement */ || + node.kind === 259 /* PropertyAssignment */ || + node.kind === 260 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 192 /* BinaryExpression */) { + if (node.kind === 193 /* BinaryExpression */) { var binaryExpression = node; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -81112,22 +81513,22 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 210 /* DoStatement */: + case 211 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 145 /* Decorator */: + case 146 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 212 /* ForStatement */: - case 214 /* ForOfStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: return textSpan(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: if (node.parent.operatorToken.kind === 25 /* CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -81136,13 +81537,13 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 258 /* PropertyAssignment */ && + if (node.parent.kind === 259 /* PropertyAssignment */ && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 182 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 183 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNextNode(node.parent.type); } // return type of function go to previous token @@ -81150,8 +81551,8 @@ var ts; return spanInPreviousNode(node); } // initializer of variable/parameter declaration go to previous node - if ((node.parent.kind === 224 /* VariableDeclaration */ || - node.parent.kind === 144 /* Parameter */)) { + if ((node.parent.kind === 225 /* VariableDeclaration */ || + node.parent.kind === 145 /* Parameter */)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -81159,7 +81560,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 192 /* BinaryExpression */) { + if (node.parent.kind === 193 /* BinaryExpression */) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -81185,7 +81586,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 213 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 214 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern, set breakpoint in binding pattern @@ -81196,7 +81597,7 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1 /* Export */) || - variableDeclaration.parent.parent.kind === 214 /* ForOfStatement */) { + variableDeclaration.parent.parent.kind === 215 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -81236,7 +81637,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1 /* Export */) || - (functionDeclaration.parent.kind === 227 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */); + (functionDeclaration.parent.kind === 228 /* ClassDeclaration */ && functionDeclaration.kind !== 151 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -81259,25 +81660,25 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 211 /* WhileStatement */: - case 209 /* IfStatement */: - case 213 /* ForInStatement */: + case 212 /* WhileStatement */: + case 210 /* IfStatement */: + case 214 /* ForInStatement */: 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 212 /* ForStatement */: - case 214 /* ForOfStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 225 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 226 /* VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -81302,23 +81703,23 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 199 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 174 /* BindingElement */) { + if (bindingPattern.parent.kind === 175 /* BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 173 /* ArrayBindingPattern */ && node.kind !== 172 /* ObjectBindingPattern */); - var elements = node.kind === 175 /* ArrayLiteralExpression */ ? + ts.Debug.assert(node.kind !== 174 /* ArrayBindingPattern */ && node.kind !== 173 /* ObjectBindingPattern */); + var elements = node.kind === 176 /* ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 199 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -81326,18 +81727,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 192 /* BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 193 /* BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -81345,24 +81746,24 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 230 /* EnumDeclaration */: - case 227 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 205 /* Block */: + case 206 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through - case 257 /* CatchClause */: + case 258 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -81370,7 +81771,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -81386,7 +81787,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -81401,12 +81802,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 210 /* DoStatement */ || - node.parent.kind === 179 /* CallExpression */ || - node.parent.kind === 180 /* NewExpression */) { + if (node.parent.kind === 211 /* DoStatement */ || + node.parent.kind === 180 /* CallExpression */ || + node.parent.kind === 181 /* NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 183 /* ParenthesizedExpression */) { + if (node.parent.kind === 184 /* ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -81415,21 +81816,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 211 /* WhileStatement */: - case 210 /* DoStatement */: - case 212 /* ForStatement */: - case 214 /* ForOfStatement */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 183 /* ParenthesizedExpression */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 212 /* WhileStatement */: + case 211 /* DoStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 184 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -81439,20 +81840,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 258 /* PropertyAssignment */ || - node.parent.kind === 144 /* Parameter */) { + node.parent.kind === 259 /* PropertyAssignment */ || + node.parent.kind === 145 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 182 /* TypeAssertionExpression */) { + if (node.parent.kind === 183 /* TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 210 /* DoStatement */) { + if (node.parent.kind === 211 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -81460,7 +81861,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 214 /* ForOfStatement */) { + if (node.parent.kind === 215 /* ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -81591,7 +81992,10 @@ var ts; if (settingsJson == null || settingsJson == "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); } - return JSON.parse(settingsJson); + var compilerOptions = JSON.parse(settingsJson); + // permit language service to handle all files (filtering should be performed on the host side) + compilerOptions.allowNonTsExtensions = true; + return compilerOptions; }; LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { var encoded = this.shimHost.getScriptFileNames(); @@ -82099,12 +82503,6 @@ var ts; var compilerOptions = JSON.parse(compilerOptionsJson); var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; - if (resolvedFileName && !compilerOptions.allowJs && ts.fileExtensionIs(resolvedFileName, ".js")) { - return { - resolvedFileName: undefined, - failedLookupLocations: [] - }; - } return { resolvedFileName: resolvedFileName, failedLookupLocations: result.failedLookupLocations diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 24ec0a740ca71..e434ab893e88e 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -14,11 +14,36 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { + /** + * Type of objects whose values are all of the same type. + * The `in` and `for-in` operators can *not* be safely used, + * since `Object.prototype` may be modified by outside code. + */ interface MapLike { [index: string]: T; } - interface Map extends MapLike { - __mapBrand: any; + /** ES6 Map interface. */ + interface Map { + get(key: string): T; + has(key: string): boolean; + set(key: string, value: T): this; + delete(key: string): boolean; + clear(): void; + forEach(action: (value: T, key: string) => void): void; + readonly size: number; + keys(): Iterator; + values(): Iterator; + entries(): Iterator<[string, T]>; + } + /** ES6 Iterator type. */ + interface Iterator { + next(): { + value: T; + done: false; + } | { + value: never; + done: true; + }; } type Path = string & { __pathBrand: any; @@ -170,172 +195,173 @@ declare namespace ts { ReadonlyKeyword = 130, RequireKeyword = 131, NumberKeyword = 132, - SetKeyword = 133, - StringKeyword = 134, - SymbolKeyword = 135, - TypeKeyword = 136, - UndefinedKeyword = 137, - FromKeyword = 138, - GlobalKeyword = 139, - OfKeyword = 140, - QualifiedName = 141, - ComputedPropertyName = 142, - TypeParameter = 143, - Parameter = 144, - Decorator = 145, - PropertySignature = 146, - PropertyDeclaration = 147, - MethodSignature = 148, - MethodDeclaration = 149, - Constructor = 150, - GetAccessor = 151, - SetAccessor = 152, - CallSignature = 153, - ConstructSignature = 154, - IndexSignature = 155, - TypePredicate = 156, - TypeReference = 157, - FunctionType = 158, - ConstructorType = 159, - TypeQuery = 160, - TypeLiteral = 161, - ArrayType = 162, - TupleType = 163, - UnionType = 164, - IntersectionType = 165, - ParenthesizedType = 166, - ThisType = 167, - TypeOperator = 168, - IndexedAccessType = 169, - MappedType = 170, - LiteralType = 171, - ObjectBindingPattern = 172, - ArrayBindingPattern = 173, - BindingElement = 174, - ArrayLiteralExpression = 175, - ObjectLiteralExpression = 176, - PropertyAccessExpression = 177, - ElementAccessExpression = 178, - CallExpression = 179, - NewExpression = 180, - TaggedTemplateExpression = 181, - TypeAssertionExpression = 182, - ParenthesizedExpression = 183, - FunctionExpression = 184, - ArrowFunction = 185, - DeleteExpression = 186, - TypeOfExpression = 187, - VoidExpression = 188, - AwaitExpression = 189, - PrefixUnaryExpression = 190, - PostfixUnaryExpression = 191, - BinaryExpression = 192, - ConditionalExpression = 193, - TemplateExpression = 194, - YieldExpression = 195, - SpreadElement = 196, - ClassExpression = 197, - OmittedExpression = 198, - ExpressionWithTypeArguments = 199, - AsExpression = 200, - NonNullExpression = 201, - MetaProperty = 202, - TemplateSpan = 203, - SemicolonClassElement = 204, - Block = 205, - VariableStatement = 206, - EmptyStatement = 207, - ExpressionStatement = 208, - IfStatement = 209, - DoStatement = 210, - WhileStatement = 211, - ForStatement = 212, - ForInStatement = 213, - ForOfStatement = 214, - ContinueStatement = 215, - BreakStatement = 216, - ReturnStatement = 217, - WithStatement = 218, - SwitchStatement = 219, - LabeledStatement = 220, - ThrowStatement = 221, - TryStatement = 222, - DebuggerStatement = 223, - VariableDeclaration = 224, - VariableDeclarationList = 225, - FunctionDeclaration = 226, - ClassDeclaration = 227, - InterfaceDeclaration = 228, - TypeAliasDeclaration = 229, - EnumDeclaration = 230, - ModuleDeclaration = 231, - ModuleBlock = 232, - CaseBlock = 233, - NamespaceExportDeclaration = 234, - ImportEqualsDeclaration = 235, - ImportDeclaration = 236, - ImportClause = 237, - NamespaceImport = 238, - NamedImports = 239, - ImportSpecifier = 240, - ExportAssignment = 241, - ExportDeclaration = 242, - NamedExports = 243, - ExportSpecifier = 244, - MissingDeclaration = 245, - ExternalModuleReference = 246, - JsxElement = 247, - JsxSelfClosingElement = 248, - JsxOpeningElement = 249, - JsxClosingElement = 250, - JsxAttribute = 251, - JsxSpreadAttribute = 252, - JsxExpression = 253, - CaseClause = 254, - DefaultClause = 255, - HeritageClause = 256, - CatchClause = 257, - PropertyAssignment = 258, - ShorthandPropertyAssignment = 259, - SpreadAssignment = 260, - EnumMember = 261, - SourceFile = 262, - JSDocTypeExpression = 263, - JSDocAllType = 264, - JSDocUnknownType = 265, - JSDocArrayType = 266, - JSDocUnionType = 267, - JSDocTupleType = 268, - JSDocNullableType = 269, - JSDocNonNullableType = 270, - JSDocRecordType = 271, - JSDocRecordMember = 272, - JSDocTypeReference = 273, - JSDocOptionalType = 274, - JSDocFunctionType = 275, - JSDocVariadicType = 276, - JSDocConstructorType = 277, - JSDocThisType = 278, - JSDocComment = 279, - JSDocTag = 280, - JSDocAugmentsTag = 281, - JSDocParameterTag = 282, - JSDocReturnTag = 283, - JSDocTypeTag = 284, - JSDocTemplateTag = 285, - JSDocTypedefTag = 286, - JSDocPropertyTag = 287, - JSDocTypeLiteral = 288, - JSDocLiteralType = 289, - JSDocNullKeyword = 290, - JSDocUndefinedKeyword = 291, - JSDocNeverKeyword = 292, - SyntaxList = 293, - NotEmittedStatement = 294, - PartiallyEmittedExpression = 295, - MergeDeclarationMarker = 296, - EndOfDeclarationMarker = 297, - Count = 298, + ObjectKeyword = 133, + SetKeyword = 134, + StringKeyword = 135, + SymbolKeyword = 136, + TypeKeyword = 137, + UndefinedKeyword = 138, + FromKeyword = 139, + GlobalKeyword = 140, + OfKeyword = 141, + QualifiedName = 142, + ComputedPropertyName = 143, + TypeParameter = 144, + Parameter = 145, + Decorator = 146, + PropertySignature = 147, + PropertyDeclaration = 148, + MethodSignature = 149, + MethodDeclaration = 150, + Constructor = 151, + GetAccessor = 152, + SetAccessor = 153, + CallSignature = 154, + ConstructSignature = 155, + IndexSignature = 156, + TypePredicate = 157, + TypeReference = 158, + FunctionType = 159, + ConstructorType = 160, + TypeQuery = 161, + TypeLiteral = 162, + ArrayType = 163, + TupleType = 164, + UnionType = 165, + IntersectionType = 166, + ParenthesizedType = 167, + ThisType = 168, + TypeOperator = 169, + IndexedAccessType = 170, + MappedType = 171, + LiteralType = 172, + ObjectBindingPattern = 173, + ArrayBindingPattern = 174, + BindingElement = 175, + ArrayLiteralExpression = 176, + ObjectLiteralExpression = 177, + PropertyAccessExpression = 178, + ElementAccessExpression = 179, + CallExpression = 180, + NewExpression = 181, + TaggedTemplateExpression = 182, + TypeAssertionExpression = 183, + ParenthesizedExpression = 184, + FunctionExpression = 185, + ArrowFunction = 186, + DeleteExpression = 187, + TypeOfExpression = 188, + VoidExpression = 189, + AwaitExpression = 190, + PrefixUnaryExpression = 191, + PostfixUnaryExpression = 192, + BinaryExpression = 193, + ConditionalExpression = 194, + TemplateExpression = 195, + YieldExpression = 196, + SpreadElement = 197, + ClassExpression = 198, + OmittedExpression = 199, + ExpressionWithTypeArguments = 200, + AsExpression = 201, + NonNullExpression = 202, + MetaProperty = 203, + TemplateSpan = 204, + SemicolonClassElement = 205, + Block = 206, + VariableStatement = 207, + EmptyStatement = 208, + ExpressionStatement = 209, + IfStatement = 210, + DoStatement = 211, + WhileStatement = 212, + ForStatement = 213, + ForInStatement = 214, + ForOfStatement = 215, + ContinueStatement = 216, + BreakStatement = 217, + ReturnStatement = 218, + WithStatement = 219, + SwitchStatement = 220, + LabeledStatement = 221, + ThrowStatement = 222, + TryStatement = 223, + DebuggerStatement = 224, + VariableDeclaration = 225, + VariableDeclarationList = 226, + FunctionDeclaration = 227, + ClassDeclaration = 228, + InterfaceDeclaration = 229, + TypeAliasDeclaration = 230, + EnumDeclaration = 231, + ModuleDeclaration = 232, + ModuleBlock = 233, + CaseBlock = 234, + NamespaceExportDeclaration = 235, + ImportEqualsDeclaration = 236, + ImportDeclaration = 237, + ImportClause = 238, + NamespaceImport = 239, + NamedImports = 240, + ImportSpecifier = 241, + ExportAssignment = 242, + ExportDeclaration = 243, + NamedExports = 244, + ExportSpecifier = 245, + MissingDeclaration = 246, + ExternalModuleReference = 247, + JsxElement = 248, + JsxSelfClosingElement = 249, + JsxOpeningElement = 250, + JsxClosingElement = 251, + JsxAttribute = 252, + JsxSpreadAttribute = 253, + JsxExpression = 254, + CaseClause = 255, + DefaultClause = 256, + HeritageClause = 257, + CatchClause = 258, + PropertyAssignment = 259, + ShorthandPropertyAssignment = 260, + SpreadAssignment = 261, + EnumMember = 262, + SourceFile = 263, + JSDocTypeExpression = 264, + JSDocAllType = 265, + JSDocUnknownType = 266, + JSDocArrayType = 267, + JSDocUnionType = 268, + JSDocTupleType = 269, + JSDocNullableType = 270, + JSDocNonNullableType = 271, + JSDocRecordType = 272, + JSDocRecordMember = 273, + JSDocTypeReference = 274, + JSDocOptionalType = 275, + JSDocFunctionType = 276, + JSDocVariadicType = 277, + JSDocConstructorType = 278, + JSDocThisType = 279, + JSDocComment = 280, + JSDocTag = 281, + JSDocAugmentsTag = 282, + JSDocParameterTag = 283, + JSDocReturnTag = 284, + JSDocTypeTag = 285, + JSDocTemplateTag = 286, + JSDocTypedefTag = 287, + JSDocPropertyTag = 288, + JSDocTypeLiteral = 289, + JSDocLiteralType = 290, + JSDocNullKeyword = 291, + JSDocUndefinedKeyword = 292, + JSDocNeverKeyword = 293, + SyntaxList = 294, + NotEmittedStatement = 295, + PartiallyEmittedExpression = 296, + MergeDeclarationMarker = 297, + EndOfDeclarationMarker = 298, + Count = 299, FirstAssignment = 57, LastAssignment = 69, FirstCompoundAssignment = 58, @@ -343,15 +369,15 @@ declare namespace ts { FirstReservedWord = 71, LastReservedWord = 106, FirstKeyword = 71, - LastKeyword = 140, + LastKeyword = 141, FirstFutureReservedWord = 107, LastFutureReservedWord = 115, - FirstTypeNode = 156, - LastTypeNode = 171, + FirstTypeNode = 157, + LastTypeNode = 172, FirstPunctuation = 16, LastPunctuation = 69, FirstToken = 0, - LastToken = 140, + LastToken = 141, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -360,11 +386,11 @@ declare namespace ts { LastTemplateToken = 15, FirstBinaryOperator = 26, LastBinaryOperator = 69, - FirstNode = 141, - FirstJSDocNode = 263, - LastJSDocNode = 289, - FirstJSDocTagNode = 279, - LastJSDocTagNode = 292, + FirstNode = 142, + FirstJSDocNode = 264, + LastJSDocNode = 293, + FirstJSDocTagNode = 280, + LastJSDocTagNode = 293, } enum NodeFlags { None = 0, @@ -632,7 +658,7 @@ declare namespace ts { _typeNodeBrand: any; } interface KeywordTypeNode extends TypeNode { - kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword; + kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword; } interface ThisTypeNode extends TypeNode { kind: SyntaxKind.ThisType; @@ -1578,7 +1604,7 @@ declare namespace ts { getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; - getBaseTypes(type: InterfaceType): ObjectType[]; + getBaseTypes(type: InterfaceType): BaseType[]; getReturnTypeOfSignature(signature: Signature): Type; getNonNullableType(type: Type): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; @@ -1778,6 +1804,7 @@ declare namespace ts { Intersection = 131072, Index = 262144, IndexedAccess = 524288, + NonPrimitive = 16777216, Literal = 480, StringOrNumberLiteral = 96, PossiblyFalsy = 7406, @@ -1787,10 +1814,10 @@ declare namespace ts { EnumLike = 272, UnionOrIntersection = 196608, StructuredType = 229376, - StructuredOrTypeParameter = 507904, + StructuredOrTypeVariable = 1032192, TypeVariable = 540672, - Narrowable = 1033215, - NotUnionOrUnit = 33281, + Narrowable = 17810431, + NotUnionOrUnit = 16810497, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -1806,7 +1833,7 @@ declare namespace ts { regularType?: LiteralType; } interface EnumType extends Type { - memberTypes: Map; + memberTypes: EnumLiteralType[]; } interface EnumLiteralType extends LiteralType { baseType: EnumType & UnionType; @@ -1822,6 +1849,7 @@ declare namespace ts { ObjectLiteral = 128, EvolvingArray = 256, ObjectLiteralPatternWithComputedProperties = 512, + NonPrimitive = 1024, ClassOrInterface = 3, } interface ObjectType extends Type { @@ -1834,6 +1862,7 @@ declare namespace ts { localTypeParameters: TypeParameter[]; thisType: TypeParameter; } + type BaseType = ObjectType | IntersectionType; interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; declaredCallSignatures: Signature[]; @@ -2034,6 +2063,7 @@ declare namespace ts { None = 0, Preserve = 1, React = 2, + ReactNative = 3, } enum NewLineKind { CarriageReturnLineFeed = 0, @@ -2173,6 +2203,8 @@ declare namespace ts { /** The version of the TypeScript compiler release */ const version = "2.2.0"; } +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; +declare function clearTimeout(handle: any): void; declare namespace ts { type FileWatcherCallback = (fileName: string, removed?: boolean) => void; type DirectoryWatcherCallback = (fileName: string) => void; @@ -2267,8 +2299,8 @@ declare namespace ts { function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; - function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined; /** Optionally, get the shebang */ function getShebang(text: string): string; function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; @@ -2327,6 +2359,10 @@ declare namespace ts { function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { + /** Array that is only intended to be pushed to, never read. */ + interface Push { + push(value: T): void; + } function moduleHasNonRelativeName(moduleName: string): boolean; function getEffectiveTypeRoots(options: CompilerOptions, host: { directoryExists?: (directoryName: string) => boolean; @@ -2454,7 +2490,7 @@ declare namespace ts { getConstructSignatures(): Signature[]; getStringIndexType(): Type; getNumberIndexType(): Type; - getBaseTypes(): ObjectType[]; + getBaseTypes(): BaseType[]; getNonNullableType(): Type; } interface Signature { diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index bae2811e4de7e..9a642bdb1df29 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -173,193 +173,194 @@ var ts; SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 130] = "ReadonlyKeyword"; SyntaxKind[SyntaxKind["RequireKeyword"] = 131] = "RequireKeyword"; SyntaxKind[SyntaxKind["NumberKeyword"] = 132] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 133] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 134] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 135] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 136] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 137] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 138] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 139] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 140] = "OfKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 133] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 134] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 135] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 136] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 137] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 138] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 139] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 140] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 141] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 141] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 142] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 142] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 143] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 143] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 144] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 145] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 144] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 145] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 146] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 146] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 147] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 148] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 149] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 150] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 151] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 152] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 153] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 154] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 155] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 147] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 148] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 149] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 150] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 151] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 152] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 153] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 154] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 155] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 156] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 156] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 157] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 158] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 159] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 160] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 161] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 162] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 163] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 164] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 165] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 166] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 167] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 168] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 169] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 170] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 171] = "LiteralType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 157] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 158] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 159] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 160] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 161] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 162] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 163] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 164] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 165] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 166] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 167] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 168] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 169] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 170] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 171] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 172] = "LiteralType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 172] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 173] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 174] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 173] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 174] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 175] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 175] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 176] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 177] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 178] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 179] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 180] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 181] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 182] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 183] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 184] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 185] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 186] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 187] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 188] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 189] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 190] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 191] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 192] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 193] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 194] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 195] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 196] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 197] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 198] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 199] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 200] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 201] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 202] = "MetaProperty"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 176] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 177] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 178] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 179] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 180] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 181] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 182] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 183] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 184] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 185] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 186] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 187] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 188] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 189] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 190] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 191] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 192] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 193] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 194] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 195] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 196] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 197] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 198] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 199] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 200] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 201] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 202] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 203] = "MetaProperty"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 203] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 204] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 204] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 205] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 205] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 206] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 207] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 208] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 209] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 210] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 211] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 212] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 213] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 214] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 215] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 216] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 217] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 218] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 219] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 220] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 221] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 222] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 223] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 224] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 225] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 226] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 227] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 228] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 229] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 230] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 231] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 232] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 233] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 234] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 235] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 236] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 237] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 238] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 239] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 240] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 241] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 242] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 243] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 244] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 245] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 206] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 207] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 208] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 209] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 210] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 211] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 212] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 213] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 214] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 215] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 216] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 217] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 218] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 219] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 220] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 221] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 222] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 223] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 224] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 225] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 226] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 227] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 228] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 229] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 230] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 231] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 232] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 233] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 234] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 235] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 236] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 237] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 238] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 239] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 240] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 241] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 242] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 243] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 244] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 245] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 246] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 246] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 247] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 247] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 248] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 249] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 250] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 251] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 252] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 253] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 248] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 249] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 250] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 251] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 252] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 253] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 254] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 254] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 255] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 256] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 257] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 255] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 256] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 257] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 258] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 258] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 259] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 260] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 259] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 260] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 261] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 261] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 262] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 262] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 263] = "SourceFile"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 263] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 264] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 264] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 265] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 265] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 266] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 267] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 268] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 269] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 270] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 271] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 272] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 273] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 274] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 275] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 276] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 277] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 278] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 279] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 280] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 281] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 282] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 283] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 284] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 285] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 286] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 287] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 288] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocLiteralType"] = 289] = "JSDocLiteralType"; - SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 290] = "JSDocNullKeyword"; - SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 291] = "JSDocUndefinedKeyword"; - SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 292] = "JSDocNeverKeyword"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 266] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 267] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 268] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 269] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 270] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 271] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 272] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 273] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 274] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 275] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 276] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 277] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 278] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 279] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 280] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 281] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 282] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 283] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 284] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 285] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 286] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 287] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 288] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 289] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocLiteralType"] = 290] = "JSDocLiteralType"; + SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 291] = "JSDocNullKeyword"; + SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 292] = "JSDocUndefinedKeyword"; + SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 293] = "JSDocNeverKeyword"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 294] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 296] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 297] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 295] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 296] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 297] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 298] = "EndOfDeclarationMarker"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 298] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 299] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment"; @@ -368,15 +369,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 71] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 106] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 71] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 140] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 141] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 107] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 115] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 156] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 171] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 157] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 172] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 16] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 69] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 140] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 141] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -385,11 +386,11 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 15] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 263] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 289] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 279] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 142] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 264] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 293] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 280] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 293] = "LastJSDocTagNode"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -702,6 +703,7 @@ var ts; TypeFlags[TypeFlags["ContainsObjectLiteral"] = 4194304] = "ContainsObjectLiteral"; /* @internal */ TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; + TypeFlags[TypeFlags["NonPrimitive"] = 16777216] = "NonPrimitive"; /* @internal */ TypeFlags[TypeFlags["Nullable"] = 6144] = "Nullable"; TypeFlags[TypeFlags["Literal"] = 480] = "Literal"; @@ -710,7 +712,7 @@ var ts; TypeFlags[TypeFlags["DefinitelyFalsy"] = 7392] = "DefinitelyFalsy"; TypeFlags[TypeFlags["PossiblyFalsy"] = 7406] = "PossiblyFalsy"; /* @internal */ - TypeFlags[TypeFlags["Intrinsic"] = 16015] = "Intrinsic"; + TypeFlags[TypeFlags["Intrinsic"] = 16793231] = "Intrinsic"; /* @internal */ TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive"; TypeFlags[TypeFlags["StringLike"] = 262178] = "StringLike"; @@ -719,12 +721,12 @@ var ts; TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike"; TypeFlags[TypeFlags["UnionOrIntersection"] = 196608] = "UnionOrIntersection"; TypeFlags[TypeFlags["StructuredType"] = 229376] = "StructuredType"; - TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 507904] = "StructuredOrTypeParameter"; + TypeFlags[TypeFlags["StructuredOrTypeVariable"] = 1032192] = "StructuredOrTypeVariable"; TypeFlags[TypeFlags["TypeVariable"] = 540672] = "TypeVariable"; // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never - TypeFlags[TypeFlags["Narrowable"] = 1033215] = "Narrowable"; - TypeFlags[TypeFlags["NotUnionOrUnit"] = 33281] = "NotUnionOrUnit"; + TypeFlags[TypeFlags["Narrowable"] = 17810431] = "Narrowable"; + TypeFlags[TypeFlags["NotUnionOrUnit"] = 16810497] = "NotUnionOrUnit"; /* @internal */ TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening"; /* @internal */ @@ -742,6 +744,7 @@ var ts; ObjectFlags[ObjectFlags["ObjectLiteral"] = 128] = "ObjectLiteral"; ObjectFlags[ObjectFlags["EvolvingArray"] = 256] = "EvolvingArray"; ObjectFlags[ObjectFlags["ObjectLiteralPatternWithComputedProperties"] = 512] = "ObjectLiteralPatternWithComputedProperties"; + ObjectFlags[ObjectFlags["NonPrimitive"] = 1024] = "NonPrimitive"; ObjectFlags[ObjectFlags["ClassOrInterface"] = 3] = "ClassOrInterface"; })(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {})); var SignatureKind; @@ -792,6 +795,7 @@ var ts; JsxEmit[JsxEmit["None"] = 0] = "None"; JsxEmit[JsxEmit["Preserve"] = 1] = "Preserve"; JsxEmit[JsxEmit["React"] = 2] = "React"; + JsxEmit[JsxEmit["ReactNative"] = 3] = "ReactNative"; })(JsxEmit = ts.JsxEmit || (ts.JsxEmit = {})); var NewLineKind; (function (NewLineKind) { @@ -1121,8 +1125,8 @@ var ts; */ function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } @@ -1138,9 +1142,9 @@ var ts; */ function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; @@ -1150,7 +1154,7 @@ var ts; * @param markName The name of the mark. */ function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; /** @@ -1159,7 +1163,7 @@ var ts; * @param measureName The name of the measure whose durations should be accumulated. */ function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; /** @@ -1168,9 +1172,9 @@ var ts; * @param cb The action to perform for each measure */ function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; /** Enables (and resets) performance measurements for the compiler. */ @@ -1213,25 +1217,106 @@ var ts; Ternary[Ternary["Maybe"] = 1] = "Maybe"; Ternary[Ternary["True"] = -1] = "True"; })(Ternary = ts.Ternary || (ts.Ternary = {})); - var createObject = Object.create; // More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times. - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); // tslint:disable-line:no-null-keyword + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(/*locales*/ undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + // Intl is missing in Safari, and node 0.10 treats "a" as greater than "B". + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + /** Create a MapLike with good performance. */ + function createDictionaryObject() { + var map = Object.create(null); // tslint:disable-line:no-null-keyword // Using 'delete' on an object causes V8 to put the object in dictionary mode. // This disables creation of hidden classes, which are expensive when an object is // constantly changing shape. map["__"] = undefined; delete map["__"]; + return map; + } + /** Create a new map. If a template object is provided, the map will copy entries from it. */ + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); // Copies keys/values from template. Note that for..in will not throw if // template is undefined, and instead will just exit the loop. for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + // Internet Explorer's Map doesn't support iteration, so don't use it. + // tslint:disable-next-line:no-in-operator + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + // Keep the class inside a function so it doesn't get compiled if it's not used. + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + // tslint:disable-next-line:no-in-operator + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -1244,33 +1329,28 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } // path should already be well-formed so it does not need to be normalized function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -1290,6 +1370,10 @@ var ts; Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; })(Comparison = ts.Comparison || (ts.Comparison = {})); + function length(array) { + return array ? array.length : 0; + } + ts.length = length; /** * Iterates through 'array' by index and performs the callback on each element of array until the callback * returns a truthy value, then returns that value. @@ -1341,6 +1425,16 @@ var ts; return undefined; } ts.find = find; + /** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */ + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; /** * Returns the first truthy result of `callback`, or else fails. * This is like `forEach`, but never returns undefined. @@ -1589,21 +1683,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -1921,9 +2012,6 @@ var ts; /** * Indicates whether a map-like contains an own property with the specified key. * - * NOTE: This is intended for use only with MapLike objects. For Map objects, use - * the 'in' operator. - * * @param map A map-like. * @param key A property key. */ @@ -1934,9 +2022,6 @@ var ts; /** * Gets the value of an owned property in a map-like. * - * NOTE: This is intended for use only with MapLike objects. For Map objects, use - * an indexer. - * * @param map A map-like. * @param key A property key. */ @@ -1961,56 +2046,53 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - /** - * Enumerates the properties of a Map, invoking a callback and returning the first truthy result. - * - * @param map A map for which properties should be enumerated. - * @param callback A callback to invoke for each property. - */ - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + /** Shims `Array.from`. */ + function arrayFrom(iterator) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; + ts.arrayFrom = arrayFrom; /** - * Returns true if a Map has some matching property. - * - * @param map A map whose properties should be tested. - * @param predicate An optional callback used to test each property. + * Calls `callback` for each entry in the map, returning the first truthy result. + * Use `map.forEach` instead for normal iteration. */ - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } } - return false; + return undefined; + var _b; } - ts.someProperties = someProperties; - /** - * Performs a shallow copy of the properties from a source Map to a target MapLike - * - * @param source A map from which properties should be copied. - * @param target A map to which properties should be copied. - */ - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; - } - } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachEntry = forEachEntry; + /** `forEachEntry` for just keys. */ + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } + } + return undefined; + var _b; } - ts.appendProperty = appendProperty; + ts.forEachKey = forEachKey; + /** Copy entries from `source` to `target`. */ + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); + } + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -2026,24 +2108,6 @@ var ts; return t; } ts.assign = assign; - /** - * Reduce the properties of a map. - * - * NOTE: This is intended for use with Map objects. For MapLike objects, use - * reduceOwnProperties instead as it offers better runtime safety. - * - * @param map The map to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; /** * Performs a shallow equality comparison of the contents of two map-likes. * @@ -2074,23 +2138,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -2117,36 +2172,32 @@ var ts; return result; } ts.extend = extend; - /** - * Adds the value to an array of values associated with the key, and returns the array. - * Creates the array if it does not already exist. - */ - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - /** - * Removes a value from an array of values associated with the key. - * Does not preserve the order of those values. - * Does nothing if `key` is not in `map`, or `value` is not in `map[key]`. - */ - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; /** * Tests whether a value is an array. */ @@ -2330,9 +2381,12 @@ var ts; if (b === undefined) return 1 /* GreaterThan */; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - // accent means a ≠ b, a ≠ á, a = A - var result = a.localeCompare(b, /*locales*/ undefined, { usage: "sort", sensitivity: "accent" }); + // Checking if "collator exists indicates that Intl is available. + // We still have to check if "collator.compare" is correct. If it is not, use "String.localeComapre" + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, /*locales*/ undefined, { usage: "sort", sensitivity: "accent" }); // accent means a ≠ b, a ≠ á, a = A return result < 0 ? -1 /* LessThan */ : result > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */; } a = a.toUpperCase(); @@ -2777,6 +2831,17 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + // If excluding, match "foo/bar/baz...", but if including, only allow "foo". + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } @@ -2787,31 +2852,10 @@ var ts; * files or directories, does not match subdirectories that start with a . character */ var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - // If excluding, match "foo/bar/baz...", but if including, only allow "foo". - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; /** * An "includes" path "foo" is implicitly a glob "foo/** /*" (without the space) if its last component has no extension, * and does not contain any glob characters itself. @@ -2890,6 +2934,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -2902,34 +2947,50 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + // Associate an array of results with each include regex. This keeps results in order of the "include" order. + // If there are no "includes", then just put everything in results[0]. + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } + } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -2954,7 +3015,7 @@ var ts; } // Sort the offsets array using either the literal or canonical path representations. includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } @@ -2963,7 +3024,7 @@ var ts; // subpath of an existing base path for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -3489,32 +3550,32 @@ var ts; function createWatchedFileSet() { var dirWatchers = ts.createMap(); // One file can have multiple watchers - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -3526,7 +3587,7 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined" @@ -3534,10 +3595,13 @@ var ts; ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); // Some applications save a working file via rename operations - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } @@ -3613,10 +3677,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -4312,6 +4376,7 @@ var ts; Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -4322,6 +4387,7 @@ 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_2607", message: "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_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other 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_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -4370,6 +4436,7 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, @@ -4494,7 +4561,7 @@ var ts; Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'" }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -4509,6 +4576,7 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, @@ -4542,7 +4610,7 @@ var ts; Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'" }, File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, @@ -4676,9 +4744,10 @@ var ts; Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: {0}" }, Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, @@ -4697,7 +4766,7 @@ var ts; return token >= 70 /* Identifier */; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ + var textToToken = ts.createMapFromTemplate({ "abstract": 116 /* AbstractKeyword */, "any": 118 /* AnyKeyword */, "as": 117 /* AsKeyword */, @@ -4721,7 +4790,7 @@ var ts; "false": 85 /* FalseKeyword */, "finally": 86 /* FinallyKeyword */, "for": 87 /* ForKeyword */, - "from": 138 /* FromKeyword */, + "from": 139 /* FromKeyword */, "function": 88 /* FunctionKeyword */, "get": 124 /* GetKeyword */, "if": 89 /* IfKeyword */, @@ -4739,27 +4808,28 @@ var ts; "new": 93 /* NewKeyword */, "null": 94 /* NullKeyword */, "number": 132 /* NumberKeyword */, + "object": 133 /* ObjectKeyword */, "package": 110 /* PackageKeyword */, "private": 111 /* PrivateKeyword */, "protected": 112 /* ProtectedKeyword */, "public": 113 /* PublicKeyword */, "readonly": 130 /* ReadonlyKeyword */, "require": 131 /* RequireKeyword */, - "global": 139 /* GlobalKeyword */, + "global": 140 /* GlobalKeyword */, "return": 95 /* ReturnKeyword */, - "set": 133 /* SetKeyword */, + "set": 134 /* SetKeyword */, "static": 114 /* StaticKeyword */, - "string": 134 /* StringKeyword */, + "string": 135 /* StringKeyword */, "super": 96 /* SuperKeyword */, "switch": 97 /* SwitchKeyword */, - "symbol": 135 /* SymbolKeyword */, + "symbol": 136 /* SymbolKeyword */, "this": 98 /* ThisKeyword */, "throw": 99 /* ThrowKeyword */, "true": 100 /* TrueKeyword */, "try": 101 /* TryKeyword */, - "type": 136 /* TypeKeyword */, + "type": 137 /* TypeKeyword */, "typeof": 102 /* TypeOfKeyword */, - "undefined": 137 /* UndefinedKeyword */, + "undefined": 138 /* UndefinedKeyword */, "var": 103 /* VarKeyword */, "void": 104 /* VoidKeyword */, "while": 105 /* WhileKeyword */, @@ -4767,7 +4837,7 @@ var ts; "yield": 115 /* YieldKeyword */, "async": 119 /* AsyncKeyword */, "await": 120 /* AwaitKeyword */, - "of": 140 /* OfKeyword */, + "of": 141 /* OfKeyword */, "{": 16 /* OpenBraceToken */, "}": 17 /* CloseBraceToken */, "(": 18 /* OpenParenToken */, @@ -4907,9 +4977,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; - } + source.forEach(function (value, name) { + result[value] = name; + }); return result; } var tokenStrings = makeReverseMap(textToToken); @@ -4919,7 +4989,7 @@ var ts; ts.tokenToString = tokenToString; /* @internal */ function stringToToken(s) { - return textToToken[s]; + return textToToken.get(s); } ts.stringToToken = stringToToken; /* @internal */ @@ -4993,7 +5063,6 @@ var ts; return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -5736,8 +5805,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= 97 /* a */ && ch <= 122 /* z */) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = 70 /* Identifier */; @@ -6469,25 +6541,25 @@ var ts; } ts.getFullWidth = getFullWidth; function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); } ts.hasResolvedModule = hasResolvedModule; function getResolvedModule(sourceFile, moduleNameText) { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; } ts.getResolvedModule = getResolvedModule; function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = ts.createMap(); } - sourceFile.resolvedModules[moduleNameText] = resolvedModule; + sourceFile.resolvedModules.set(moduleNameText, resolvedModule); } ts.setResolvedModule = setResolvedModule; function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { if (!sourceFile.resolvedTypeReferenceDirectiveNames) { sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap(); } - sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective); } ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; /* @internal */ @@ -6509,7 +6581,7 @@ var ts; } for (var i = 0; i < names.length; i++) { var newResolution = newResolutions[i]; - var oldResolution = oldResolutions && oldResolutions[names[i]]; + var oldResolution = oldResolutions && oldResolutions.get(names[i]); var changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; @@ -6544,7 +6616,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 262 /* SourceFile */) { + while (node && node.kind !== 263 /* SourceFile */) { node = node.parent; } return node; @@ -6552,11 +6624,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 205 /* Block */: - case 233 /* CaseBlock */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return true; } return false; @@ -6647,18 +6719,18 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 293 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 294 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 263 /* FirstJSDocNode */ && node.kind <= 289 /* LastJSDocNode */; + return node.kind >= 264 /* FirstJSDocNode */ && node.kind <= 293 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 279 /* FirstJSDocTagNode */ && node.kind <= 292 /* LastJSDocTagNode */; + return node.kind >= 280 /* FirstJSDocTagNode */ && node.kind <= 293 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -6724,18 +6796,52 @@ var ts; } ts.getLiteralText = getLiteralText; function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { + return node.kind === 8 /* NumericLiteral */ + && (getNumericLiteralFlags(text, /*hint*/ 6 /* BinaryOrOctal */) & 6 /* BinaryOrOctal */) !== 0; + } + ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; + var NumericLiteralFlags; + (function (NumericLiteralFlags) { + NumericLiteralFlags[NumericLiteralFlags["None"] = 0] = "None"; + NumericLiteralFlags[NumericLiteralFlags["Hexadecimal"] = 1] = "Hexadecimal"; + NumericLiteralFlags[NumericLiteralFlags["Binary"] = 2] = "Binary"; + NumericLiteralFlags[NumericLiteralFlags["Octal"] = 4] = "Octal"; + NumericLiteralFlags[NumericLiteralFlags["Scientific"] = 8] = "Scientific"; + NumericLiteralFlags[NumericLiteralFlags["BinaryOrOctal"] = 6] = "BinaryOrOctal"; + NumericLiteralFlags[NumericLiteralFlags["BinaryOrOctalOrHexadecimal"] = 7] = "BinaryOrOctalOrHexadecimal"; + NumericLiteralFlags[NumericLiteralFlags["All"] = 15] = "All"; + })(NumericLiteralFlags = ts.NumericLiteralFlags || (ts.NumericLiteralFlags = {})); + /** + * Scans a numeric literal string to determine the form of the number. + * @param text Numeric literal text + * @param hint If `Scientific` or `All` is specified, performs a more expensive check to scan for scientific notation. + */ + function getNumericLiteralFlags(text, hint) { + if (text.length > 1) { switch (text.charCodeAt(1)) { case 98 /* b */: case 66 /* B */: + return 2 /* Binary */; case 111 /* o */: case 79 /* O */: - return true; + return 4 /* Octal */; + case 120 /* x */: + case 88 /* X */: + return 1 /* Hexadecimal */; + } + if (hint & 8 /* Scientific */) { + for (var i = text.length - 1; i >= 0; i--) { + switch (text.charCodeAt(i)) { + case 101 /* e */: + case 69 /* E */: + return 8 /* Scientific */; + } + } } } - return false; + return 0 /* None */; } - ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; + ts.getNumericLiteralFlags = getNumericLiteralFlags; function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; } @@ -6762,11 +6868,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 224 /* VariableDeclaration */ && node.parent.kind === 257 /* CatchClause */; + return node.kind === 225 /* VariableDeclaration */ && node.parent.kind === 258 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 231 /* ModuleDeclaration */ && + return node && node.kind === 232 /* ModuleDeclaration */ && (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -6777,11 +6883,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return node.kind === 231 /* ModuleDeclaration */ && (!node.body); + return node && node.kind === 232 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 262 /* SourceFile */ || - node.kind === 231 /* ModuleDeclaration */ || + return node.kind === 263 /* SourceFile */ || + node.kind === 232 /* ModuleDeclaration */ || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -6797,9 +6903,9 @@ var ts; return false; } switch (node.parent.kind) { - case 262 /* SourceFile */: + case 263 /* SourceFile */: return ts.isExternalModule(node.parent); - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -6811,22 +6917,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 262 /* SourceFile */: - case 233 /* CaseBlock */: - case 257 /* CatchClause */: - case 231 /* ModuleDeclaration */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 263 /* SourceFile */: + case 234 /* CaseBlock */: + case 258 /* CatchClause */: + case 232 /* ModuleDeclaration */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return true; - case 205 /* Block */: + case 206 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return parentNode && !isFunctionLike(parentNode); @@ -6860,7 +6966,7 @@ var ts; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: return name.text; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } @@ -6872,9 +6978,9 @@ var ts; switch (name.kind) { case 70 /* Identifier */: return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name); - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -6911,7 +7017,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 205 /* Block */) { + if (node.body && node.body.kind === 206 /* Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -6925,7 +7031,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 262 /* SourceFile */: + case 263 /* 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 @@ -6934,23 +7040,23 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 224 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 231 /* ModuleDeclaration */: - case 230 /* EnumDeclaration */: - case 261 /* EnumMember */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 229 /* TypeAliasDeclaration */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 262 /* EnumMember */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 230 /* TypeAliasDeclaration */: errorNode = node.name; break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -6973,7 +7079,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 230 /* EnumDeclaration */ && isConst(node); + return node.kind === 231 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -6986,11 +7092,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 179 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */; + return n.kind === 180 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 208 /* ExpressionStatement */ + return node.kind === 209 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -7003,10 +7109,10 @@ var ts; } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 144 /* Parameter */ || - node.kind === 143 /* TypeParameter */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 185 /* ArrowFunction */) ? + var commentRanges = (node.kind === 145 /* Parameter */ || + node.kind === 144 /* TypeParameter */ || + node.kind === 185 /* FunctionExpression */ || + node.kind === 186 /* ArrowFunction */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); // True if the comment starts with '/**' but not if it is '/**/' @@ -7021,39 +7127,39 @@ var ts; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (156 /* FirstTypeNode */ <= node.kind && node.kind <= 171 /* LastTypeNode */) { + if (157 /* FirstTypeNode */ <= node.kind && node.kind <= 172 /* LastTypeNode */) { return true; } switch (node.kind) { case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: - case 137 /* UndefinedKeyword */: + case 136 /* SymbolKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: return true; case 104 /* VoidKeyword */: - return node.parent.kind !== 188 /* VoidExpression */; - case 199 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 189 /* VoidExpression */; + case 200 /* 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 70 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 141 /* QualifiedName */: - case 177 /* PropertyAccessExpression */: + ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 142 /* QualifiedName */ || node.kind === 178 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 142 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: case 98 /* ThisKeyword */: - var parent_1 = node.parent; - if (parent_1.kind === 160 /* TypeQuery */) { + var parent = node.parent; + if (parent.kind === 161 /* TypeQuery */) { return false; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -7062,38 +7168,38 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (156 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 171 /* LastTypeNode */) { + if (157 /* FirstTypeNode */ <= parent.kind && parent.kind <= 172 /* LastTypeNode */) { return true; } - switch (parent_1.kind) { - case 199 /* ExpressionWithTypeArguments */: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 143 /* TypeParameter */: - return node === parent_1.constraint; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 144 /* Parameter */: - case 224 /* VariableDeclaration */: - return node === parent_1.type; - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - return node === parent_1.type; - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - return node === parent_1.type; - case 182 /* TypeAssertionExpression */: - return node === parent_1.type; - case 179 /* CallExpression */: - case 180 /* NewExpression */: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 181 /* TaggedTemplateExpression */: + switch (parent.kind) { + case 200 /* ExpressionWithTypeArguments */: + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); + case 144 /* TypeParameter */: + return node === parent.constraint; + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 145 /* Parameter */: + case 225 /* VariableDeclaration */: + return node === parent.type; + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return node === parent.type; + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + return node === parent.type; + case 183 /* TypeAssertionExpression */: + return node === parent.type; + case 180 /* CallExpression */: + case 181 /* NewExpression */: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 182 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -7112,7 +7218,7 @@ var ts; } ts.isChildOfNodeWithKind = isChildOfNodeWithKind; function isPrefixUnaryExpression(node) { - return node.kind === 190 /* PrefixUnaryExpression */; + return node.kind === 191 /* PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; // Warning: This has the same semantics as the forEach family of functions, @@ -7121,23 +7227,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitor(node); - case 233 /* CaseBlock */: - case 205 /* Block */: - case 209 /* IfStatement */: - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 218 /* WithStatement */: - case 219 /* SwitchStatement */: - case 254 /* CaseClause */: - case 255 /* DefaultClause */: - case 220 /* LabeledStatement */: - case 222 /* TryStatement */: - case 257 /* CatchClause */: + case 234 /* CaseBlock */: + case 206 /* Block */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 219 /* WithStatement */: + case 220 /* SwitchStatement */: + case 255 /* CaseClause */: + case 256 /* DefaultClause */: + case 221 /* LabeledStatement */: + case 223 /* TryStatement */: + case 258 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -7147,29 +7253,29 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 230 /* EnumDeclaration */: - case 228 /* InterfaceDeclaration */: - case 231 /* ModuleDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 231 /* EnumDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* 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. return; default: if (isFunctionLike(node)) { - var name_5 = node.name; - if (name_5 && name_5.kind === 142 /* ComputedPropertyName */) { + var name = node.name; + if (name && name.kind === 143 /* 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); + traverse(name.expression); return; } } @@ -7189,10 +7295,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 162 /* ArrayType */) { + if (node && node.kind === 163 /* ArrayType */) { return node.elementType; } - else if (node && node.kind === 157 /* TypeReference */) { + else if (node && node.kind === 158 /* TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -7203,14 +7309,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 174 /* BindingElement */: - case 261 /* EnumMember */: - case 144 /* Parameter */: - case 258 /* PropertyAssignment */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 259 /* ShorthandPropertyAssignment */: - case 224 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 262 /* EnumMember */: + case 145 /* Parameter */: + case 259 /* PropertyAssignment */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 260 /* ShorthandPropertyAssignment */: + case 225 /* VariableDeclaration */: return true; } } @@ -7218,11 +7324,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */); + return node && (node.kind === 152 /* GetAccessor */ || node.kind === 153 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 227 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */); + return node && (node.kind === 228 /* ClassDeclaration */ || node.kind === 198 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -7231,19 +7337,19 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return true; } return false; @@ -7251,13 +7357,13 @@ var ts; ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return true; } return false; @@ -7265,13 +7371,13 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 210 /* DoStatement */: - case 211 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: return true; - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -7282,7 +7388,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 220 /* LabeledStatement */) { + if (node.statement.kind !== 221 /* LabeledStatement */) { return node.statement; } node = node.statement; @@ -7290,17 +7396,17 @@ var ts; } ts.unwrapInnermostStatmentOfLabel = unwrapInnermostStatmentOfLabel; function isFunctionBlock(node) { - return node && node.kind === 205 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 206 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 149 /* MethodDeclaration */ && node.parent.kind === 176 /* ObjectLiteralExpression */; + return node && node.kind === 150 /* MethodDeclaration */ && node.parent.kind === 177 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { - return node.kind === 149 /* MethodDeclaration */ && - (node.parent.kind === 176 /* ObjectLiteralExpression */ || - node.parent.kind === 197 /* ClassExpression */); + return node.kind === 150 /* MethodDeclaration */ && + (node.parent.kind === 177 /* ObjectLiteralExpression */ || + node.parent.kind === 198 /* ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -7336,7 +7442,7 @@ var ts; return undefined; } switch (node.kind) { - case 142 /* ComputedPropertyName */: + case 143 /* 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 @@ -7351,9 +7457,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 145 /* 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; @@ -7364,26 +7470,26 @@ var ts; node = node.parent; } break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 231 /* ModuleDeclaration */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 230 /* EnumDeclaration */: - case 262 /* SourceFile */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 232 /* ModuleDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 231 /* EnumDeclaration */: + case 263 /* SourceFile */: return node; } } @@ -7393,9 +7499,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 150 /* Constructor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return container; } } @@ -7417,26 +7523,26 @@ var ts; return node; } switch (node.kind) { - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: node = node.parent; break; - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: if (!stopOnFunctions) { continue; } - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return node; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 145 /* 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; @@ -7452,15 +7558,15 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */) { + if (func.kind === 185 /* FunctionExpression */ || func.kind === 186 /* ArrowFunction */) { var prev = func; - var parent_2 = func.parent; - while (parent_2.kind === 183 /* ParenthesizedExpression */) { - prev = parent_2; - parent_2 = parent_2.parent; + var parent = func.parent; + while (parent.kind === 184 /* ParenthesizedExpression */) { + prev = parent; + parent = parent.parent; } - if (parent_2.kind === 179 /* CallExpression */ && parent_2.expression === prev) { - return parent_2; + if (parent.kind === 180 /* CallExpression */ && parent.expression === prev) { + return parent; } } } @@ -7470,21 +7576,21 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 177 /* PropertyAccessExpression */ || kind === 178 /* ElementAccessExpression */) + return (kind === 178 /* PropertyAccessExpression */ || kind === 179 /* ElementAccessExpression */) && node.expression.kind === 96 /* SuperKeyword */; } ts.isSuperProperty = isSuperProperty; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 157 /* TypeReference */: - case 273 /* JSDocTypeReference */: + case 158 /* TypeReference */: + case 274 /* JSDocTypeReference */: return node.typeName; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; case 70 /* Identifier */: - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return node; } return undefined; @@ -7492,10 +7598,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function isCallLikeExpression(node) { switch (node.kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 181 /* TaggedTemplateExpression */: - case 145 /* Decorator */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 182 /* TaggedTemplateExpression */: + case 146 /* Decorator */: return true; default: return false; @@ -7503,7 +7609,7 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function getInvokedExpression(node) { - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression, NewExpression, or Decorator. @@ -7512,25 +7618,25 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: // classes are valid targets return true; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 227 /* ClassDeclaration */; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: + return node.parent.kind === 228 /* ClassDeclaration */; + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && node.parent.kind === 227 /* ClassDeclaration */; - case 144 /* Parameter */: + && node.parent.kind === 228 /* ClassDeclaration */; + case 145 /* 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 !== undefined - && (node.parent.kind === 150 /* Constructor */ - || node.parent.kind === 149 /* MethodDeclaration */ - || node.parent.kind === 152 /* SetAccessor */) - && node.parent.parent.kind === 227 /* ClassDeclaration */; + && (node.parent.kind === 151 /* Constructor */ + || node.parent.kind === 150 /* MethodDeclaration */ + || node.parent.kind === 153 /* SetAccessor */) + && node.parent.parent.kind === 228 /* ClassDeclaration */; } return false; } @@ -7546,19 +7652,19 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 149 /* MethodDeclaration */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 153 /* SetAccessor */: return ts.forEach(node.parameters, nodeIsDecorated); } } ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 249 /* JsxOpeningElement */ || - parent.kind === 248 /* JsxSelfClosingElement */ || - parent.kind === 250 /* JsxClosingElement */) { + if (parent.kind === 250 /* JsxOpeningElement */ || + parent.kind === 249 /* JsxSelfClosingElement */ || + parent.kind === 251 /* JsxClosingElement */) { return parent.tagName === node; } return false; @@ -7572,97 +7678,97 @@ var ts; case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: case 11 /* RegularExpressionLiteral */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 181 /* TaggedTemplateExpression */: - case 200 /* AsExpression */: - case 182 /* TypeAssertionExpression */: - case 201 /* NonNullExpression */: - case 183 /* ParenthesizedExpression */: - case 184 /* FunctionExpression */: - case 197 /* ClassExpression */: - case 185 /* ArrowFunction */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 187 /* TypeOfExpression */: - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: - case 192 /* BinaryExpression */: - case 193 /* ConditionalExpression */: - case 196 /* SpreadElement */: - case 194 /* TemplateExpression */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 182 /* TaggedTemplateExpression */: + case 201 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 202 /* NonNullExpression */: + case 184 /* ParenthesizedExpression */: + case 185 /* FunctionExpression */: + case 198 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 188 /* TypeOfExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: + case 193 /* BinaryExpression */: + case 194 /* ConditionalExpression */: + case 197 /* SpreadElement */: + case 195 /* TemplateExpression */: case 12 /* NoSubstitutionTemplateLiteral */: - case 198 /* OmittedExpression */: - case 247 /* JsxElement */: - case 248 /* JsxSelfClosingElement */: - case 195 /* YieldExpression */: - case 189 /* AwaitExpression */: - case 202 /* MetaProperty */: + case 199 /* OmittedExpression */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: + case 196 /* YieldExpression */: + case 190 /* AwaitExpression */: + case 203 /* MetaProperty */: return true; - case 141 /* QualifiedName */: - while (node.parent.kind === 141 /* QualifiedName */) { + case 142 /* QualifiedName */: + while (node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node); + return node.parent.kind === 161 /* TypeQuery */ || isJSXTagName(node); case 70 /* Identifier */: - if (node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node)) { + if (node.parent.kind === 161 /* TypeQuery */ || isJSXTagName(node)) { return true; } // fall through case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 98 /* ThisKeyword */: - var parent_3 = node.parent; - switch (parent_3.kind) { - case 224 /* VariableDeclaration */: - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 261 /* EnumMember */: - case 258 /* PropertyAssignment */: - case 174 /* BindingElement */: - return parent_3.initializer === node; - case 208 /* ExpressionStatement */: - case 209 /* IfStatement */: - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - case 217 /* ReturnStatement */: - case 218 /* WithStatement */: - case 219 /* SwitchStatement */: - case 254 /* CaseClause */: - case 221 /* ThrowStatement */: - case 219 /* SwitchStatement */: - return parent_3.expression === node; - case 212 /* ForStatement */: - var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 225 /* VariableDeclarationList */) || + var parent = node.parent; + switch (parent.kind) { + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 262 /* EnumMember */: + case 259 /* PropertyAssignment */: + case 175 /* BindingElement */: + return parent.initializer === node; + case 209 /* ExpressionStatement */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 218 /* ReturnStatement */: + case 219 /* WithStatement */: + case 220 /* SwitchStatement */: + case 255 /* CaseClause */: + case 222 /* ThrowStatement */: + case 220 /* SwitchStatement */: + return parent.expression === node; + case 213 /* ForStatement */: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 226 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 225 /* VariableDeclarationList */) || + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 226 /* VariableDeclarationList */) || forInStatement.expression === node; - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: - return node === parent_3.expression; - case 203 /* TemplateSpan */: - return node === parent_3.expression; - case 142 /* ComputedPropertyName */: - return node === parent_3.expression; - case 145 /* Decorator */: - case 253 /* JsxExpression */: - case 252 /* JsxSpreadAttribute */: - case 260 /* SpreadAssignment */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: + return node === parent.expression; + case 204 /* TemplateSpan */: + return node === parent.expression; + case 143 /* ComputedPropertyName */: + return node === parent.expression; + case 146 /* Decorator */: + case 254 /* JsxExpression */: + case 253 /* JsxSpreadAttribute */: + case 261 /* SpreadAssignment */: return true; - case 199 /* ExpressionWithTypeArguments */: - return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); + case 200 /* ExpressionWithTypeArguments */: + return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: - if (isPartOfExpression(parent_3)) { + if (isPartOfExpression(parent)) { return true; } } @@ -7677,7 +7783,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 246 /* ExternalModuleReference */; + return node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 247 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7686,7 +7792,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 246 /* ExternalModuleReference */; + return node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 247 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7704,7 +7810,7 @@ var ts; */ function isRequireCall(expression, checkArgumentIsStringLiteral) { // of the form 'require("name")' - var isRequire = expression.kind === 179 /* CallExpression */ && + var isRequire = expression.kind === 180 /* CallExpression */ && expression.expression.kind === 70 /* Identifier */ && expression.expression.text === "require" && expression.arguments.length === 1; @@ -7720,9 +7826,9 @@ var ts; * This function does not test if the node is in a JavaScript file or not. */ function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 224 /* VariableDeclaration */) { + if (s.valueDeclaration && s.valueDeclaration.kind === 225 /* VariableDeclaration */) { var declaration = s.valueDeclaration; - return declaration.initializer && declaration.initializer.kind === 184 /* FunctionExpression */; + return declaration.initializer && declaration.initializer.kind === 185 /* FunctionExpression */; } return false; } @@ -7733,11 +7839,11 @@ var ts; if (!isInJavaScriptFile(expression)) { return 0 /* None */; } - if (expression.kind !== 192 /* BinaryExpression */) { + if (expression.kind !== 193 /* BinaryExpression */) { return 0 /* None */; } var expr = expression; - if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 177 /* PropertyAccessExpression */) { + if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 178 /* PropertyAccessExpression */) { return 0 /* None */; } var lhs = expr.left; @@ -7755,7 +7861,7 @@ var ts; else if (lhs.expression.kind === 98 /* ThisKeyword */) { return 4 /* ThisProperty */; } - else if (lhs.expression.kind === 177 /* PropertyAccessExpression */) { + else if (lhs.expression.kind === 178 /* PropertyAccessExpression */) { // chained dot, e.g. x.y.z = expr; this var is the 'x.y' part var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 70 /* Identifier */) { @@ -7773,35 +7879,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 236 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 235 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 246 /* ExternalModuleReference */) { + if (reference.kind === 247 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 242 /* ExportDeclaration */) { + if (node.kind === 243 /* ExportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 231 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + if (node.kind === 232 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 235 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 238 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 239 /* NamespaceImport */) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 236 /* ImportDeclaration */ + return node.kind === 237 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } @@ -7809,13 +7915,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 144 /* Parameter */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 259 /* ShorthandPropertyAssignment */: - case 258 /* PropertyAssignment */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 145 /* Parameter */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 260 /* ShorthandPropertyAssignment */: + case 259 /* PropertyAssignment */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -7823,9 +7929,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 275 /* JSDocFunctionType */ && + return node.kind === 276 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 277 /* JSDocConstructorType */; + node.parameters[0].type.kind === 278 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { @@ -7838,7 +7944,7 @@ var ts; var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 282 /* JSDocParameterTag */) { + if (doc.kind === 283 /* JSDocParameterTag */) { if (doc.kind === kind) { result.push(doc); } @@ -7870,9 +7976,9 @@ var ts; // var x = function(name) { return name.length; } var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 206 /* VariableStatement */; + parent.parent.parent.kind === 207 /* VariableStatement */; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 206 /* VariableStatement */; + parent.parent.kind === 207 /* VariableStatement */; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -7881,20 +7987,20 @@ var ts; } // Also recognize when the node is the RHS of an assignment expression var isSourceOfAssignmentExpressionStatement = parent && parent.parent && - parent.kind === 192 /* BinaryExpression */ && + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && - parent.parent.kind === 208 /* ExpressionStatement */; + parent.parent.kind === 209 /* ExpressionStatement */; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 231 /* ModuleDeclaration */ && - parent && parent.kind === 231 /* ModuleDeclaration */; - var isPropertyAssignmentExpression = parent && parent.kind === 258 /* PropertyAssignment */; + var isModuleDeclaration = node.kind === 232 /* ModuleDeclaration */ && + parent && parent.kind === 232 /* ModuleDeclaration */; + var isPropertyAssignmentExpression = parent && parent.kind === 259 /* PropertyAssignment */; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } // Pull parameter comments from declaring function as well - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { cache = ts.concatenate(cache, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { @@ -7908,18 +8014,18 @@ var ts; return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 282 /* JSDocParameterTag */); + var tags = getJSDocTags(func, 283 /* JSDocParameterTag */); if (!param.name) { // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 282 /* JSDocParameterTag */; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 283 /* JSDocParameterTag */; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70 /* Identifier */) { - var name_6 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 282 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); + var name_1 = param.name.text; + return ts.filter(tags, function (tag) { return tag.kind === 283 /* JSDocParameterTag */ && tag.parameterName.text === name_1; }); } else { // TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines @@ -7929,8 +8035,8 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 284 /* JSDocTypeTag */); - if (!tag && node.kind === 144 /* Parameter */) { + var tag = getFirstJSDocTag(node, 285 /* JSDocTypeTag */); + if (!tag && node.kind === 145 /* Parameter */) { var paramTags = getJSDocParameterTags(node); if (paramTags) { tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); @@ -7940,15 +8046,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 281 /* JSDocAugmentsTag */); + return getFirstJSDocTag(node, 282 /* JSDocAugmentsTag */); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 283 /* JSDocReturnTag */); + return getFirstJSDocTag(node, 284 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 285 /* JSDocTemplateTag */); + return getFirstJSDocTag(node, 286 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -7961,8 +8067,8 @@ var ts; ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { if (node && (node.flags & 65536 /* JavaScriptFile */)) { - if (node.type && node.type.kind === 276 /* JSDocVariadicType */ || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 276 /* JSDocVariadicType */; })) { + if (node.type && node.type.kind === 277 /* JSDocVariadicType */ || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 277 /* JSDocVariadicType */; })) { return true; } } @@ -7983,29 +8089,33 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 57 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 42 /* PlusPlusToken */ || unaryOperator === 43 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return parent.initializer === node ? 1 /* Definite */ : 0 /* None */; - case 183 /* ParenthesizedExpression */: - case 175 /* ArrayLiteralExpression */: - case 196 /* SpreadElement */: + case 184 /* ParenthesizedExpression */: + case 176 /* ArrayLiteralExpression */: + case 197 /* SpreadElement */: node = parent; break; - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } - // Fall through - case 258 /* PropertyAssignment */: + node = parent.parent; + break; + case 259 /* PropertyAssignment */: + if (parent.name === node) { + return 0 /* None */; + } node = parent.parent; break; default: @@ -8017,21 +8127,22 @@ var ts; ts.getAssignmentTargetKind = getAssignmentTargetKind; // 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'. + // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ a }] = xxx'. + // (Note that `p` is not a target in the above examples, only `a`.) function isAssignmentTarget(node) { return getAssignmentTargetKind(node) !== 0 /* None */; } ts.isAssignmentTarget = isAssignmentTarget; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 177 /* PropertyAccessExpression */ && node.kind !== 178 /* ElementAccessExpression */) { + if (node.kind !== 178 /* PropertyAccessExpression */ && node.kind !== 179 /* ElementAccessExpression */) { return false; } node = node.parent; - while (node && node.kind === 183 /* ParenthesizedExpression */) { + while (node && node.kind === 184 /* ParenthesizedExpression */) { node = node.parent; } - return node && node.kind === 186 /* DeleteExpression */; + return node && node.kind === 187 /* DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -8045,7 +8156,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2 /* Ambient */) || (node.kind === 262 /* SourceFile */ && node.isDeclarationFile)) { + if (hasModifier(node, 2 /* Ambient */) || (node.kind === 263 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -8059,7 +8170,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 240 /* ImportSpecifier */ || parent.kind === 244 /* ExportSpecifier */) { + if (parent.kind === 241 /* ImportSpecifier */ || parent.kind === 245 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -8072,7 +8183,7 @@ var ts; ts.isDeclarationName = isDeclarationName; function isLiteralComputedPropertyDeclarationName(node) { return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - node.parent.kind === 142 /* ComputedPropertyName */ && + node.parent.kind === 143 /* ComputedPropertyName */ && isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -8080,31 +8191,31 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 261 /* EnumMember */: - case 258 /* PropertyAssignment */: - case 177 /* PropertyAccessExpression */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 262 /* EnumMember */: + case 259 /* PropertyAssignment */: + case 178 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 141 /* QualifiedName */) { + while (parent.kind === 142 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 160 /* TypeQuery */; + return parent.kind === 161 /* TypeQuery */; } return false; - case 174 /* BindingElement */: - case 240 /* ImportSpecifier */: + case 175 /* BindingElement */: + case 241 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 244 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -8120,13 +8231,13 @@ var ts; // export = // export default function isAliasSymbolDeclaration(node) { - return node.kind === 235 /* ImportEqualsDeclaration */ || - node.kind === 234 /* NamespaceExportDeclaration */ || - node.kind === 237 /* ImportClause */ && !!node.name || - node.kind === 238 /* NamespaceImport */ || - node.kind === 240 /* ImportSpecifier */ || - node.kind === 244 /* ExportSpecifier */ || - node.kind === 241 /* ExportAssignment */ && exportAssignmentIsAlias(node); + return node.kind === 236 /* ImportEqualsDeclaration */ || + node.kind === 235 /* NamespaceExportDeclaration */ || + node.kind === 238 /* ImportClause */ && !!node.name || + node.kind === 239 /* NamespaceImport */ || + node.kind === 241 /* ImportSpecifier */ || + node.kind === 245 /* ExportSpecifier */ || + node.kind === 242 /* ExportAssignment */ && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8212,7 +8323,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 71 /* FirstKeyword */ <= token && token <= 140 /* LastKeyword */; + return 71 /* FirstKeyword */ <= token && token <= 141 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -8241,7 +8352,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 142 /* ComputedPropertyName */ && + return name.kind === 143 /* ComputedPropertyName */ && !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } @@ -8256,10 +8367,10 @@ var ts; } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 144 /* Parameter */) { + if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 145 /* Parameter */) { return name.text; } - if (name.kind === 142 /* ComputedPropertyName */) { + if (name.kind === 143 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -8307,11 +8418,11 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 144 /* Parameter */; + return root.kind === 145 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 174 /* BindingElement */) { + while (node.kind === 175 /* BindingElement */) { node = node.parent.parent; } return node; @@ -8319,15 +8430,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 150 /* Constructor */ - || kind === 184 /* FunctionExpression */ - || kind === 226 /* FunctionDeclaration */ - || kind === 185 /* ArrowFunction */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 231 /* ModuleDeclaration */ - || kind === 262 /* SourceFile */; + return kind === 151 /* Constructor */ + || kind === 185 /* FunctionExpression */ + || kind === 227 /* FunctionDeclaration */ + || kind === 186 /* ArrowFunction */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 232 /* ModuleDeclaration */ + || kind === 263 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -8388,23 +8499,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 /* NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 180 /* NewExpression */: + case 181 /* NewExpression */: return hasArguments ? 0 /* Left */ : 1 /* Right */; - case 190 /* PrefixUnaryExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 189 /* AwaitExpression */: - case 193 /* ConditionalExpression */: - case 195 /* YieldExpression */: + case 191 /* PrefixUnaryExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 190 /* AwaitExpression */: + case 194 /* ConditionalExpression */: + case 196 /* YieldExpression */: return 1 /* Right */; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (operator) { case 39 /* AsteriskAsteriskToken */: case 57 /* EqualsToken */: @@ -8428,15 +8539,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 /* NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 192 /* BinaryExpression */) { + if (expression.kind === 193 /* BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 190 /* PrefixUnaryExpression */ || expression.kind === 191 /* PostfixUnaryExpression */) { + else if (expression.kind === 191 /* PrefixUnaryExpression */ || expression.kind === 192 /* PostfixUnaryExpression */) { return expression.operator; } else { @@ -8454,36 +8565,36 @@ var ts; case 85 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 197 /* ClassExpression */: - case 247 /* JsxElement */: - case 248 /* JsxSelfClosingElement */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 198 /* ClassExpression */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: case 11 /* RegularExpressionLiteral */: case 12 /* NoSubstitutionTemplateLiteral */: - case 194 /* TemplateExpression */: - case 183 /* ParenthesizedExpression */: - case 198 /* OmittedExpression */: + case 195 /* TemplateExpression */: + case 184 /* ParenthesizedExpression */: + case 199 /* OmittedExpression */: return 19; - case 181 /* TaggedTemplateExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 182 /* TaggedTemplateExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: return 18; - case 180 /* NewExpression */: + case 181 /* NewExpression */: return hasArguments ? 18 : 17; - case 179 /* CallExpression */: + case 180 /* CallExpression */: return 17; - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return 16; - case 190 /* PrefixUnaryExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 189 /* AwaitExpression */: + case 191 /* PrefixUnaryExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 190 /* AwaitExpression */: return 15; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (operatorKind) { case 50 /* ExclamationToken */: case 51 /* TildeToken */: @@ -8541,11 +8652,11 @@ var ts; default: return -1; } - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return 4; - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return 2; - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return 1; default: return -1; @@ -8568,21 +8679,15 @@ var ts; return modificationCount; } function reattachFileDiagnostics(newFile) { - if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { - return; - } - for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { - var diagnostic = _a[_i]; - diagnostic.file = newFile; - } + ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } function add(diagnostic) { var diagnostics; if (diagnostic.file) { - diagnostics = fileDiagnostics[diagnostic.file.fileName]; + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); if (!diagnostics) { diagnostics = []; - fileDiagnostics[diagnostic.file.fileName] = diagnostics; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); } } else { @@ -8599,16 +8704,16 @@ var ts; function getDiagnostics(fileName) { sortAndDeduplicate(); if (fileName) { - return fileDiagnostics[fileName] || []; + return fileDiagnostics.get(fileName) || []; } var allDiagnostics = []; function pushDiagnostic(d) { allDiagnostics.push(d); } ts.forEach(nonFileDiagnostics, pushDiagnostic); - for (var key in fileDiagnostics) { - ts.forEach(fileDiagnostics[key], pushDiagnostic); - } + fileDiagnostics.forEach(function (diagnostics) { + ts.forEach(diagnostics, pushDiagnostic); + }); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function sortAndDeduplicate() { @@ -8617,9 +8722,9 @@ var ts; } diagnosticsModified = false; nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (var key in fileDiagnostics) { - fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); - } + fileDiagnostics.forEach(function (diagnostics, key) { + fileDiagnostics.set(key, ts.sortAndDeduplicateDiagnostics(diagnostics)); + }); } } ts.createDiagnosticCollection = createDiagnosticCollection; @@ -8629,7 +8734,7 @@ var ts; // the map below must be updated. Note that this regexp *does not* include the 'delete' character. // There is no reason for this other than that JSON.stringify does not handle it either. var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = ts.createMap({ + var escapedCharsMap = ts.createMapFromTemplate({ "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -8653,7 +8758,7 @@ var ts; } ts.escapeString = escapeString; function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); @@ -8811,168 +8916,77 @@ var ts; */ function getSourceFilesToEmit(host, targetSourceFile) { var options = host.getCompilerOptions(); + var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); }; if (options.outFile || options.out) { var moduleKind = ts.getEmitModuleKind(options); - var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; - var sourceFiles = getAllEmittableSourceFiles(); + var moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; // Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified - return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule); + return ts.filter(host.getSourceFiles(), function (sourceFile) { + return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); + }); } else { - var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile]; - return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); }); - } - function getAllEmittableSourceFiles() { - return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles(); + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); }); } } ts.getSourceFilesToEmit = getSourceFilesToEmit; - /** Don't call this for `--outFile`, just for `--outDir` or plain emit. */ - function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) { - return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); }); - } - ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory; - function isNonDeclarationFile(sourceFile) { - return !isDeclarationFile(sourceFile); - } - /** - * Whether a file should be emitted in a non-`--outFile` case. - * Don't emit if source file is a declaration file, or was located under node_modules - */ - function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) { - return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); - } - function isBundleEmitNonExternalModule(sourceFile) { - return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile); + /** Don't call this for `--outFile`, just for `--outDir` or plain emit. `--outFile` needs additional checks. */ + function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) { + return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !isDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); } + ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted; /** - * Iterates over each source file to emit. The source files are expected to have been - * transformed for use by the pretty printer. - * - * Originally part of `forEachExpectedEmitFile`, this functionality was extracted to support - * transformations. + * Iterates over the source files that are expected to have an emit output. * * @param host An EmitHost. - * @param sourceFiles The transformed source files to emit. * @param action The action to execute. + * @param sourceFilesOrTargetSourceFile + * If an array, the full list of source files to emit. + * Else, calls `getSourceFilesToEmit` with the (optional) target source file to determine the list of source files to emit. */ - function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) { + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { + var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); var options = host.getCompilerOptions(); - // Emit on each source file if (options.outFile || options.out) { - onBundledEmit(sourceFiles); + if (sourceFiles.length) { + var jsFilePath = options.outFile || options.out; + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFiles, /*isBundledEmit*/ true, emitOnlyDtsFiles); + } } else { for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { var sourceFile = sourceFiles_2[_i]; - // Don't emit if source file is a declaration file, or was located under node_modules - if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { - onSingleFileEmit(host, sourceFile); - } - } - } - function onSingleFileEmit(host, sourceFile) { - // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. - // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. - // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve - var extension = ".js"; - if (options.jsx === 1 /* Preserve */) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1 /* JSX */) { - // TypeScript source file preserving JSX syntax - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], /*isBundledEmit*/ false); - } - function onBundledEmit(sourceFiles) { - if (sourceFiles.length) { - var jsFilePath = options.outFile || options.out; + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, /*isBundledEmit*/ true); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, [sourceFile], /*isBundledEmit*/ false, emitOnlyDtsFiles); } } } - ts.forEachTransformedEmitFile = forEachTransformedEmitFile; + ts.forEachEmittedFile = forEachEmittedFile; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - /** - * Iterates over the source files that are expected to have an emit output. This function - * is used by the legacy emitter and the declaration emitter and should not be used by - * the tree transforming emitter. - * - * @param host An EmitHost. - * @param action The action to execute. - * @param targetSourceFile An optional target source file to emit. - */ - function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) { - var options = host.getCompilerOptions(); - // Emit on each source file - if (options.outFile || options.out) { - onBundledEmit(host); - } - else { - var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile]; - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; - if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) { - onSingleFileEmit(host, sourceFile); + // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. + // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. + // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve + function getOutputExtension(sourceFile, options) { + if (options.jsx === 1 /* Preserve */) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + return ".jsx"; } } - } - function onSingleFileEmit(host, sourceFile) { - // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. - // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. - // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve - var extension = ".js"; - if (options.jsx === 1 /* Preserve */) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1 /* JSX */) { - // TypeScript source file preserving JSX syntax - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: declarationFilePath - }; - action(emitFileNames, [sourceFile], /*isBundledEmit*/ false, emitOnlyDtsFiles); - } - function onBundledEmit(host) { - // Can emit only sources that are not declaration file and are either non module code or module with - // --module or --target es6 specified. Files included by searching under node_modules are also not emitted. - var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) && - !host.isSourceFileFromExternalLibrary(sourceFile) && - (!ts.isExternalModule(sourceFile) || - !!ts.getEmitModuleKind(options)); }); - if (bundledSources.length) { - var jsFilePath = options.outFile || options.out; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined - }; - action(emitFileNames, bundledSources, /*isBundledEmit*/ true, emitOnlyDtsFiles); + else if (sourceFile.languageVariant === 1 /* JSX */) { + // TypeScript source file preserving JSX syntax + return ".jsx"; } } + return ".js"; } - ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); var commonSourceDirectory = host.getCommonSourceDirectory(); @@ -8997,7 +9011,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 150 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 151 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -9039,10 +9053,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 151 /* GetAccessor */) { + if (accessor.kind === 152 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 152 /* SetAccessor */) { + else if (accessor.kind === 153 /* SetAccessor */) { setAccessor = accessor; } else { @@ -9051,7 +9065,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 151 /* GetAccessor */ || member.kind === 152 /* SetAccessor */) + if ((member.kind === 152 /* GetAccessor */ || member.kind === 153 /* SetAccessor */) && hasModifier(member, 32 /* Static */) === hasModifier(accessor, 32 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -9062,10 +9076,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 151 /* GetAccessor */ && !getAccessor) { + if (member.kind === 152 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 152 /* SetAccessor */ && !setAccessor) { + if (member.kind === 153 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -9328,7 +9342,7 @@ var ts; ts.isAssignmentOperator = isAssignmentOperator; /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */ function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 199 /* ExpressionWithTypeArguments */ && + if (node.kind === 200 /* ExpressionWithTypeArguments */ && node.parent.token === 84 /* ExtendsKeyword */ && isClassLike(node.parent.parent)) { return node.parent.parent; @@ -9346,8 +9360,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 176 /* ObjectLiteralExpression */ - || kind === 175 /* ArrayLiteralExpression */; + return kind === 177 /* ObjectLiteralExpression */ + || kind === 176 /* ArrayLiteralExpression */; } return false; } @@ -9375,29 +9389,33 @@ var ts; ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isEntityNameExpression(node) { return node.kind === 70 /* Identifier */ || - node.kind === 177 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression); + node.kind === 178 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression); } ts.isEntityNameExpression = isEntityNameExpression; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 176 /* ObjectLiteralExpression */) { + if (kind === 177 /* ObjectLiteralExpression */) { return expression.properties.length === 0; } - if (kind === 175 /* ArrayLiteralExpression */) { + if (kind === 176 /* ArrayLiteralExpression */) { return expression.elements.length === 0; } return false; } ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; + return isExportDefaultSymbol(symbol) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function isExportDefaultSymbol(symbol) { + return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512 /* Default */); + } + ts.isExportDefaultSymbol = isExportDefaultSymbol; /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTypeScriptExtension(fileName) { return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); @@ -9509,39 +9527,39 @@ var ts; || kind === 94 /* NullKeyword */) { return true; } - else if (kind === 177 /* PropertyAccessExpression */) { + else if (kind === 178 /* PropertyAccessExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 178 /* ElementAccessExpression */) { + else if (kind === 179 /* ElementAccessExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1) && isSimpleExpressionWorker(node.argumentExpression, depth + 1); } - else if (kind === 190 /* PrefixUnaryExpression */ - || kind === 191 /* PostfixUnaryExpression */) { + else if (kind === 191 /* PrefixUnaryExpression */ + || kind === 192 /* PostfixUnaryExpression */) { return isSimpleExpressionWorker(node.operand, depth + 1); } - else if (kind === 192 /* BinaryExpression */) { + else if (kind === 193 /* BinaryExpression */) { return node.operatorToken.kind !== 39 /* AsteriskAsteriskToken */ && isSimpleExpressionWorker(node.left, depth + 1) && isSimpleExpressionWorker(node.right, depth + 1); } - else if (kind === 193 /* ConditionalExpression */) { + else if (kind === 194 /* ConditionalExpression */) { return isSimpleExpressionWorker(node.condition, depth + 1) && isSimpleExpressionWorker(node.whenTrue, depth + 1) && isSimpleExpressionWorker(node.whenFalse, depth + 1); } - else if (kind === 188 /* VoidExpression */ - || kind === 187 /* TypeOfExpression */ - || kind === 186 /* DeleteExpression */) { + else if (kind === 189 /* VoidExpression */ + || kind === 188 /* TypeOfExpression */ + || kind === 187 /* DeleteExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 175 /* ArrayLiteralExpression */) { + else if (kind === 176 /* ArrayLiteralExpression */) { return node.elements.length === 0; } - else if (kind === 176 /* ObjectLiteralExpression */) { + else if (kind === 177 /* ObjectLiteralExpression */) { return node.properties.length === 0; } - else if (kind === 179 /* CallExpression */) { + else if (kind === 180 /* CallExpression */) { if (!isSimpleExpressionWorker(node.expression, depth + 1)) { return false; } @@ -9556,16 +9574,19 @@ var ts; } return false; } - var syntaxKindCache = ts.createMap(); + var syntaxKindCache = []; function formatSyntaxKind(kind) { var syntaxKindEnum = ts.SyntaxKind; if (syntaxKindEnum) { - if (syntaxKindCache[kind]) { - return syntaxKindCache[kind]; + var cached = syntaxKindCache[kind]; + if (cached !== undefined) { + return cached; } - for (var name_7 in syntaxKindEnum) { - if (syntaxKindEnum[name_7] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name_7 + ")"; + for (var name in syntaxKindEnum) { + if (syntaxKindEnum[name] === kind) { + var result = kind + " (" + name + ")"; + syntaxKindCache[kind] = result; + return result; } } } @@ -9708,8 +9729,8 @@ var ts; var parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 230 /* EnumDeclaration */: - case 231 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -9730,7 +9751,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* ClassDeclaration */ && declaration !== node) { + if (declaration.kind === 228 /* ClassDeclaration */ && declaration !== node) { return true; } } @@ -9796,7 +9817,7 @@ var ts; } ts.isIdentifier = isIdentifier; function isVoidExpression(node) { - return node.kind === 188 /* VoidExpression */; + return node.kind === 189 /* VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { @@ -9811,16 +9832,16 @@ var ts; ts.isModifier = isModifier; // Names function isQualifiedName(node) { - return node.kind === 141 /* QualifiedName */; + return node.kind === 142 /* QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 142 /* ComputedPropertyName */; + return node.kind === 143 /* ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; function isEntityName(node) { var kind = node.kind; - return kind === 141 /* QualifiedName */ + return kind === 142 /* QualifiedName */ || kind === 70 /* Identifier */; } ts.isEntityName = isEntityName; @@ -9829,7 +9850,7 @@ var ts; return kind === 70 /* Identifier */ || kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */ - || kind === 142 /* ComputedPropertyName */; + || kind === 143 /* ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isModuleName(node) { @@ -9841,61 +9862,61 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 70 /* Identifier */ - || kind === 172 /* ObjectBindingPattern */ - || kind === 173 /* ArrayBindingPattern */; + || kind === 173 /* ObjectBindingPattern */ + || kind === 174 /* ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Signature elements function isTypeParameter(node) { - return node.kind === 143 /* TypeParameter */; + return node.kind === 144 /* TypeParameter */; } ts.isTypeParameter = isTypeParameter; function isParameter(node) { - return node.kind === 144 /* Parameter */; + return node.kind === 145 /* Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 145 /* Decorator */; + return node.kind === 146 /* Decorator */; } ts.isDecorator = isDecorator; // Type members function isMethodDeclaration(node) { - return node.kind === 149 /* MethodDeclaration */; + return node.kind === 150 /* MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassElement(node) { var kind = node.kind; - return kind === 150 /* Constructor */ - || kind === 147 /* PropertyDeclaration */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 155 /* IndexSignature */ - || kind === 204 /* SemicolonClassElement */; + return kind === 151 /* Constructor */ + || kind === 148 /* PropertyDeclaration */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 156 /* IndexSignature */ + || kind === 205 /* SemicolonClassElement */; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 258 /* PropertyAssignment */ - || kind === 259 /* ShorthandPropertyAssignment */ - || kind === 260 /* SpreadAssignment */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 245 /* MissingDeclaration */; + return kind === 259 /* PropertyAssignment */ + || kind === 260 /* ShorthandPropertyAssignment */ + || kind === 261 /* SpreadAssignment */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 246 /* MissingDeclaration */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type function isTypeNodeKind(kind) { - return (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */) + return (kind >= 157 /* FirstTypeNode */ && kind <= 172 /* LastTypeNode */) || kind === 118 /* AnyKeyword */ || kind === 132 /* NumberKeyword */ || kind === 121 /* BooleanKeyword */ - || kind === 134 /* StringKeyword */ - || kind === 135 /* SymbolKeyword */ + || kind === 135 /* StringKeyword */ + || kind === 136 /* SymbolKeyword */ || kind === 104 /* VoidKeyword */ || kind === 129 /* NeverKeyword */ - || kind === 199 /* ExpressionWithTypeArguments */; + || kind === 200 /* ExpressionWithTypeArguments */; } /** * Node test that determines whether a node is a valid type node. @@ -9908,36 +9929,36 @@ var ts; ts.isTypeNode = isTypeNode; // Binding patterns function isArrayBindingPattern(node) { - return node.kind === 173 /* ArrayBindingPattern */; + return node.kind === 174 /* ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isObjectBindingPattern(node) { - return node.kind === 172 /* ObjectBindingPattern */; + return node.kind === 173 /* ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 173 /* ArrayBindingPattern */ - || kind === 172 /* ObjectBindingPattern */; + return kind === 174 /* ArrayBindingPattern */ + || kind === 173 /* ObjectBindingPattern */; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 175 /* ArrayLiteralExpression */ - || kind === 176 /* ObjectLiteralExpression */; + return kind === 176 /* ArrayLiteralExpression */ + || kind === 177 /* ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { - return node.kind === 174 /* BindingElement */; + return node.kind === 175 /* BindingElement */; } ts.isBindingElement = isBindingElement; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 174 /* BindingElement */ - || kind === 198 /* OmittedExpression */; + return kind === 175 /* BindingElement */ + || kind === 199 /* OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -9945,9 +9966,9 @@ var ts; */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 224 /* VariableDeclaration */: - case 144 /* Parameter */: - case 174 /* BindingElement */: + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 175 /* BindingElement */: return true; } return false; @@ -9966,8 +9987,8 @@ var ts; */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 172 /* ObjectBindingPattern */: - case 176 /* ObjectLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 177 /* ObjectLiteralExpression */: return true; } return false; @@ -9978,8 +9999,8 @@ var ts; */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: return true; } return false; @@ -9987,86 +10008,86 @@ var ts; ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; // Expression function isArrayLiteralExpression(node) { - return node.kind === 175 /* ArrayLiteralExpression */; + return node.kind === 176 /* ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 176 /* ObjectLiteralExpression */; + return node.kind === 177 /* ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 177 /* PropertyAccessExpression */; + return node.kind === 178 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 178 /* ElementAccessExpression */; + return node.kind === 179 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isBinaryExpression(node) { - return node.kind === 192 /* BinaryExpression */; + return node.kind === 193 /* BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 193 /* ConditionalExpression */; + return node.kind === 194 /* ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isCallExpression(node) { - return node.kind === 179 /* CallExpression */; + return node.kind === 180 /* CallExpression */; } ts.isCallExpression = isCallExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 194 /* TemplateExpression */ + return kind === 195 /* TemplateExpression */ || kind === 12 /* NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; function isSpreadExpression(node) { - return node.kind === 196 /* SpreadElement */; + return node.kind === 197 /* SpreadElement */; } ts.isSpreadExpression = isSpreadExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 199 /* ExpressionWithTypeArguments */; + return node.kind === 200 /* ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isLeftHandSideExpressionKind(kind) { - return kind === 177 /* PropertyAccessExpression */ - || kind === 178 /* ElementAccessExpression */ - || kind === 180 /* NewExpression */ - || kind === 179 /* CallExpression */ - || kind === 247 /* JsxElement */ - || kind === 248 /* JsxSelfClosingElement */ - || kind === 181 /* TaggedTemplateExpression */ - || kind === 175 /* ArrayLiteralExpression */ - || kind === 183 /* ParenthesizedExpression */ - || kind === 176 /* ObjectLiteralExpression */ - || kind === 197 /* ClassExpression */ - || kind === 184 /* FunctionExpression */ + return kind === 178 /* PropertyAccessExpression */ + || kind === 179 /* ElementAccessExpression */ + || kind === 181 /* NewExpression */ + || kind === 180 /* CallExpression */ + || kind === 248 /* JsxElement */ + || kind === 249 /* JsxSelfClosingElement */ + || kind === 182 /* TaggedTemplateExpression */ + || kind === 176 /* ArrayLiteralExpression */ + || kind === 184 /* ParenthesizedExpression */ + || kind === 177 /* ObjectLiteralExpression */ + || kind === 198 /* ClassExpression */ + || kind === 185 /* FunctionExpression */ || kind === 70 /* Identifier */ || kind === 11 /* RegularExpressionLiteral */ || kind === 8 /* NumericLiteral */ || kind === 9 /* StringLiteral */ || kind === 12 /* NoSubstitutionTemplateLiteral */ - || kind === 194 /* TemplateExpression */ + || kind === 195 /* TemplateExpression */ || kind === 85 /* FalseKeyword */ || kind === 94 /* NullKeyword */ || kind === 98 /* ThisKeyword */ || kind === 100 /* TrueKeyword */ || kind === 96 /* SuperKeyword */ - || kind === 201 /* NonNullExpression */ - || kind === 202 /* MetaProperty */; + || kind === 202 /* NonNullExpression */ + || kind === 203 /* MetaProperty */; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isUnaryExpressionKind(kind) { - return kind === 190 /* PrefixUnaryExpression */ - || kind === 191 /* PostfixUnaryExpression */ - || kind === 186 /* DeleteExpression */ - || kind === 187 /* TypeOfExpression */ - || kind === 188 /* VoidExpression */ - || kind === 189 /* AwaitExpression */ - || kind === 182 /* TypeAssertionExpression */ + return kind === 191 /* PrefixUnaryExpression */ + || kind === 192 /* PostfixUnaryExpression */ + || kind === 187 /* DeleteExpression */ + || kind === 188 /* TypeOfExpression */ + || kind === 189 /* VoidExpression */ + || kind === 190 /* AwaitExpression */ + || kind === 183 /* TypeAssertionExpression */ || isLeftHandSideExpressionKind(kind); } function isUnaryExpression(node) { @@ -10074,13 +10095,13 @@ var ts; } ts.isUnaryExpression = isUnaryExpression; function isExpressionKind(kind) { - return kind === 193 /* ConditionalExpression */ - || kind === 195 /* YieldExpression */ - || kind === 185 /* ArrowFunction */ - || kind === 192 /* BinaryExpression */ - || kind === 196 /* SpreadElement */ - || kind === 200 /* AsExpression */ - || kind === 198 /* OmittedExpression */ + return kind === 194 /* ConditionalExpression */ + || kind === 196 /* YieldExpression */ + || kind === 186 /* ArrowFunction */ + || kind === 193 /* BinaryExpression */ + || kind === 197 /* SpreadElement */ + || kind === 201 /* AsExpression */ + || kind === 199 /* OmittedExpression */ || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10089,16 +10110,16 @@ var ts; ts.isExpression = isExpression; function isAssertionExpression(node) { var kind = node.kind; - return kind === 182 /* TypeAssertionExpression */ - || kind === 200 /* AsExpression */; + return kind === 183 /* TypeAssertionExpression */ + || kind === 201 /* AsExpression */; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 295 /* PartiallyEmittedExpression */; + return node.kind === 296 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 294 /* NotEmittedStatement */; + return node.kind === 295 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10107,17 +10128,17 @@ var ts; } ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isOmittedExpression(node) { - return node.kind === 198 /* OmittedExpression */; + return node.kind === 199 /* OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; // Misc function isTemplateSpan(node) { - return node.kind === 203 /* TemplateSpan */; + return node.kind === 204 /* TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; // Element function isBlock(node) { - return node.kind === 205 /* Block */; + return node.kind === 206 /* Block */; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -10135,121 +10156,121 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 224 /* VariableDeclaration */; + return node.kind === 225 /* VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 225 /* VariableDeclarationList */; + return node.kind === 226 /* VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 233 /* CaseBlock */; + return node.kind === 234 /* CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 232 /* ModuleBlock */ - || kind === 231 /* ModuleDeclaration */; + return kind === 233 /* ModuleBlock */ + || kind === 232 /* ModuleDeclaration */; } ts.isModuleBody = isModuleBody; function isImportEqualsDeclaration(node) { - return node.kind === 235 /* ImportEqualsDeclaration */; + return node.kind === 236 /* ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 237 /* ImportClause */; + return node.kind === 238 /* ImportClause */; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 239 /* NamedImports */ - || kind === 238 /* NamespaceImport */; + return kind === 240 /* NamedImports */ + || kind === 239 /* NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 240 /* ImportSpecifier */; + return node.kind === 241 /* ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 243 /* NamedExports */; + return node.kind === 244 /* NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 244 /* ExportSpecifier */; + return node.kind === 245 /* ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 231 /* ModuleDeclaration */ || node.kind === 230 /* EnumDeclaration */; + return node.kind === 232 /* ModuleDeclaration */ || node.kind === 231 /* EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 185 /* ArrowFunction */ - || kind === 174 /* BindingElement */ - || kind === 227 /* ClassDeclaration */ - || kind === 197 /* ClassExpression */ - || kind === 150 /* Constructor */ - || kind === 230 /* EnumDeclaration */ - || kind === 261 /* EnumMember */ - || kind === 244 /* ExportSpecifier */ - || kind === 226 /* FunctionDeclaration */ - || kind === 184 /* FunctionExpression */ - || kind === 151 /* GetAccessor */ - || kind === 237 /* ImportClause */ - || kind === 235 /* ImportEqualsDeclaration */ - || kind === 240 /* ImportSpecifier */ - || kind === 228 /* InterfaceDeclaration */ - || kind === 149 /* MethodDeclaration */ - || kind === 148 /* MethodSignature */ - || kind === 231 /* ModuleDeclaration */ - || kind === 234 /* NamespaceExportDeclaration */ - || kind === 238 /* NamespaceImport */ - || kind === 144 /* Parameter */ - || kind === 258 /* PropertyAssignment */ - || kind === 147 /* PropertyDeclaration */ - || kind === 146 /* PropertySignature */ - || kind === 152 /* SetAccessor */ - || kind === 259 /* ShorthandPropertyAssignment */ - || kind === 229 /* TypeAliasDeclaration */ - || kind === 143 /* TypeParameter */ - || kind === 224 /* VariableDeclaration */ - || kind === 286 /* JSDocTypedefTag */; + return kind === 186 /* ArrowFunction */ + || kind === 175 /* BindingElement */ + || kind === 228 /* ClassDeclaration */ + || kind === 198 /* ClassExpression */ + || kind === 151 /* Constructor */ + || kind === 231 /* EnumDeclaration */ + || kind === 262 /* EnumMember */ + || kind === 245 /* ExportSpecifier */ + || kind === 227 /* FunctionDeclaration */ + || kind === 185 /* FunctionExpression */ + || kind === 152 /* GetAccessor */ + || kind === 238 /* ImportClause */ + || kind === 236 /* ImportEqualsDeclaration */ + || kind === 241 /* ImportSpecifier */ + || kind === 229 /* InterfaceDeclaration */ + || kind === 150 /* MethodDeclaration */ + || kind === 149 /* MethodSignature */ + || kind === 232 /* ModuleDeclaration */ + || kind === 235 /* NamespaceExportDeclaration */ + || kind === 239 /* NamespaceImport */ + || kind === 145 /* Parameter */ + || kind === 259 /* PropertyAssignment */ + || kind === 148 /* PropertyDeclaration */ + || kind === 147 /* PropertySignature */ + || kind === 153 /* SetAccessor */ + || kind === 260 /* ShorthandPropertyAssignment */ + || kind === 230 /* TypeAliasDeclaration */ + || kind === 144 /* TypeParameter */ + || kind === 225 /* VariableDeclaration */ + || kind === 287 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { - return kind === 226 /* FunctionDeclaration */ - || kind === 245 /* MissingDeclaration */ - || kind === 227 /* ClassDeclaration */ - || kind === 228 /* InterfaceDeclaration */ - || kind === 229 /* TypeAliasDeclaration */ - || kind === 230 /* EnumDeclaration */ - || kind === 231 /* ModuleDeclaration */ - || kind === 236 /* ImportDeclaration */ - || kind === 235 /* ImportEqualsDeclaration */ - || kind === 242 /* ExportDeclaration */ - || kind === 241 /* ExportAssignment */ - || kind === 234 /* NamespaceExportDeclaration */; + return kind === 227 /* FunctionDeclaration */ + || kind === 246 /* MissingDeclaration */ + || kind === 228 /* ClassDeclaration */ + || kind === 229 /* InterfaceDeclaration */ + || kind === 230 /* TypeAliasDeclaration */ + || kind === 231 /* EnumDeclaration */ + || kind === 232 /* ModuleDeclaration */ + || kind === 237 /* ImportDeclaration */ + || kind === 236 /* ImportEqualsDeclaration */ + || kind === 243 /* ExportDeclaration */ + || kind === 242 /* ExportAssignment */ + || kind === 235 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 216 /* BreakStatement */ - || kind === 215 /* ContinueStatement */ - || kind === 223 /* DebuggerStatement */ - || kind === 210 /* DoStatement */ - || kind === 208 /* ExpressionStatement */ - || kind === 207 /* EmptyStatement */ - || kind === 213 /* ForInStatement */ - || kind === 214 /* ForOfStatement */ - || kind === 212 /* ForStatement */ - || kind === 209 /* IfStatement */ - || kind === 220 /* LabeledStatement */ - || kind === 217 /* ReturnStatement */ - || kind === 219 /* SwitchStatement */ - || kind === 221 /* ThrowStatement */ - || kind === 222 /* TryStatement */ - || kind === 206 /* VariableStatement */ - || kind === 211 /* WhileStatement */ - || kind === 218 /* WithStatement */ - || kind === 294 /* NotEmittedStatement */ - || kind === 297 /* EndOfDeclarationMarker */ - || kind === 296 /* MergeDeclarationMarker */; + return kind === 217 /* BreakStatement */ + || kind === 216 /* ContinueStatement */ + || kind === 224 /* DebuggerStatement */ + || kind === 211 /* DoStatement */ + || kind === 209 /* ExpressionStatement */ + || kind === 208 /* EmptyStatement */ + || kind === 214 /* ForInStatement */ + || kind === 215 /* ForOfStatement */ + || kind === 213 /* ForStatement */ + || kind === 210 /* IfStatement */ + || kind === 221 /* LabeledStatement */ + || kind === 218 /* ReturnStatement */ + || kind === 220 /* SwitchStatement */ + || kind === 222 /* ThrowStatement */ + || kind === 223 /* TryStatement */ + || kind === 207 /* VariableStatement */ + || kind === 212 /* WhileStatement */ + || kind === 219 /* WithStatement */ + || kind === 295 /* NotEmittedStatement */ + || kind === 298 /* EndOfDeclarationMarker */ + || kind === 297 /* MergeDeclarationMarker */; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10270,93 +10291,93 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 205 /* Block */; + || kind === 206 /* Block */; } ts.isStatement = isStatement; // Module references function isModuleReference(node) { var kind = node.kind; - return kind === 246 /* ExternalModuleReference */ - || kind === 141 /* QualifiedName */ + return kind === 247 /* ExternalModuleReference */ + || kind === 142 /* QualifiedName */ || kind === 70 /* Identifier */; } ts.isModuleReference = isModuleReference; // JSX function isJsxOpeningElement(node) { - return node.kind === 249 /* JsxOpeningElement */; + return node.kind === 250 /* JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 250 /* JsxClosingElement */; + return node.kind === 251 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { var kind = node.kind; return kind === 98 /* ThisKeyword */ || kind === 70 /* Identifier */ - || kind === 177 /* PropertyAccessExpression */; + || kind === 178 /* PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 247 /* JsxElement */ - || kind === 253 /* JsxExpression */ - || kind === 248 /* JsxSelfClosingElement */ + return kind === 248 /* JsxElement */ + || kind === 254 /* JsxExpression */ + || kind === 249 /* JsxSelfClosingElement */ || kind === 10 /* JsxText */; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 251 /* JsxAttribute */ - || kind === 252 /* JsxSpreadAttribute */; + return kind === 252 /* JsxAttribute */ + || kind === 253 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 252 /* JsxSpreadAttribute */; + return node.kind === 253 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 251 /* JsxAttribute */; + return node.kind === 252 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 253 /* JsxExpression */; + || kind === 254 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 254 /* CaseClause */ - || kind === 255 /* DefaultClause */; + return kind === 255 /* CaseClause */ + || kind === 256 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 256 /* HeritageClause */; + return node.kind === 257 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 257 /* CatchClause */; + return node.kind === 258 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 258 /* PropertyAssignment */; + return node.kind === 259 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 259 /* ShorthandPropertyAssignment */; + return node.kind === 260 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; // Enum function isEnumMember(node) { - return node.kind === 261 /* EnumMember */; + return node.kind === 262 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 262 /* SourceFile */; + return node.kind === 263 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -10586,9 +10607,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 143 /* TypeParameter */) { + if (d && d.kind === 144 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 228 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 229 /* InterfaceDeclaration */) { return current; } } @@ -10596,11 +10617,11 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 150 /* Constructor */ && ts.isClassLike(node.parent.parent); + return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 151 /* Constructor */ && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 174 /* BindingElement */ || ts.isBindingPattern(node))) { + while (node && (node.kind === 175 /* BindingElement */ || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -10608,14 +10629,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 224 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 225 /* VariableDeclarationList */) { + if (node && node.kind === 226 /* VariableDeclarationList */) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 206 /* VariableStatement */) { + if (node && node.kind === 207 /* VariableStatement */) { flags |= ts.getModifierFlags(node); } return flags; @@ -10631,14 +10652,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 224 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 225 /* VariableDeclarationList */) { + if (node && node.kind === 226 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 206 /* VariableStatement */) { + if (node && node.kind === 207 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -10707,7 +10728,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, location, flags) { - var ConstructorForKind = kind === 262 /* SourceFile */ + var ConstructorForKind = kind === 263 /* SourceFile */ ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); var node = location @@ -10890,7 +10911,7 @@ var ts; ts.createNull = createNull; // Names function createComputedPropertyName(expression, location) { - var node = createNode(142 /* ComputedPropertyName */, location); + var node = createNode(143 /* ComputedPropertyName */, location); node.expression = expression; return node; } @@ -10904,7 +10925,7 @@ var ts; ts.updateComputedPropertyName = updateComputedPropertyName; // Signature elements function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) { - var node = createNode(144 /* Parameter */, location, flags); + var node = createNode(145 /* Parameter */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.dotDotDotToken = dotDotDotToken; @@ -10924,7 +10945,7 @@ var ts; ts.updateParameter = updateParameter; // Type members function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) { - var node = createNode(147 /* PropertyDeclaration */, location); + var node = createNode(148 /* PropertyDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10942,7 +10963,7 @@ var ts; } ts.updateProperty = updateProperty; function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(149 /* MethodDeclaration */, location, flags); + var node = createNode(150 /* MethodDeclaration */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -10962,7 +10983,7 @@ var ts; } ts.updateMethod = updateMethod; function createConstructor(decorators, modifiers, parameters, body, location, flags) { - var node = createNode(150 /* Constructor */, location, flags); + var node = createNode(151 /* Constructor */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.typeParameters = undefined; @@ -10980,7 +11001,7 @@ var ts; } ts.updateConstructor = updateConstructor; function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) { - var node = createNode(151 /* GetAccessor */, location, flags); + var node = createNode(152 /* GetAccessor */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -10999,7 +11020,7 @@ var ts; } ts.updateGetAccessor = updateGetAccessor; function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) { - var node = createNode(152 /* SetAccessor */, location, flags); + var node = createNode(153 /* SetAccessor */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -11018,7 +11039,7 @@ var ts; ts.updateSetAccessor = updateSetAccessor; // Binding Patterns function createObjectBindingPattern(elements, location) { - var node = createNode(172 /* ObjectBindingPattern */, location); + var node = createNode(173 /* ObjectBindingPattern */, location); node.elements = createNodeArray(elements); return node; } @@ -11031,7 +11052,7 @@ var ts; } ts.updateObjectBindingPattern = updateObjectBindingPattern; function createArrayBindingPattern(elements, location) { - var node = createNode(173 /* ArrayBindingPattern */, location); + var node = createNode(174 /* ArrayBindingPattern */, location); node.elements = createNodeArray(elements); return node; } @@ -11044,7 +11065,7 @@ var ts; } ts.updateArrayBindingPattern = updateArrayBindingPattern; function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) { - var node = createNode(174 /* BindingElement */, location); + var node = createNode(175 /* BindingElement */, location); node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; node.dotDotDotToken = dotDotDotToken; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -11061,7 +11082,7 @@ var ts; ts.updateBindingElement = updateBindingElement; // Expression function createArrayLiteral(elements, location, multiLine) { - var node = createNode(175 /* ArrayLiteralExpression */, location); + var node = createNode(176 /* ArrayLiteralExpression */, location); node.elements = parenthesizeListElements(createNodeArray(elements)); if (multiLine) { node.multiLine = true; @@ -11077,7 +11098,7 @@ var ts; } ts.updateArrayLiteral = updateArrayLiteral; function createObjectLiteral(properties, location, multiLine) { - var node = createNode(176 /* ObjectLiteralExpression */, location); + var node = createNode(177 /* ObjectLiteralExpression */, location); node.properties = createNodeArray(properties); if (multiLine) { node.multiLine = true; @@ -11093,7 +11114,7 @@ var ts; } ts.updateObjectLiteral = updateObjectLiteral; function createPropertyAccess(expression, name, location, flags) { - var node = createNode(177 /* PropertyAccessExpression */, location, flags); + var node = createNode(178 /* PropertyAccessExpression */, location, flags); node.expression = parenthesizeForAccess(expression); (node.emitNode || (node.emitNode = {})).flags |= 65536 /* NoIndentation */; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -11111,7 +11132,7 @@ var ts; } ts.updatePropertyAccess = updatePropertyAccess; function createElementAccess(expression, index, location) { - var node = createNode(178 /* ElementAccessExpression */, location); + var node = createNode(179 /* ElementAccessExpression */, location); node.expression = parenthesizeForAccess(expression); node.argumentExpression = typeof index === "number" ? createLiteral(index) : index; return node; @@ -11125,7 +11146,7 @@ var ts; } ts.updateElementAccess = updateElementAccess; function createCall(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(179 /* CallExpression */, location, flags); + var node = createNode(180 /* CallExpression */, location, flags); node.expression = parenthesizeForAccess(expression); if (typeArguments) { node.typeArguments = createNodeArray(typeArguments); @@ -11142,7 +11163,7 @@ var ts; } ts.updateCall = updateCall; function createNew(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(180 /* NewExpression */, location, flags); + var node = createNode(181 /* NewExpression */, location, flags); node.expression = parenthesizeForNew(expression); node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; @@ -11157,7 +11178,7 @@ var ts; } ts.updateNew = updateNew; function createTaggedTemplate(tag, template, location) { - var node = createNode(181 /* TaggedTemplateExpression */, location); + var node = createNode(182 /* TaggedTemplateExpression */, location); node.tag = parenthesizeForAccess(tag); node.template = template; return node; @@ -11171,7 +11192,7 @@ var ts; } ts.updateTaggedTemplate = updateTaggedTemplate; function createParen(expression, location) { - var node = createNode(183 /* ParenthesizedExpression */, location); + var node = createNode(184 /* ParenthesizedExpression */, location); node.expression = expression; return node; } @@ -11184,7 +11205,7 @@ var ts; } ts.updateParen = updateParen; function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(184 /* FunctionExpression */, location, flags); + var node = createNode(185 /* FunctionExpression */, location, flags); node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; node.name = typeof name === "string" ? createIdentifier(name) : name; @@ -11203,7 +11224,7 @@ var ts; } ts.updateFunctionExpression = updateFunctionExpression; function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) { - var node = createNode(185 /* ArrowFunction */, location, flags); + var node = createNode(186 /* ArrowFunction */, location, flags); node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; node.parameters = createNodeArray(parameters); @@ -11221,7 +11242,7 @@ var ts; } ts.updateArrowFunction = updateArrowFunction; function createDelete(expression, location) { - var node = createNode(186 /* DeleteExpression */, location); + var node = createNode(187 /* DeleteExpression */, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11234,7 +11255,7 @@ var ts; } ts.updateDelete = updateDelete; function createTypeOf(expression, location) { - var node = createNode(187 /* TypeOfExpression */, location); + var node = createNode(188 /* TypeOfExpression */, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11247,7 +11268,7 @@ var ts; } ts.updateTypeOf = updateTypeOf; function createVoid(expression, location) { - var node = createNode(188 /* VoidExpression */, location); + var node = createNode(189 /* VoidExpression */, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11260,7 +11281,7 @@ var ts; } ts.updateVoid = updateVoid; function createAwait(expression, location) { - var node = createNode(189 /* AwaitExpression */, location); + var node = createNode(190 /* AwaitExpression */, location); node.expression = parenthesizePrefixOperand(expression); return node; } @@ -11273,7 +11294,7 @@ var ts; } ts.updateAwait = updateAwait; function createPrefix(operator, operand, location) { - var node = createNode(190 /* PrefixUnaryExpression */, location); + var node = createNode(191 /* PrefixUnaryExpression */, location); node.operator = operator; node.operand = parenthesizePrefixOperand(operand); return node; @@ -11287,7 +11308,7 @@ var ts; } ts.updatePrefix = updatePrefix; function createPostfix(operand, operator, location) { - var node = createNode(191 /* PostfixUnaryExpression */, location); + var node = createNode(192 /* PostfixUnaryExpression */, location); node.operand = parenthesizePostfixOperand(operand); node.operator = operator; return node; @@ -11303,7 +11324,7 @@ var ts; function createBinary(left, operator, right, location) { var operatorToken = typeof operator === "number" ? createToken(operator) : operator; var operatorKind = operatorToken.kind; - var node = createNode(192 /* BinaryExpression */, location); + var node = createNode(193 /* BinaryExpression */, location); node.left = parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined); node.operatorToken = operatorToken; node.right = parenthesizeBinaryOperand(operatorKind, right, /*isLeftSideOfBinary*/ false, node.left); @@ -11318,7 +11339,7 @@ var ts; } ts.updateBinary = updateBinary; function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { - var node = createNode(193 /* ConditionalExpression */, whenFalse ? location : colonTokenOrLocation); + var node = createNode(194 /* ConditionalExpression */, whenFalse ? location : colonTokenOrLocation); node.condition = parenthesizeForConditionalHead(condition); if (whenFalse) { // second overload @@ -11345,7 +11366,7 @@ var ts; } ts.updateConditional = updateConditional; function createTemplateExpression(head, templateSpans, location) { - var node = createNode(194 /* TemplateExpression */, location); + var node = createNode(195 /* TemplateExpression */, location); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; @@ -11359,7 +11380,7 @@ var ts; } ts.updateTemplateExpression = updateTemplateExpression; function createYield(asteriskToken, expression, location) { - var node = createNode(195 /* YieldExpression */, location); + var node = createNode(196 /* YieldExpression */, location); node.asteriskToken = asteriskToken; node.expression = expression; return node; @@ -11373,7 +11394,7 @@ var ts; } ts.updateYield = updateYield; function createSpread(expression, location) { - var node = createNode(196 /* SpreadElement */, location); + var node = createNode(197 /* SpreadElement */, location); node.expression = parenthesizeExpressionForList(expression); return node; } @@ -11386,7 +11407,7 @@ var ts; } ts.updateSpread = updateSpread; function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(197 /* ClassExpression */, location); + var node = createNode(198 /* ClassExpression */, location); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11404,12 +11425,12 @@ var ts; } ts.updateClassExpression = updateClassExpression; function createOmittedExpression(location) { - var node = createNode(198 /* OmittedExpression */, location); + var node = createNode(199 /* OmittedExpression */, location); return node; } ts.createOmittedExpression = createOmittedExpression; function createExpressionWithTypeArguments(typeArguments, expression, location) { - var node = createNode(199 /* ExpressionWithTypeArguments */, location); + var node = createNode(200 /* ExpressionWithTypeArguments */, location); node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; node.expression = parenthesizeForAccess(expression); return node; @@ -11424,7 +11445,7 @@ var ts; ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; // Misc function createTemplateSpan(expression, literal, location) { - var node = createNode(203 /* TemplateSpan */, location); + var node = createNode(204 /* TemplateSpan */, location); node.expression = expression; node.literal = literal; return node; @@ -11439,7 +11460,7 @@ var ts; ts.updateTemplateSpan = updateTemplateSpan; // Element function createBlock(statements, location, multiLine, flags) { - var block = createNode(205 /* Block */, location, flags); + var block = createNode(206 /* Block */, location, flags); block.statements = createNodeArray(statements); if (multiLine) { block.multiLine = true; @@ -11455,7 +11476,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(206 /* VariableStatement */, location, flags); + var node = createNode(207 /* VariableStatement */, location, flags); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -11470,7 +11491,7 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(225 /* VariableDeclarationList */, location, flags); + var node = createNode(226 /* VariableDeclarationList */, location, flags); node.declarations = createNodeArray(declarations); return node; } @@ -11483,7 +11504,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(224 /* VariableDeclaration */, location, flags); + var node = createNode(225 /* VariableDeclaration */, location, flags); node.name = typeof name === "string" ? createIdentifier(name) : name; node.type = type; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11498,11 +11519,11 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createEmptyStatement(location) { - return createNode(207 /* EmptyStatement */, location); + return createNode(208 /* EmptyStatement */, location); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression, location, flags) { - var node = createNode(208 /* ExpressionStatement */, location, flags); + var node = createNode(209 /* ExpressionStatement */, location, flags); node.expression = parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -11515,7 +11536,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(209 /* IfStatement */, location); + var node = createNode(210 /* IfStatement */, location); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11530,7 +11551,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression, location) { - var node = createNode(210 /* DoStatement */, location); + var node = createNode(211 /* DoStatement */, location); node.statement = statement; node.expression = expression; return node; @@ -11544,7 +11565,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement, location) { - var node = createNode(211 /* WhileStatement */, location); + var node = createNode(212 /* WhileStatement */, location); node.expression = expression; node.statement = statement; return node; @@ -11558,7 +11579,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(212 /* ForStatement */, location, /*flags*/ undefined); + var node = createNode(213 /* ForStatement */, location, /*flags*/ undefined); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11574,7 +11595,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement, location) { - var node = createNode(213 /* ForInStatement */, location); + var node = createNode(214 /* ForInStatement */, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11589,7 +11610,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(initializer, expression, statement, location) { - var node = createNode(214 /* ForOfStatement */, location); + var node = createNode(215 /* ForOfStatement */, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11604,7 +11625,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label, location) { - var node = createNode(215 /* ContinueStatement */, location); + var node = createNode(216 /* ContinueStatement */, location); if (label) { node.label = label; } @@ -11619,7 +11640,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label, location) { - var node = createNode(216 /* BreakStatement */, location); + var node = createNode(217 /* BreakStatement */, location); if (label) { node.label = label; } @@ -11634,7 +11655,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression, location) { - var node = createNode(217 /* ReturnStatement */, location); + var node = createNode(218 /* ReturnStatement */, location); node.expression = expression; return node; } @@ -11647,7 +11668,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement, location) { - var node = createNode(218 /* WithStatement */, location); + var node = createNode(219 /* WithStatement */, location); node.expression = expression; node.statement = statement; return node; @@ -11661,7 +11682,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock, location) { - var node = createNode(219 /* SwitchStatement */, location); + var node = createNode(220 /* SwitchStatement */, location); node.expression = parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -11675,7 +11696,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement, location) { - var node = createNode(220 /* LabeledStatement */, location); + var node = createNode(221 /* LabeledStatement */, location); node.label = typeof label === "string" ? createIdentifier(label) : label; node.statement = statement; return node; @@ -11689,7 +11710,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression, location) { - var node = createNode(221 /* ThrowStatement */, location); + var node = createNode(222 /* ThrowStatement */, location); node.expression = expression; return node; } @@ -11702,7 +11723,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(222 /* TryStatement */, location); + var node = createNode(223 /* TryStatement */, location); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11717,7 +11738,7 @@ var ts; } ts.updateTry = updateTry; function createCaseBlock(clauses, location) { - var node = createNode(233 /* CaseBlock */, location); + var node = createNode(234 /* CaseBlock */, location); node.clauses = createNodeArray(clauses); return node; } @@ -11730,7 +11751,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(226 /* FunctionDeclaration */, location, flags); + var node = createNode(227 /* FunctionDeclaration */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -11750,7 +11771,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(227 /* ClassDeclaration */, location); + var node = createNode(228 /* ClassDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11768,7 +11789,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(236 /* ImportDeclaration */, location); + var node = createNode(237 /* ImportDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.importClause = importClause; @@ -11784,7 +11805,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings, location) { - var node = createNode(237 /* ImportClause */, location); + var node = createNode(238 /* ImportClause */, location); node.name = name; node.namedBindings = namedBindings; return node; @@ -11798,7 +11819,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name, location) { - var node = createNode(238 /* NamespaceImport */, location); + var node = createNode(239 /* NamespaceImport */, location); node.name = name; return node; } @@ -11811,7 +11832,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements, location) { - var node = createNode(239 /* NamedImports */, location); + var node = createNode(240 /* NamedImports */, location); node.elements = createNodeArray(elements); return node; } @@ -11824,7 +11845,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name, location) { - var node = createNode(240 /* ImportSpecifier */, location); + var node = createNode(241 /* ImportSpecifier */, location); node.propertyName = propertyName; node.name = name; return node; @@ -11838,7 +11859,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(241 /* ExportAssignment */, location); + var node = createNode(242 /* ExportAssignment */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.isExportEquals = isExportEquals; @@ -11854,7 +11875,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(242 /* ExportDeclaration */, location); + var node = createNode(243 /* ExportDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.exportClause = exportClause; @@ -11870,7 +11891,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements, location) { - var node = createNode(243 /* NamedExports */, location); + var node = createNode(244 /* NamedExports */, location); node.elements = createNodeArray(elements); return node; } @@ -11883,7 +11904,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(name, propertyName, location) { - var node = createNode(244 /* ExportSpecifier */, location); + var node = createNode(245 /* ExportSpecifier */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; return node; @@ -11898,7 +11919,7 @@ var ts; ts.updateExportSpecifier = updateExportSpecifier; // JSX function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(247 /* JsxElement */, location); + var node = createNode(248 /* JsxElement */, location); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11913,7 +11934,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(248 /* JsxSelfClosingElement */, location); + var node = createNode(249 /* JsxSelfClosingElement */, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11927,7 +11948,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(249 /* JsxOpeningElement */, location); + var node = createNode(250 /* JsxOpeningElement */, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11941,7 +11962,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName, location) { - var node = createNode(250 /* JsxClosingElement */, location); + var node = createNode(251 /* JsxClosingElement */, location); node.tagName = tagName; return node; } @@ -11954,7 +11975,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxAttribute(name, initializer, location) { - var node = createNode(251 /* JsxAttribute */, location); + var node = createNode(252 /* JsxAttribute */, location); node.name = name; node.initializer = initializer; return node; @@ -11968,7 +11989,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxSpreadAttribute(expression, location) { - var node = createNode(252 /* JsxSpreadAttribute */, location); + var node = createNode(253 /* JsxSpreadAttribute */, location); node.expression = expression; return node; } @@ -11981,7 +12002,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(expression, dotDotDotToken, location) { - var node = createNode(253 /* JsxExpression */, location); + var node = createNode(254 /* JsxExpression */, location); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -11996,7 +12017,7 @@ var ts; ts.updateJsxExpression = updateJsxExpression; // Clauses function createHeritageClause(token, types, location) { - var node = createNode(256 /* HeritageClause */, location); + var node = createNode(257 /* HeritageClause */, location); node.token = token; node.types = createNodeArray(types); return node; @@ -12010,7 +12031,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCaseClause(expression, statements, location) { - var node = createNode(254 /* CaseClause */, location); + var node = createNode(255 /* CaseClause */, location); node.expression = parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -12024,7 +12045,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements, location) { - var node = createNode(255 /* DefaultClause */, location); + var node = createNode(256 /* DefaultClause */, location); node.statements = createNodeArray(statements); return node; } @@ -12037,7 +12058,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createCatchClause(variableDeclaration, block, location) { - var node = createNode(257 /* CatchClause */, location); + var node = createNode(258 /* CatchClause */, location); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -12052,7 +12073,7 @@ var ts; ts.updateCatchClause = updateCatchClause; // Property assignments function createPropertyAssignment(name, initializer, location) { - var node = createNode(258 /* PropertyAssignment */, location); + var node = createNode(259 /* PropertyAssignment */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.questionToken = undefined; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -12067,14 +12088,14 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(259 /* ShorthandPropertyAssignment */, location); + var node = createNode(260 /* ShorthandPropertyAssignment */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; function createSpreadAssignment(expression, location) { - var node = createNode(260 /* SpreadAssignment */, location); + var node = createNode(261 /* SpreadAssignment */, location); node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; return node; } @@ -12096,7 +12117,7 @@ var ts; // Top-level nodes function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(262 /* SourceFile */, /*location*/ node, node.flags); + var updated = createNode(263 /* SourceFile */, /*location*/ node, node.flags); updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -12163,7 +12184,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createNode(294 /* NotEmittedStatement */, /*location*/ original); + var node = createNode(295 /* NotEmittedStatement */, /*location*/ original); node.original = original; return node; } @@ -12173,7 +12194,7 @@ var ts; * order to properly emit exports. */ function createEndOfDeclarationMarker(original) { - var node = createNode(297 /* EndOfDeclarationMarker */); + var node = createNode(298 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12184,7 +12205,7 @@ var ts; * order to properly emit exports. */ function createMergeDeclarationMarker(original) { - var node = createNode(296 /* MergeDeclarationMarker */); + var node = createNode(297 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12199,7 +12220,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(295 /* PartiallyEmittedExpression */, /*location*/ location || original); + var node = createNode(296 /* PartiallyEmittedExpression */, /*location*/ location || original); node.expression = expression; node.original = original; return node; @@ -12392,7 +12413,7 @@ var ts; if (!outermostLabeledStatement) { return node; } - var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 220 /* LabeledStatement */ + var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 221 /* LabeledStatement */ ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); if (afterRestoreLabelCallback) { @@ -12410,13 +12431,13 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return false; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -12436,7 +12457,7 @@ var ts; } else { switch (callee.kind) { - case 177 /* PropertyAccessExpression */: { + case 178 /* PropertyAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a.b()` target is `(_a = a).b` and thisArg is `_a` thisArg = createTempVariable(recordTempVariable); @@ -12450,7 +12471,7 @@ var ts; } break; } - case 178 /* ElementAccessExpression */: { + case 179 /* ElementAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a` thisArg = createTempVariable(recordTempVariable); @@ -12504,14 +12525,14 @@ var ts; ts.createExpressionForPropertyName = createExpressionForPropertyName; function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); } } @@ -12631,15 +12652,15 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_8 = getMutableClone(node.name); + var name = getMutableClone(node.name); emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) emitFlags |= 48 /* NoSourceMap */; if (!allowComments) emitFlags |= 1536 /* NoComments */; if (emitFlags) - setEmitFlags(name_8, emitFlags); - return name_8; + setEmitFlags(name, emitFlags); + return name; } return getGeneratedNameForNode(node); } @@ -12779,7 +12800,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 183 /* ParenthesizedExpression */) { + if (skipped.kind === 184 /* ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -12813,8 +12834,8 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(192 /* BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(193 /* BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(193 /* BinaryExpression */, binaryOperator); var emittedOperand = skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { @@ -12823,7 +12844,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ - && operand.kind === 195 /* YieldExpression */) { + && operand.kind === 196 /* YieldExpression */) { return false; } return true; @@ -12911,7 +12932,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) { + if (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -12926,7 +12947,7 @@ var ts; return 0 /* Unknown */; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(193 /* ConditionalExpression */, 54 /* QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(194 /* ConditionalExpression */, 54 /* QuestionToken */); var emittedCondition = skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { @@ -12939,7 +12960,7 @@ var ts; // per ES grammar both 'whenTrue' and 'whenFalse' parts of conditional expression are assignment expressions // so in case when comma expression is introduced as a part of previous transformations // if should be wrapped in parens since comma operator has the lowest precedence - return e.kind === 192 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */ + return e.kind === 193 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */ ? createParen(e) : e; } @@ -12952,9 +12973,9 @@ var ts; function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { - case 179 /* CallExpression */: + case 180 /* CallExpression */: return createParen(expression); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return emittedExpression.arguments ? expression : createParen(expression); @@ -12979,7 +13000,7 @@ var ts; // var emittedExpression = skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 180 /* NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 181 /* NewExpression */ || emittedExpression.arguments) && emittedExpression.kind !== 8 /* NumericLiteral */) { return expression; } @@ -13017,7 +13038,7 @@ var ts; function parenthesizeExpressionForList(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, 25 /* CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(193 /* BinaryExpression */, 25 /* CommaToken */); return expressionPrecedence > commaPrecedence ? expression : createParen(expression, /*location*/ expression); @@ -13028,7 +13049,7 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 184 /* FunctionExpression */ || kind === 185 /* ArrowFunction */) { + if (kind === 185 /* FunctionExpression */ || kind === 186 /* ArrowFunction */) { var mutableCall = getMutableClone(emittedExpression); mutableCall.expression = createParen(callee, /*location*/ callee); return recreatePartiallyEmittedExpressions(expression, mutableCall); @@ -13036,7 +13057,7 @@ var ts; } else { var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; - if (leftmostExpressionKind === 176 /* ObjectLiteralExpression */ || leftmostExpressionKind === 184 /* FunctionExpression */) { + if (leftmostExpressionKind === 177 /* ObjectLiteralExpression */ || leftmostExpressionKind === 185 /* FunctionExpression */) { return createParen(expression, /*location*/ expression); } } @@ -13060,21 +13081,21 @@ var ts; function getLeftmostExpression(node) { while (true) { switch (node.kind) { - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: node = node.operand; continue; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: node = node.left; continue; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: node = node.condition; continue; - case 179 /* CallExpression */: - case 178 /* ElementAccessExpression */: - case 177 /* PropertyAccessExpression */: + case 180 /* CallExpression */: + case 179 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: node = node.expression; continue; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -13083,7 +13104,7 @@ var ts; } function parenthesizeConciseBody(body) { var emittedBody = skipPartiallyEmittedExpressions(body); - if (emittedBody.kind === 176 /* ObjectLiteralExpression */) { + if (emittedBody.kind === 177 /* ObjectLiteralExpression */) { return createParen(body, /*location*/ body); } return body; @@ -13115,7 +13136,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipParentheses(node) { - while (node.kind === 183 /* ParenthesizedExpression */) { + while (node.kind === 184 /* ParenthesizedExpression */) { node = node.expression; } return node; @@ -13129,7 +13150,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 295 /* PartiallyEmittedExpression */) { + while (node.kind === 296 /* PartiallyEmittedExpression */) { node = node.expression; } return node; @@ -13170,8 +13191,10 @@ var ts; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { if (!destRanges) - destRanges = ts.createMap(); - ts.copyProperties(sourceRanges, destRanges); + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } return destRanges; } /** @@ -13208,7 +13231,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 262 /* SourceFile */) { + if (node.kind === 263 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -13282,7 +13305,7 @@ var ts; */ function setTokenSourceMapRange(node, token, range) { var emitNode = getOrCreateEmitNode(node); - var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); tokenSourceMapRanges[token] = range; return node; } @@ -13463,13 +13486,13 @@ var ts; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_9 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name) ? name : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 236 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 237 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 242 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 243 /* ExportDeclaration */ && node.moduleSpecifier) { return getGeneratedNameForNode(node); } return undefined; @@ -13498,10 +13521,8 @@ var ts; * Here we check if alternative name was provided for a given moduleName and return it if possible. */ function tryRenameExternalModule(moduleName, sourceFile) { - if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) { - return createLiteral(sourceFile.renamedDependencies[moduleName.text]); - } - return undefined; + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && createLiteral(rename); } /** * Get the name of a module as should be written in the emitted output. @@ -13589,7 +13610,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -13601,11 +13622,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -13637,12 +13658,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 144 /* Parameter */: - case 174 /* BindingElement */: + case 145 /* Parameter */: + case 175 /* BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 196 /* SpreadElement */: - case 260 /* SpreadAssignment */: + case 197 /* SpreadElement */: + case 261 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -13654,7 +13675,7 @@ var ts; */ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 174 /* BindingElement */: + case 175 /* BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -13666,7 +13687,7 @@ var ts; : propertyName; } break; - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -13678,7 +13699,7 @@ var ts; : propertyName; } break; - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -13696,13 +13717,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -13740,11 +13761,11 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 172 /* ObjectBindingPattern */: - case 176 /* ObjectLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 177 /* ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -13775,8 +13796,8 @@ var ts; ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); + var exportSpecifiers = ts.createMultiMap(); + var exportedBindings = []; var uniqueExports = ts.createMap(); var exportedNames; var hasExportDefault = false; @@ -13792,20 +13813,20 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" // import { x, y } from "mod" externalImports.push(node); break; - case 235 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 246 /* ExternalModuleReference */) { + case 236 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 247 /* ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -13821,27 +13842,27 @@ var ts; // export { x, y } for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_10 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_10.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_10) - || resolver.getReferencedValueDeclaration(name_10); + if (!uniqueExports.get(specifier.name.text)) { + var name = specifier.propertyName || specifier.name; + exportSpecifiers.add(name.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); if (decl) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); } - uniqueExports[specifier.name.text] = true; + uniqueExports.set(specifier.name.text, true); exportedNames = ts.append(exportedNames, specifier.name); } } } break; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: if (ts.hasModifier(node, 1 /* Export */)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13849,42 +13870,42 @@ var ts; } } break; - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default function() { } if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { // export function x() { } - var name_11 = node.name; - if (!uniqueExports[name_11.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11); - uniqueExports[name_11.text] = true; - exportedNames = ts.append(exportedNames, name_11); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } break; - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default class { } if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { // export class x { } - var name_12 = node.name; - if (!uniqueExports[name_12.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12); - uniqueExports[name_12.text] = true; - exportedNames = ts.append(exportedNames, name_12); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } @@ -13904,13 +13925,24 @@ var ts; } } else if (!ts.isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = true; + if (!uniqueExports.get(decl.name.text)) { + uniqueExports.set(decl.name.text, true); exportedNames = ts.append(exportedNames, decl.name); } } return exportedNames; } + /** Use a sparse array as a multi-map. */ + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } })(ts || (ts = {})); /// /// @@ -13922,13 +13954,13 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 262 /* SourceFile */) { + if (kind === 263 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70 /* Identifier */) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } - else if (kind < 141 /* FirstNode */) { + else if (kind < 142 /* FirstNode */) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end); } else { @@ -13971,28 +14003,28 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: return visitNode(cbNode, node.expression); - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 258 /* PropertyAssignment */: - case 224 /* VariableDeclaration */: - case 174 /* BindingElement */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 259 /* PropertyAssignment */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -14001,24 +14033,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -14029,323 +14061,323 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 163 /* TupleType */: + case 164 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 166 /* ParenthesizedType */: - case 168 /* TypeOperator */: + case 167 /* ParenthesizedType */: + case 169 /* TypeOperator */: return visitNode(cbNode, node.type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); - case 170 /* MappedType */: + case 171 /* MappedType */: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return visitNode(cbNode, node.literal); - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 200 /* AsExpression */: + case 201 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return visitNode(cbNode, node.expression); - case 202 /* MetaProperty */: + case 203 /* MetaProperty */: return visitNode(cbNode, node.name); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return visitNode(cbNode, node.expression); - case 205 /* Block */: - case 232 /* ModuleBlock */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 262 /* SourceFile */: + case 263 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 209 /* IfStatement */: + case 210 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 215 /* ContinueStatement */: - case 216 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: return visitNode(cbNode, node.label); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 254 /* CaseClause */: + case 255 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 255 /* DefaultClause */: + case 256 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 145 /* Decorator */: + case 146 /* Decorator */: return visitNode(cbNode, node.expression); - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* 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 228 /* InterfaceDeclaration */: + case 229 /* 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 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 261 /* EnumMember */: + case 262 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 237 /* ImportClause */: + case 238 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 234 /* NamespaceExportDeclaration */: + case 235 /* NamespaceExportDeclaration */: return visitNode(cbNode, node.name); - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 239 /* NamedImports */: - case 243 /* NamedExports */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 240 /* ImportSpecifier */: - case 244 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 203 /* TemplateSpan */: + case 204 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 246 /* ExternalModuleReference */: + case 247 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 245 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 247 /* JsxElement */: + case 248 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 248 /* JsxSelfClosingElement */: - case 249 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 251 /* JsxAttribute */: + case 252 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 252 /* JsxSpreadAttribute */: + case 253 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 250 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 263 /* JSDocTypeExpression */: + case 264 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 267 /* JSDocUnionType */: + case 268 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 268 /* JSDocTupleType */: + case 269 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 266 /* JSDocArrayType */: + case 267 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 270 /* JSDocNonNullableType */: + case 271 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 269 /* JSDocNullableType */: + case 270 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 271 /* JSDocRecordType */: + case 272 /* JSDocRecordType */: return visitNode(cbNode, node.literal); - case 273 /* JSDocTypeReference */: + case 274 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 274 /* JSDocOptionalType */: + case 275 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 275 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 276 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 277 /* JSDocConstructorType */: + case 278 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 278 /* JSDocThisType */: + case 279 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 272 /* JSDocRecordMember */: + case 273 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 279 /* JSDocComment */: + case 280 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 282 /* JSDocParameterTag */: + case 283 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 283 /* JSDocReturnTag */: + case 284 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 284 /* JSDocTypeTag */: + case 285 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 281 /* JSDocAugmentsTag */: + case 282 /* JSDocAugmentsTag */: return visitNode(cbNode, node.typeExpression); - case 285 /* JSDocTemplateTag */: + case 286 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 288 /* JSDocTypeLiteral */: + case 289 /* JSDocTypeLiteral */: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 287 /* JSDocPropertyTag */: + case 288 /* JSDocPropertyTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); - case 289 /* JSDocLiteralType */: + case 290 /* JSDocLiteralType */: return visitNode(cbNode, node.literal); } } @@ -14617,7 +14649,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(262 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(263 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -14901,7 +14933,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return kind >= 141 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) : + return kind >= 142 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) : kind === 70 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) : new TokenConstructor(kind, pos, pos); } @@ -14941,7 +14973,11 @@ var ts; } function internIdentifier(text) { text = ts.escapeIdentifier(text); - return identifiers[text] || (identifiers[text] = text); + var identifier = identifiers.get(text); + if (identifier === undefined) { + identifiers.set(text, identifier = text); + } + return identifier; } // An identifier that starts with two underscores has an extra underscore character prepended to it to avoid issues // with magic property names like '__proto__'. The 'identifiers' object is used to share a single string instance for @@ -14993,7 +15029,7 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(142 /* ComputedPropertyName */); + var node = createNode(143 /* ComputedPropertyName */); parseExpected(20 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -15400,14 +15436,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 150 /* Constructor */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 147 /* PropertyDeclaration */: - case 204 /* SemicolonClassElement */: + case 151 /* Constructor */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 205 /* SemicolonClassElement */: return true; - case 149 /* MethodDeclaration */: + case 150 /* 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. @@ -15422,8 +15458,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 254 /* CaseClause */: - case 255 /* DefaultClause */: + case 255 /* CaseClause */: + case 256 /* DefaultClause */: return true; } } @@ -15432,58 +15468,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: - case 206 /* VariableStatement */: - case 205 /* Block */: - case 209 /* IfStatement */: - case 208 /* ExpressionStatement */: - case 221 /* ThrowStatement */: - case 217 /* ReturnStatement */: - case 219 /* SwitchStatement */: - case 216 /* BreakStatement */: - case 215 /* ContinueStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 212 /* ForStatement */: - case 211 /* WhileStatement */: - case 218 /* WithStatement */: - case 207 /* EmptyStatement */: - case 222 /* TryStatement */: - case 220 /* LabeledStatement */: - case 210 /* DoStatement */: - case 223 /* DebuggerStatement */: - case 236 /* ImportDeclaration */: - case 235 /* ImportEqualsDeclaration */: - case 242 /* ExportDeclaration */: - case 241 /* ExportAssignment */: - case 231 /* ModuleDeclaration */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 229 /* TypeAliasDeclaration */: + case 227 /* FunctionDeclaration */: + case 207 /* VariableStatement */: + case 206 /* Block */: + case 210 /* IfStatement */: + case 209 /* ExpressionStatement */: + case 222 /* ThrowStatement */: + case 218 /* ReturnStatement */: + case 220 /* SwitchStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 213 /* ForStatement */: + case 212 /* WhileStatement */: + case 219 /* WithStatement */: + case 208 /* EmptyStatement */: + case 223 /* TryStatement */: + case 221 /* LabeledStatement */: + case 211 /* DoStatement */: + case 224 /* DebuggerStatement */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 230 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 261 /* EnumMember */; + return node.kind === 262 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 154 /* ConstructSignature */: - case 148 /* MethodSignature */: - case 155 /* IndexSignature */: - case 146 /* PropertySignature */: - case 153 /* CallSignature */: + case 155 /* ConstructSignature */: + case 149 /* MethodSignature */: + case 156 /* IndexSignature */: + case 147 /* PropertySignature */: + case 154 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 224 /* VariableDeclaration */) { + if (node.kind !== 225 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -15504,7 +15540,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 144 /* Parameter */) { + if (node.kind !== 145 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -15617,7 +15653,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(22 /* DotToken */)) { - var node = createNode(141 /* QualifiedName */, entity.pos); // !!! + var node = createNode(142 /* QualifiedName */, entity.pos); // !!! node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -15656,7 +15692,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(194 /* TemplateExpression */); + var template = createNode(195 /* TemplateExpression */); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 13 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = createNodeArray(); @@ -15668,7 +15704,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(203 /* TemplateSpan */); + var span = createNode(204 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17 /* CloseBraceToken */) { @@ -15723,7 +15759,7 @@ var ts; // TYPES function parseTypeReference() { var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); - var node = createNode(157 /* TypeReference */, typeName.pos); + var node = createNode(158 /* TypeReference */, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token() === 26 /* LessThanToken */) { node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */); @@ -15732,24 +15768,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(156 /* TypePredicate */, lhs.pos); + var node = createNode(157 /* TypePredicate */, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(167 /* ThisType */); + var node = createNode(168 /* ThisType */); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(160 /* TypeQuery */); + var node = createNode(161 /* TypeQuery */); parseExpected(102 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(143 /* TypeParameter */); + var node = createNode(144 /* TypeParameter */); node.name = parseIdentifier(); if (parseOptional(84 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the @@ -15787,7 +15823,7 @@ var ts; return token() === 23 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 /* AtToken */ || token() === 98 /* ThisKeyword */; } function parseParameter() { - var node = createNode(144 /* Parameter */); + var node = createNode(145 /* Parameter */); if (token() === 98 /* ThisKeyword */) { node.name = createIdentifier(/*isIdentifier*/ true, undefined); node.type = parseParameterType(); @@ -15886,7 +15922,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 154 /* ConstructSignature */) { + if (kind === 155 /* ConstructSignature */) { parseExpected(93 /* NewKeyword */); } fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -15950,7 +15986,7 @@ var ts; return token() === 55 /* ColonToken */ || token() === 25 /* CommaToken */ || token() === 21 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(155 /* IndexSignature */, fullStart); + var node = createNode(156 /* IndexSignature */, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */); @@ -15962,7 +15998,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(54 /* QuestionToken */); if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { - var method = createNode(148 /* MethodSignature */, fullStart); + var method = createNode(149 /* MethodSignature */, fullStart); method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; @@ -15973,7 +16009,7 @@ var ts; return addJSDocComment(finishNode(method)); } else { - var property = createNode(146 /* PropertySignature */, fullStart); + var property = createNode(147 /* PropertySignature */, fullStart); property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; @@ -16022,10 +16058,10 @@ var ts; } function parseTypeMember() { if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { - return parseSignatureMember(153 /* CallSignature */); + return parseSignatureMember(154 /* CallSignature */); } if (token() === 93 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(154 /* ConstructSignature */); + return parseSignatureMember(155 /* ConstructSignature */); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -16039,7 +16075,7 @@ var ts; return token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(161 /* TypeLiteral */); + var node = createNode(162 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -16062,14 +16098,14 @@ var ts; return token() === 20 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 91 /* InKeyword */; } function parseMappedTypeParameter() { - var node = createNode(143 /* TypeParameter */); + var node = createNode(144 /* TypeParameter */); node.name = parseIdentifier(); parseExpected(91 /* InKeyword */); node.constraint = parseType(); return finishNode(node); } function parseMappedType() { - var node = createNode(170 /* MappedType */); + var node = createNode(171 /* MappedType */); parseExpected(16 /* OpenBraceToken */); node.readonlyToken = parseOptionalToken(130 /* ReadonlyKeyword */); parseExpected(20 /* OpenBracketToken */); @@ -16082,12 +16118,12 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(163 /* TupleType */); + var node = createNode(164 /* TupleType */); node.elementTypes = parseBracketedList(20 /* TupleElementTypes */, parseType, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(166 /* ParenthesizedType */); + var node = createNode(167 /* ParenthesizedType */); parseExpected(18 /* OpenParenToken */); node.type = parseType(); parseExpected(19 /* CloseParenToken */); @@ -16095,7 +16131,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 159 /* ConstructorType */) { + if (kind === 160 /* ConstructorType */) { parseExpected(93 /* NewKeyword */); } fillSignature(35 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -16106,7 +16142,7 @@ var ts; return token() === 22 /* DotToken */ ? undefined : node; } function parseLiteralTypeNode() { - var node = createNode(171 /* LiteralType */); + var node = createNode(172 /* LiteralType */); node.literal = parseSimpleUnaryExpression(); finishNode(node); return node; @@ -16117,12 +16153,13 @@ var ts; function parseNonArrayType() { switch (token()) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: - case 137 /* UndefinedKeyword */: + case 136 /* SymbolKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: + case 133 /* ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); @@ -16160,12 +16197,12 @@ var ts; function isStartOfType() { switch (token()) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 98 /* ThisKeyword */: case 102 /* TypeOfKeyword */: @@ -16180,6 +16217,7 @@ var ts; case 8 /* NumericLiteral */: case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: + case 133 /* ObjectKeyword */: return true; case 37 /* MinusToken */: return lookAhead(nextTokenIsNumericLiteral); @@ -16199,14 +16237,14 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(20 /* OpenBracketToken */)) { if (isStartOfType()) { - var node = createNode(169 /* IndexedAccessType */, type.pos); + var node = createNode(170 /* IndexedAccessType */, type.pos); node.objectType = type; node.indexType = parseType(); parseExpected(21 /* CloseBracketToken */); type = finishNode(node); } else { - var node = createNode(162 /* ArrayType */, type.pos); + var node = createNode(163 /* ArrayType */, type.pos); node.elementType = type; parseExpected(21 /* CloseBracketToken */); type = finishNode(node); @@ -16215,7 +16253,7 @@ var ts; return type; } function parseTypeOperator(operator) { - var node = createNode(168 /* TypeOperator */); + var node = createNode(169 /* TypeOperator */); parseExpected(operator); node.operator = operator; node.type = parseTypeOperatorOrHigher(); @@ -16244,10 +16282,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(165 /* IntersectionType */, parseTypeOperatorOrHigher, 47 /* AmpersandToken */); + return parseUnionOrIntersectionType(166 /* IntersectionType */, parseTypeOperatorOrHigher, 47 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(164 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */); + return parseUnionOrIntersectionType(165 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */); } function isStartOfFunctionType() { if (token() === 26 /* LessThanToken */) { @@ -16304,7 +16342,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(156 /* TypePredicate */, typePredicateVariable.pos); + var node = createNode(157 /* TypePredicate */, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -16327,10 +16365,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(158 /* FunctionType */); + return parseFunctionOrConstructorType(159 /* FunctionType */); } if (token() === 93 /* NewKeyword */) { - return parseFunctionOrConstructorType(159 /* ConstructorType */); + return parseFunctionOrConstructorType(160 /* ConstructorType */); } return parseUnionTypeOrHigher(); } @@ -16531,7 +16569,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(195 /* YieldExpression */); + var node = createNode(196 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -16553,13 +16591,13 @@ var ts; ts.Debug.assert(token() === 35 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(185 /* ArrowFunction */, asyncModifier.pos); + node = createNode(186 /* ArrowFunction */, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(185 /* ArrowFunction */, identifier.pos); + node = createNode(186 /* ArrowFunction */, identifier.pos); } - var parameter = createNode(144 /* Parameter */, identifier.pos); + var parameter = createNode(145 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = createNodeArray([parameter], parameter.pos); @@ -16741,7 +16779,7 @@ var ts; return 0 /* False */; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(185 /* ArrowFunction */); + var node = createNode(186 /* ArrowFunction */); node.modifiers = parseModifiersForArrowFunction(); var isAsync = !!(ts.getModifierFlags(node) & 256 /* Async */); // Arrow functions are never generators. @@ -16807,7 +16845,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(193 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(194 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -16820,7 +16858,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 91 /* InKeyword */ || t === 140 /* OfKeyword */; + return t === 91 /* InKeyword */ || t === 141 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -16928,39 +16966,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(192 /* BinaryExpression */, left.pos); + var node = createNode(193 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(200 /* AsExpression */, left.pos); + var node = createNode(201 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(190 /* PrefixUnaryExpression */); + var node = createNode(191 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(186 /* DeleteExpression */); + var node = createNode(187 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(187 /* TypeOfExpression */); + var node = createNode(188 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(188 /* VoidExpression */); + var node = createNode(189 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -16976,7 +17014,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(189 /* AwaitExpression */); + var node = createNode(190 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -17019,7 +17057,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token() === 39 /* AsteriskAsteriskToken */) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 182 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 183 /* TypeAssertionExpression */) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -17115,7 +17153,7 @@ var ts; */ function parseIncrementExpression() { if (token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) { - var node = createNode(190 /* PrefixUnaryExpression */); + var node = createNode(191 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -17128,7 +17166,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(191 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(192 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -17232,7 +17270,7 @@ var ts; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(177 /* PropertyAccessExpression */, expression.pos); + var node = createNode(178 /* PropertyAccessExpression */, expression.pos); node.expression = expression; parseExpectedToken(22 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -17257,8 +17295,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 249 /* JsxOpeningElement */) { - var node = createNode(247 /* JsxElement */, opening.pos); + if (opening.kind === 250 /* JsxOpeningElement */) { + var node = createNode(248 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -17268,7 +17306,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 248 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 249 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -17283,7 +17321,7 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(192 /* BinaryExpression */, result.pos); + var badNode = createNode(193 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -17342,7 +17380,7 @@ var ts; // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(249 /* JsxOpeningElement */, fullStart); + node = createNode(250 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -17354,7 +17392,7 @@ var ts; parseExpected(28 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(248 /* JsxSelfClosingElement */, fullStart); + node = createNode(249 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -17370,7 +17408,7 @@ var ts; var expression = token() === 98 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName(); while (parseOptional(22 /* DotToken */)) { - var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(178 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -17378,7 +17416,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(253 /* JsxExpression */); + var node = createNode(254 /* JsxExpression */); parseExpected(16 /* OpenBraceToken */); if (token() !== 17 /* CloseBraceToken */) { node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); @@ -17398,7 +17436,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(251 /* JsxAttribute */); + var node = createNode(252 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 57 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -17413,7 +17451,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(252 /* JsxSpreadAttribute */); + var node = createNode(253 /* JsxSpreadAttribute */); parseExpected(16 /* OpenBraceToken */); parseExpected(23 /* DotDotDotToken */); node.expression = parseExpression(); @@ -17421,7 +17459,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(250 /* JsxClosingElement */); + var node = createNode(251 /* JsxClosingElement */); parseExpected(27 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -17434,7 +17472,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(182 /* TypeAssertionExpression */); + var node = createNode(183 /* TypeAssertionExpression */); parseExpected(26 /* LessThanToken */); node.type = parseType(); parseExpected(28 /* GreaterThanToken */); @@ -17445,7 +17483,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(22 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(178 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -17453,14 +17491,14 @@ var ts; } if (token() === 50 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(201 /* NonNullExpression */, expression.pos); + var nonNullExpression = createNode(202 /* NonNullExpression */, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(20 /* OpenBracketToken */)) { - var indexedAccess = createNode(178 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(179 /* 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. @@ -17476,7 +17514,7 @@ var ts; continue; } if (token() === 12 /* NoSubstitutionTemplateLiteral */ || token() === 13 /* TemplateHead */) { - var tagExpression = createNode(181 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(182 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 12 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -17499,7 +17537,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(179 /* CallExpression */, expression.pos); + var callExpr = createNode(180 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -17507,7 +17545,7 @@ var ts; continue; } else if (token() === 18 /* OpenParenToken */) { - var callExpr = createNode(179 /* CallExpression */, expression.pos); + var callExpr = createNode(180 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -17617,28 +17655,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(183 /* ParenthesizedExpression */); + var node = createNode(184 /* ParenthesizedExpression */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(196 /* SpreadElement */); + var node = createNode(197 /* SpreadElement */); parseExpected(23 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 23 /* DotDotDotToken */ ? parseSpreadElement() : - token() === 25 /* CommaToken */ ? createNode(198 /* OmittedExpression */) : + token() === 25 /* CommaToken */ ? createNode(199 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(175 /* ArrayLiteralExpression */); + var node = createNode(176 /* ArrayLiteralExpression */); parseExpected(20 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17649,10 +17687,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(124 /* GetKeyword */)) { - return parseAccessorDeclaration(151 /* GetAccessor */, fullStart, decorators, modifiers); + return parseAccessorDeclaration(152 /* GetAccessor */, fullStart, decorators, modifiers); } - else if (parseContextualModifier(133 /* SetKeyword */)) { - return parseAccessorDeclaration(152 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(134 /* SetKeyword */)) { + return parseAccessorDeclaration(153 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -17660,7 +17698,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); if (dotDotDotToken) { - var spreadElement = createNode(260 /* SpreadAssignment */, fullStart); + var spreadElement = createNode(261 /* SpreadAssignment */, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -17685,7 +17723,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 /* CommaToken */ || token() === 17 /* CloseBraceToken */ || token() === 57 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(259 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(260 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57 /* EqualsToken */); @@ -17696,7 +17734,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(258 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(259 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -17706,7 +17744,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(176 /* ObjectLiteralExpression */); + var node = createNode(177 /* ObjectLiteralExpression */); parseExpected(16 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17725,7 +17763,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(/*val*/ false); } - var node = createNode(184 /* FunctionExpression */); + var node = createNode(185 /* FunctionExpression */); node.modifiers = parseModifiers(); parseExpected(88 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(38 /* AsteriskToken */); @@ -17750,12 +17788,12 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(93 /* NewKeyword */); if (parseOptional(22 /* DotToken */)) { - var node_1 = createNode(202 /* MetaProperty */, fullStart); + var node_1 = createNode(203 /* MetaProperty */, fullStart); node_1.keywordToken = 93 /* NewKeyword */; node_1.name = parseIdentifierName(); return finishNode(node_1); } - var node = createNode(180 /* NewExpression */, fullStart); + var node = createNode(181 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18 /* OpenParenToken */) { @@ -17765,7 +17803,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(205 /* Block */); + var node = createNode(206 /* Block */); if (parseExpected(16 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17798,12 +17836,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(207 /* EmptyStatement */); + var node = createNode(208 /* EmptyStatement */); parseExpected(24 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(209 /* IfStatement */); + var node = createNode(210 /* IfStatement */); parseExpected(89 /* IfKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17813,7 +17851,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(210 /* DoStatement */); + var node = createNode(211 /* DoStatement */); parseExpected(80 /* DoKeyword */); node.statement = parseStatement(); parseExpected(105 /* WhileKeyword */); @@ -17828,7 +17866,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(211 /* WhileStatement */); + var node = createNode(212 /* WhileStatement */); parseExpected(105 /* WhileKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17851,21 +17889,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(91 /* InKeyword */)) { - var forInStatement = createNode(213 /* ForInStatement */, pos); + var forInStatement = createNode(214 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(140 /* OfKeyword */)) { - var forOfStatement = createNode(214 /* ForOfStatement */, pos); + else if (parseOptional(141 /* OfKeyword */)) { + var forOfStatement = createNode(215 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(212 /* ForStatement */, pos); + var forStatement = createNode(213 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(24 /* SemicolonToken */); if (token() !== 24 /* SemicolonToken */ && token() !== 19 /* CloseParenToken */) { @@ -17883,7 +17921,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 216 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); + parseExpected(kind === 217 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -17891,7 +17929,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(217 /* ReturnStatement */); + var node = createNode(218 /* ReturnStatement */); parseExpected(95 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -17900,7 +17938,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(218 /* WithStatement */); + var node = createNode(219 /* WithStatement */); parseExpected(106 /* WithKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17909,7 +17947,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(254 /* CaseClause */); + var node = createNode(255 /* CaseClause */); parseExpected(72 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(55 /* ColonToken */); @@ -17917,7 +17955,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(255 /* DefaultClause */); + var node = createNode(256 /* DefaultClause */); parseExpected(78 /* DefaultKeyword */); parseExpected(55 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -17927,12 +17965,12 @@ var ts; return token() === 72 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(219 /* SwitchStatement */); + var node = createNode(220 /* SwitchStatement */); parseExpected(97 /* SwitchKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); - var caseBlock = createNode(233 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(234 /* CaseBlock */, scanner.getStartPos()); parseExpected(16 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(17 /* CloseBraceToken */); @@ -17947,7 +17985,7 @@ 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(221 /* ThrowStatement */); + var node = createNode(222 /* ThrowStatement */); parseExpected(99 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -17955,7 +17993,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(222 /* TryStatement */); + var node = createNode(223 /* TryStatement */); parseExpected(101 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token() === 73 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -17968,7 +18006,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(257 /* CatchClause */); + var result = createNode(258 /* CatchClause */); parseExpected(73 /* CatchKeyword */); if (parseExpected(18 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -17978,7 +18016,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(223 /* DebuggerStatement */); + var node = createNode(224 /* DebuggerStatement */); parseExpected(77 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -17990,13 +18028,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 /* Identifier */ && parseOptional(55 /* ColonToken */)) { - var labeledStatement = createNode(220 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(221 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(208 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(209 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -18046,7 +18084,7 @@ var ts; // // could be legal, it would add complexity for very little gain. case 108 /* InterfaceKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: @@ -18064,7 +18102,7 @@ var ts; return false; } continue; - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: nextToken(); return token() === 16 /* OpenBraceToken */ || token() === 70 /* Identifier */ || token() === 83 /* ExportKeyword */; case 90 /* ImportKeyword */: @@ -18126,8 +18164,8 @@ var ts; case 108 /* InterfaceKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: - case 136 /* TypeKeyword */: - case 139 /* GlobalKeyword */: + case 137 /* TypeKeyword */: + case 140 /* GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; case 113 /* PublicKeyword */: @@ -18177,9 +18215,9 @@ var ts; case 87 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 76 /* ContinueKeyword */: - return parseBreakOrContinueStatement(215 /* ContinueStatement */); + return parseBreakOrContinueStatement(216 /* ContinueStatement */); case 71 /* BreakKeyword */: - return parseBreakOrContinueStatement(216 /* BreakStatement */); + return parseBreakOrContinueStatement(217 /* BreakStatement */); case 95 /* ReturnKeyword */: return parseReturnStatement(); case 106 /* WithKeyword */: @@ -18199,7 +18237,7 @@ var ts; return parseDeclaration(); case 119 /* AsyncKeyword */: case 108 /* InterfaceKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: case 123 /* DeclareKeyword */: @@ -18213,7 +18251,7 @@ var ts; case 116 /* AbstractKeyword */: case 114 /* StaticKeyword */: case 130 /* ReadonlyKeyword */: - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -18236,11 +18274,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 108 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 82 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -18261,7 +18299,7 @@ var ts; 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(245 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(246 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -18283,16 +18321,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token() === 25 /* CommaToken */) { - return createNode(198 /* OmittedExpression */); + return createNode(199 /* OmittedExpression */); } - var node = createNode(174 /* BindingElement */); + var node = createNode(175 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(174 /* BindingElement */); + var node = createNode(175 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -18308,14 +18346,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(172 /* ObjectBindingPattern */); + var node = createNode(173 /* ObjectBindingPattern */); parseExpected(16 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(17 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(173 /* ArrayBindingPattern */); + var node = createNode(174 /* ArrayBindingPattern */); parseExpected(20 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(21 /* CloseBracketToken */); @@ -18334,7 +18372,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(224 /* VariableDeclaration */); + var node = createNode(225 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -18343,7 +18381,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(225 /* VariableDeclarationList */); + var node = createNode(226 /* VariableDeclarationList */); switch (token()) { case 103 /* VarKeyword */: break; @@ -18366,7 +18404,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() === 140 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 141 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -18381,7 +18419,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(206 /* VariableStatement */, fullStart); + var node = createNode(207 /* VariableStatement */, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); @@ -18389,7 +18427,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(226 /* FunctionDeclaration */, fullStart); + var node = createNode(227 /* FunctionDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88 /* FunctionKeyword */); @@ -18402,7 +18440,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(150 /* Constructor */, pos); + var node = createNode(151 /* Constructor */, pos); node.decorators = decorators; node.modifiers = modifiers; parseExpected(122 /* ConstructorKeyword */); @@ -18411,7 +18449,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(149 /* MethodDeclaration */, fullStart); + var method = createNode(150 /* MethodDeclaration */, fullStart); method.decorators = decorators; method.modifiers = modifiers; method.asteriskToken = asteriskToken; @@ -18424,7 +18462,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(147 /* PropertyDeclaration */, fullStart); + var property = createNode(148 /* PropertyDeclaration */, fullStart); property.decorators = decorators; property.modifiers = modifiers; property.name = name; @@ -18517,7 +18555,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 133 /* SetKeyword */ || idToken === 124 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 134 /* SetKeyword */ || idToken === 124 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -18547,7 +18585,7 @@ var ts; if (!parseOptional(56 /* AtToken */)) { break; } - var decorator = createNode(145 /* Decorator */, decoratorStart); + var decorator = createNode(146 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); finishNode(decorator); if (!decorators) { @@ -18613,7 +18651,7 @@ var ts; } function parseClassElement() { if (token() === 24 /* SemicolonToken */) { - var result = createNode(204 /* SemicolonClassElement */); + var result = createNode(205 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -18641,8 +18679,8 @@ var ts; } if (decorators || modifiers) { // treat this as a property declaration with a missing name. - var name_13 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, /*questionToken*/ undefined); + var name = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, /*questionToken*/ undefined); } // 'isClassMemberStart' should have hinted not to attempt parsing. ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -18651,10 +18689,10 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 197 /* ClassExpression */); + /*modifiers*/ undefined, 198 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 227 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 228 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -18698,7 +18736,7 @@ var ts; } function parseHeritageClause() { if (token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */) { - var node = createNode(256 /* HeritageClause */); + var node = createNode(257 /* HeritageClause */); node.token = token(); nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -18707,7 +18745,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(199 /* ExpressionWithTypeArguments */); + var node = createNode(200 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token() === 26 /* LessThanToken */) { node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */); @@ -18721,7 +18759,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228 /* InterfaceDeclaration */, fullStart); + var node = createNode(229 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108 /* InterfaceKeyword */); @@ -18732,10 +18770,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229 /* TypeAliasDeclaration */, fullStart); + var node = createNode(230 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; - parseExpected(136 /* TypeKeyword */); + parseExpected(137 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(57 /* EqualsToken */); @@ -18748,13 +18786,13 @@ 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(261 /* EnumMember */, scanner.getStartPos()); + var node = createNode(262 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230 /* EnumDeclaration */, fullStart); + var node = createNode(231 /* EnumDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82 /* EnumKeyword */); @@ -18769,7 +18807,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(232 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(233 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(16 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(17 /* CloseBraceToken */); @@ -18780,7 +18818,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(231 /* ModuleDeclaration */, fullStart); + var node = createNode(232 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 16 /* Namespace */; @@ -18794,10 +18832,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(231 /* ModuleDeclaration */, fullStart); + var node = createNode(232 /* ModuleDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; - if (token() === 139 /* GlobalKeyword */) { + if (token() === 140 /* GlobalKeyword */) { // parse 'global' as name of global scope augmentation node.name = parseIdentifier(); node.flags |= 512 /* GlobalAugmentation */; @@ -18815,7 +18853,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = 0; - if (token() === 139 /* GlobalKeyword */) { + if (token() === 140 /* GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -18841,7 +18879,7 @@ var ts; return nextToken() === 40 /* SlashToken */; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(234 /* NamespaceExportDeclaration */, fullStart); + var exportDeclaration = createNode(235 /* NamespaceExportDeclaration */, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117 /* AsKeyword */); @@ -18856,11 +18894,11 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 25 /* CommaToken */ && token() !== 138 /* FromKeyword */) { + if (token() !== 25 /* CommaToken */ && token() !== 139 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(235 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(236 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; importEqualsDeclaration.modifiers = modifiers; importEqualsDeclaration.name = identifier; @@ -18871,7 +18909,7 @@ var ts; } } // Import statement - var importDeclaration = createNode(236 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(237 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; // ImportDeclaration: @@ -18881,7 +18919,7 @@ var ts; token() === 38 /* AsteriskToken */ || token() === 16 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(138 /* FromKeyword */); + parseExpected(139 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -18894,7 +18932,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(237 /* ImportClause */, fullStart); + var importClause = createNode(238 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -18904,7 +18942,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(25 /* CommaToken */)) { - importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(239 /* NamedImports */); + importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(240 /* NamedImports */); } return finishNode(importClause); } @@ -18914,7 +18952,7 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(246 /* ExternalModuleReference */); + var node = createNode(247 /* ExternalModuleReference */); parseExpected(131 /* RequireKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = parseModuleSpecifier(); @@ -18937,7 +18975,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(238 /* NamespaceImport */); + var namespaceImport = createNode(239 /* NamespaceImport */); parseExpected(38 /* AsteriskToken */); parseExpected(117 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -18952,14 +18990,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 239 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); + node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 240 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(244 /* ExportSpecifier */); + return parseImportOrExportSpecifier(245 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(240 /* ImportSpecifier */); + return parseImportOrExportSpecifier(241 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -18984,27 +19022,27 @@ var ts; else { node.name = identifierName; } - if (kind === 240 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 241 /* 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(242 /* ExportDeclaration */, fullStart); + var node = createNode(243 /* ExportDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38 /* AsteriskToken */)) { - parseExpected(138 /* FromKeyword */); + parseExpected(139 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(243 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(244 /* 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() === 138 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(138 /* FromKeyword */); + if (token() === 139 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(139 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -19012,7 +19050,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(241 /* ExportAssignment */, fullStart); + var node = createNode(242 /* ExportAssignment */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57 /* EqualsToken */)) { @@ -19094,10 +19132,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1 /* Export */) - || node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 246 /* ExternalModuleReference */ - || node.kind === 236 /* ImportDeclaration */ - || node.kind === 241 /* ExportAssignment */ - || node.kind === 242 /* ExportDeclaration */ + || node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 247 /* ExternalModuleReference */ + || node.kind === 237 /* ImportDeclaration */ + || node.kind === 242 /* ExportAssignment */ + || node.kind === 243 /* ExportDeclaration */ ? node : undefined; }); @@ -19172,7 +19210,7 @@ var ts; // Parses out a JSDoc type expression. /* @internal */ function parseJSDocTypeExpression() { - var result = createNode(263 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(264 /* JSDocTypeExpression */, scanner.getTokenPos()); parseExpected(16 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(17 /* CloseBraceToken */); @@ -19183,12 +19221,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48 /* BarToken */) { - var unionType = createNode(267 /* JSDocUnionType */, type.pos); + var unionType = createNode(268 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57 /* EqualsToken */) { - var optionalType = createNode(274 /* JSDocOptionalType */, type.pos); + var optionalType = createNode(275 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -19199,20 +19237,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20 /* OpenBracketToken */) { - var arrayType = createNode(266 /* JSDocArrayType */, type.pos); + var arrayType = createNode(267 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21 /* CloseBracketToken */); type = finishNode(arrayType); } else if (token() === 54 /* QuestionToken */) { - var nullableType = createNode(269 /* JSDocNullableType */, type.pos); + var nullableType = createNode(270 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50 /* ExclamationToken */) { - var nonNullableType = createNode(270 /* JSDocNonNullableType */, type.pos); + var nonNullableType = createNode(271 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -19246,14 +19284,15 @@ var ts; case 98 /* ThisKeyword */: return parseJSDocThisType(); case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: case 94 /* NullKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: + case 133 /* ObjectKeyword */: return parseTokenNode(); case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -19264,27 +19303,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(278 /* JSDocThisType */); + var result = createNode(279 /* JSDocThisType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(277 /* JSDocConstructorType */); + var result = createNode(278 /* JSDocConstructorType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(276 /* JSDocVariadicType */); + var result = createNode(277 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(275 /* JSDocFunctionType */); + var result = createNode(276 /* JSDocFunctionType */); nextToken(); parseExpected(18 /* OpenParenToken */); result.parameters = parseDelimitedList(23 /* JSDocFunctionParameters */, parseJSDocParameter); @@ -19297,7 +19336,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(144 /* Parameter */); + var parameter = createNode(145 /* Parameter */); parameter.type = parseJSDocType(); if (parseOptional(57 /* EqualsToken */)) { // TODO(rbuckton): Can this be changed to SyntaxKind.QuestionToken? @@ -19306,7 +19345,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(273 /* JSDocTypeReference */); + var result = createNode(274 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); if (token() === 26 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); @@ -19341,24 +19380,24 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(141 /* QualifiedName */, left.pos); + var result = createNode(142 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(271 /* JSDocRecordType */); + var result = createNode(272 /* JSDocRecordType */); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(270 /* JSDocNonNullableType */); + var result = createNode(271 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(268 /* JSDocTupleType */); + var result = createNode(269 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(26 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -19372,7 +19411,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(267 /* JSDocUnionType */); + var result = createNode(268 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19 /* CloseParenToken */); @@ -19388,12 +19427,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(264 /* JSDocAllType */); + var result = createNode(265 /* JSDocAllType */); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(289 /* JSDocLiteralType */); + var result = createNode(290 /* JSDocLiteralType */); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -19416,11 +19455,11 @@ var ts; token() === 28 /* GreaterThanToken */ || token() === 57 /* EqualsToken */ || token() === 48 /* BarToken */) { - var result = createNode(265 /* JSDocUnknownType */, pos); + var result = createNode(266 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(269 /* JSDocNullableType */, pos); + var result = createNode(270 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -19585,7 +19624,7 @@ var ts; content.charCodeAt(start + 3) !== 42 /* asterisk */; } function createJSDocComment() { - var result = createNode(279 /* JSDocComment */, start); + var result = createNode(280 /* JSDocComment */, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -19701,7 +19740,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(280 /* JSDocTag */, atToken.pos); + var result = createNode(281 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -19758,7 +19797,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(282 /* JSDocParameterTag */, atToken.pos); + var result = createNode(283 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -19769,20 +19808,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283 /* JSDocReturnTag */, atToken.pos); + var result = createNode(284 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(284 /* JSDocTypeTag */, atToken.pos); + var result = createNode(285 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -19797,7 +19836,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(287 /* JSDocPropertyTag */, atToken.pos); + var result = createNode(288 /* JSDocPropertyTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -19806,7 +19845,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(281 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(282 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -19815,25 +19854,30 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(286 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(287 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); if (typedefTag.fullName) { var rightNode = typedefTag.fullName; - while (rightNode.kind !== 70 /* Identifier */) { + while (true) { + if (rightNode.kind === 70 /* Identifier */ || !rightNode.body) { + // if node is identifier - use it as name + // otherwise use name of the rightmost part that we were able to parse + typedefTag.name = rightNode.kind === 70 /* Identifier */ ? rightNode : rightNode.name; + break; + } rightNode = rightNode.body; } - typedefTag.name = rightNode; } typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 273 /* JSDocTypeReference */) { + if (typeExpression.type.kind === 274 /* JSDocTypeReference */) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70 /* Identifier */) { - var name_14 = jsDocTypeReference.name; - if (name_14.text === "Object") { + var name = jsDocTypeReference.name; + if (name.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -19847,7 +19891,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(288 /* JSDocTypeLiteral */, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(289 /* JSDocTypeLiteral */, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -19888,7 +19932,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22 /* DotToken */)) { - var jsDocNamespaceNode = createNode(231 /* ModuleDeclaration */, pos); + var jsDocNamespaceNode = createNode(232 /* ModuleDeclaration */, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */); @@ -19934,20 +19978,20 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 285 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 286 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } // Type parameter list looks like '@template T,U,V' var typeParameters = createNodeArray(); while (true) { - var name_15 = parseJSDocIdentifierName(); + var name = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_15) { + if (!name) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143 /* TypeParameter */, name_15.pos); - typeParameter.name = name_15; + var typeParameter = createNode(144 /* TypeParameter */, name.pos); + typeParameter.name = name; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25 /* CommaToken */) { @@ -19958,7 +20002,7 @@ var ts; break; } } - var result = createNode(285 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(286 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -20478,16 +20522,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 228 /* InterfaceDeclaration */ || node.kind === 229 /* TypeAliasDeclaration */) { + if (node.kind === 229 /* InterfaceDeclaration */ || node.kind === 230 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 236 /* ImportDeclaration */ || node.kind === 235 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { + else if ((node.kind === 237 /* ImportDeclaration */ || node.kind === 236 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { return 0 /* NonInstantiated */; } - else if (node.kind === 232 /* ModuleBlock */) { + else if (node.kind === 233 /* ModuleBlock */) { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -20506,7 +20550,7 @@ var ts; }); return state_1; } - else if (node.kind === 231 /* ModuleDeclaration */) { + else if (node.kind === 232 /* ModuleDeclaration */) { var body = node.body; return body ? getModuleInstanceState(body) : 1 /* Instantiated */; } @@ -20647,7 +20691,7 @@ var ts; if (symbolFlags & 107455 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 231 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 232 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -20660,7 +20704,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { var nameExpression = node.name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteral(nameExpression)) { @@ -20672,21 +20716,21 @@ var ts; return node.name.text; } switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: return "__constructor"; - case 158 /* FunctionType */: - case 153 /* CallSignature */: + case 159 /* FunctionType */: + case 154 /* CallSignature */: return "__call"; - case 159 /* ConstructorType */: - case 154 /* ConstructSignature */: + case 160 /* ConstructorType */: + case 155 /* ConstructSignature */: return "__new"; - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return "__index"; - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return "__export"; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2 /* ModuleExports */: // module.exports = ... @@ -20701,22 +20745,22 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 226 /* FunctionDeclaration */: - case 227 /* ClassDeclaration */: + case 227 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: return ts.hasModifier(node, 512 /* Default */) ? "default" : undefined; - case 275 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 144 /* Parameter */: + case 145 /* Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 275 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 276 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 206 /* VariableStatement */) { + if (parentNode && parentNode.kind === 207 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -20771,15 +20815,18 @@ var ts; // Otherwise, we'll be merging into a compatible existing symbol (for example when // you have multiple 'vars' with the same name in the same container). In this case // just add this node into the declarations list of the symbol. - symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0 /* None */, name)); + symbol = symbolTable.get(name); + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(0 /* None */, name)); + } if (name && (includes & 788448 /* Classifiable */)) { - classifiableNames[name] = name; + classifiableNames.set(name, name); } if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { // Javascript constructor-declared symbols can be discarded in favor of // prototype symbols like methods. - symbol = symbolTable[name] = createSymbol(0 /* None */, name); + symbolTable.set(name, symbol = createSymbol(0 /* None */, name)); } else { if (node.name) { @@ -20803,7 +20850,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 241 /* ExportAssignment */ && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 242 /* ExportAssignment */ && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -20823,7 +20870,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 244 /* ExportSpecifier */ || (node.kind === 235 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 245 /* ExportSpecifier */ || (node.kind === 236 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -20846,7 +20893,7 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - var isJSDocTypedefInJSDocNamespace = node.kind === 286 /* JSDocTypedefTag */ && + var isJSDocTypedefInJSDocNamespace = node.kind === 287 /* JSDocTypedefTag */ && node.name && node.name.kind === 70 /* Identifier */ && node.name.isInJSDocNamespace; @@ -20933,7 +20980,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 262 /* SourceFile */) { + if (node.kind === 263 /* SourceFile */) { node.flags |= emitFlags; } if (isIIFE) { @@ -21012,64 +21059,64 @@ var ts; return; } switch (node.kind) { - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: bindWhileStatement(node); break; - case 210 /* DoStatement */: + case 211 /* DoStatement */: bindDoStatement(node); break; - case 212 /* ForStatement */: + case 213 /* ForStatement */: bindForStatement(node); break; - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 209 /* IfStatement */: + case 210 /* IfStatement */: bindIfStatement(node); break; - case 217 /* ReturnStatement */: - case 221 /* ThrowStatement */: + case 218 /* ReturnStatement */: + case 222 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 216 /* BreakStatement */: - case 215 /* ContinueStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 222 /* TryStatement */: + case 223 /* TryStatement */: bindTryStatement(node); break; - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: bindSwitchStatement(node); break; - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: bindCaseBlock(node); break; - case 254 /* CaseClause */: + case 255 /* CaseClause */: bindCaseClause(node); break; - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: bindLabeledStatement(node); break; - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: bindBinaryExpressionFlow(node); break; - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 179 /* CallExpression */: + case 180 /* CallExpression */: bindCallExpressionFlow(node); break; default: @@ -21081,15 +21128,15 @@ var ts; switch (expr.kind) { case 70 /* Identifier */: case 98 /* ThisKeyword */: - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return isNarrowableReference(expr); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return hasNarrowableArgument(expr); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isNarrowingExpression(expr.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return expr.operator === 50 /* ExclamationToken */ && isNarrowingExpression(expr.operand); } return false; @@ -21097,7 +21144,7 @@ var ts; function isNarrowableReference(expr) { return expr.kind === 70 /* Identifier */ || expr.kind === 98 /* ThisKeyword */ || - expr.kind === 177 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); + expr.kind === 178 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -21108,14 +21155,14 @@ var ts; } } } - if (expr.expression.kind === 177 /* PropertyAccessExpression */ && + if (expr.expression.kind === 178 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression.expression)) { return true; } return false; } function isNarrowingTypeofOperands(expr1, expr2) { - return expr1.kind === 187 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */; + return expr1.kind === 188 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { @@ -21136,9 +21183,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (expr.operatorToken.kind) { case 57 /* EqualsToken */: return isNarrowableOperand(expr.left); @@ -21233,33 +21280,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 209 /* IfStatement */: - case 211 /* WhileStatement */: - case 210 /* DoStatement */: + case 210 /* IfStatement */: + case 212 /* WhileStatement */: + case 211 /* DoStatement */: return parent.expression === node; - case 212 /* ForStatement */: - case 193 /* ConditionalExpression */: + case 213 /* ForStatement */: + case 194 /* ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 183 /* ParenthesizedExpression */) { + if (node.kind === 184 /* ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 190 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) { + else if (node.kind === 191 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) { node = node.operand; } else { - return node.kind === 192 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ || + return node.kind === 193 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ || node.operatorToken.kind === 53 /* BarBarToken */); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 183 /* ParenthesizedExpression */ || - node.parent.kind === 190 /* PrefixUnaryExpression */ && + while (node.parent.kind === 184 /* ParenthesizedExpression */ || + node.parent.kind === 191 /* PrefixUnaryExpression */ && node.parent.operator === 50 /* ExclamationToken */) { node = node.parent; } @@ -21301,7 +21348,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 220 /* LabeledStatement */ + var enclosingLabeledStatement = node.parent.kind === 221 /* LabeledStatement */ ? ts.lastOrUndefined(activeLabels) : undefined; // if do statement is wrapped in labeled statement then target labels for break/continue with or without @@ -21338,7 +21385,7 @@ var ts; bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 225 /* VariableDeclarationList */) { + if (node.initializer.kind !== 226 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -21360,7 +21407,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 217 /* ReturnStatement */) { + if (node.kind === 218 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -21380,7 +21427,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 216 /* BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 217 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -21446,7 +21493,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 255 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 256 /* DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -21513,14 +21560,14 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 210 /* DoStatement */) { + if (!node.statement || node.statement.kind !== 211 /* DoStatement */) { // do statement sets current flow inside bindDoStatement addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) { + if (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -21531,10 +21578,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 175 /* ArrayLiteralExpression */) { + else if (node.kind === 176 /* ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 196 /* SpreadElement */) { + if (e.kind === 197 /* SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -21542,16 +21589,16 @@ var ts; } } } - else if (node.kind === 176 /* ObjectLiteralExpression */) { + else if (node.kind === 177 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 258 /* PropertyAssignment */) { + if (p.kind === 259 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 259 /* ShorthandPropertyAssignment */) { + else if (p.kind === 260 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 260 /* SpreadAssignment */) { + else if (p.kind === 261 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -21607,7 +21654,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 57 /* EqualsToken */ && node.left.kind === 178 /* ElementAccessExpression */) { + if (operator === 57 /* EqualsToken */ && node.left.kind === 179 /* ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -21618,7 +21665,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 177 /* PropertyAccessExpression */) { + if (node.expression.kind === 178 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -21651,7 +21698,7 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 213 /* ForInStatement */ || node.parent.parent.kind === 214 /* ForOfStatement */) { + if (node.initializer || node.parent.parent.kind === 214 /* ForInStatement */ || node.parent.parent.kind === 215 /* ForOfStatement */) { bindInitializedVariableFlow(node); } } @@ -21660,10 +21707,10 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = node.expression; - while (expr.kind === 183 /* ParenthesizedExpression */) { + while (expr.kind === 184 /* ParenthesizedExpression */) { expr = expr.expression; } - if (expr.kind === 184 /* FunctionExpression */ || expr.kind === 185 /* ArrowFunction */) { + if (expr.kind === 185 /* FunctionExpression */ || expr.kind === 186 /* ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -21671,7 +21718,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 177 /* PropertyAccessExpression */) { + if (node.expression.kind === 178 /* PropertyAccessExpression */) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -21680,52 +21727,52 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 197 /* ClassExpression */: - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: - case 176 /* ObjectLiteralExpression */: - case 161 /* TypeLiteral */: - case 288 /* JSDocTypeLiteral */: - case 271 /* JSDocRecordType */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 177 /* ObjectLiteralExpression */: + case 162 /* TypeLiteral */: + case 289 /* JSDocTypeLiteral */: + case 272 /* JSDocRecordType */: return 1 /* IsContainer */; - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 275 /* JSDocFunctionType */: - case 231 /* ModuleDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 170 /* MappedType */: + case 276 /* JSDocFunctionType */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 171 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 262 /* SourceFile */: + case 263 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */; } - case 150 /* Constructor */: - case 226 /* FunctionDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 257 /* CatchClause */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 233 /* CaseBlock */: + case 258 /* CatchClause */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 234 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 205 /* Block */: + case 206 /* 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. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -21762,42 +21809,42 @@ 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 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 262 /* SourceFile */: + case 263 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 197 /* ClassExpression */: - case 227 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 161 /* TypeLiteral */: - case 176 /* ObjectLiteralExpression */: - case 228 /* InterfaceDeclaration */: - case 271 /* JSDocRecordType */: - case 288 /* JSDocTypeLiteral */: + case 162 /* TypeLiteral */: + case 177 /* ObjectLiteralExpression */: + case 229 /* InterfaceDeclaration */: + case 272 /* JSDocRecordType */: + case 289 /* JSDocTypeLiteral */: // 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 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 275 /* JSDocFunctionType */: - case 229 /* TypeAliasDeclaration */: - case 170 /* MappedType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 276 /* JSDocFunctionType */: + case 230 /* TypeAliasDeclaration */: + case 171 /* MappedType */: // 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 @@ -21818,11 +21865,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 262 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 262 /* SourceFile */ || body.kind === 232 /* ModuleBlock */)) { + var body = node.kind === 263 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 263 /* SourceFile */ || body.kind === 233 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 242 /* ExportDeclaration */ || stat.kind === 241 /* ExportAssignment */) { + if (stat.kind === 243 /* ExportDeclaration */ || stat.kind === 242 /* ExportAssignment */) { return true; } } @@ -21846,7 +21893,7 @@ var ts; errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (ts.isExternalModuleAugmentation(node)) { - declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); + declareModuleSymbol(node); } else { var pattern = void 0; @@ -21866,12 +21913,8 @@ var ts; } } else { - var state = getModuleInstanceState(node); - if (state === 0 /* NonInstantiated */) { - declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); - } - else { - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + var state = declareModuleSymbol(node); + if (state !== 0 /* NonInstantiated */) { 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 @@ -21891,6 +21934,12 @@ var ts; } } } + function declareModuleSymbol(node) { + var state = getModuleInstanceState(node); + var instantiated = state !== 0 /* NonInstantiated */; + declareSymbolAndAddToSymbolTable(node, instantiated ? 512 /* ValueModule */ : 1024 /* NamespaceModule */, instantiated ? 106639 /* ValueModuleExcludes */ : 0 /* NamespaceModuleExcludes */); + return state; + } function bindFunctionOrConstructorType(node) { // For a given function symbol "<...>(...) => T" we want to generate a symbol identical // to the one we would get for: { <...>(...): T } @@ -21903,7 +21952,7 @@ var ts; var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); typeLiteralSymbol.members = ts.createMap(); - typeLiteralSymbol.members[symbol.name] = symbol; + typeLiteralSymbol.members.set(symbol.name, symbol); } function bindObjectLiteralExpression(node) { var ElementKind; @@ -21915,7 +21964,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 260 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { + if (prop.kind === 261 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { continue; } var identifier = prop.name; @@ -21927,12 +21976,12 @@ 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 === 258 /* PropertyAssignment */ || prop.kind === 259 /* ShorthandPropertyAssignment */ || prop.kind === 149 /* MethodDeclaration */ + var currentKind = prop.kind === 259 /* PropertyAssignment */ || prop.kind === 260 /* ShorthandPropertyAssignment */ || prop.kind === 150 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; - var existingKind = seen[identifier.text]; + var existingKind = seen.get(identifier.text); if (!existingKind) { - seen[identifier.text] = currentKind; + seen.set(identifier.text, currentKind); continue; } if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) { @@ -21949,10 +21998,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 262 /* SourceFile */: + case 263 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -22063,8 +22112,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 262 /* SourceFile */ && - blockScopeContainer.kind !== 231 /* ModuleDeclaration */ && + if (blockScopeContainer.kind !== 263 /* SourceFile */ && + blockScopeContainer.kind !== 232 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -22130,7 +22179,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 140 /* LastToken */) { + if (node.kind > 141 /* LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -22177,23 +22226,23 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 286 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 287 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); break; } case 98 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 259 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 260 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } break; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: if (ts.isInJavaScriptFile(node)) { var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { @@ -22217,48 +22266,48 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return checkStrictModeCatchClause(node); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return checkStrictModeWithStatement(node); - case 167 /* ThisType */: + case 168 /* ThisType */: seenThisKeyword = true; return; - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return checkTypePredicate(node); - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530920 /* TypeParameterExcludes */); - case 144 /* Parameter */: + case 145 /* Parameter */: return bindParameter(node); - case 224 /* VariableDeclaration */: - case 174 /* BindingElement */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 272 /* JSDocRecordMember */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 273 /* JSDocRecordMember */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); - case 287 /* JSDocPropertyTag */: + case 288 /* JSDocPropertyTag */: return bindJSDocProperty(node); - case 258 /* PropertyAssignment */: - case 259 /* ShorthandPropertyAssignment */: + case 259 /* PropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 261 /* EnumMember */: + case 262 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); - case 260 /* SpreadAssignment */: - case 252 /* JsxSpreadAttribute */: + case 261 /* SpreadAssignment */: + case 253 /* JsxSpreadAttribute */: var root = container; var hasRest = false; while (root.parent) { - if (root.kind === 176 /* ObjectLiteralExpression */ && - root.parent.kind === 192 /* BinaryExpression */ && + if (root.kind === 177 /* ObjectLiteralExpression */ && + root.parent.kind === 193 /* BinaryExpression */ && root.parent.operatorToken.kind === 57 /* EqualsToken */ && root.parent.left === root) { hasRest = true; @@ -22267,86 +22316,86 @@ var ts; root = root.parent; } return; - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* 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) ? 0 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return bindFunctionDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 275 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 276 /* JSDocFunctionType */: return bindFunctionOrConstructorType(node); - case 161 /* TypeLiteral */: - case 170 /* MappedType */: - case 288 /* JSDocTypeLiteral */: - case 271 /* JSDocRecordType */: + case 162 /* TypeLiteral */: + case 171 /* MappedType */: + case 289 /* JSDocTypeLiteral */: + case 272 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return bindFunctionExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 197 /* ClassExpression */: - case 227 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */); - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: if (!node.fullName || node.fullName.kind === 70 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); } break; - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Imports and exports - case 235 /* ImportEqualsDeclaration */: - case 238 /* NamespaceImport */: - case 240 /* ImportSpecifier */: - case 244 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 234 /* NamespaceExportDeclaration */: + case 235 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 237 /* ImportClause */: + case 238 /* ImportClause */: return bindImportClause(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return bindExportDeclaration(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return bindExportAssignment(node); - case 262 /* SourceFile */: + case 263 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 205 /* Block */: + case 206 /* Block */: if (!ts.isFunctionLike(node.parent)) { return; } // Fall through - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); } } @@ -22355,7 +22404,7 @@ var ts; if (parameterName && parameterName.kind === 70 /* Identifier */) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 167 /* ThisType */) { + if (parameterName && parameterName.kind === 168 /* ThisType */) { seenThisKeyword = true; } bind(type); @@ -22378,7 +22427,7 @@ var ts; // An export default clause with an expression exports a value // We want to exclude both class and function here, this is necessary to issue an error when there are both // default export-assignment and default export function and class declaration. - var flags = node.kind === 241 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 242 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) ? 8388608 /* Alias */ : 4 /* Property */; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 /* Property */ | 8388608 /* AliasExcludes */ | 32 /* Class */ | 16 /* Function */); @@ -22388,17 +22437,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 262 /* SourceFile */) { + if (node.parent.kind !== 263 /* SourceFile */) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_4 = node.parent; - if (!ts.isExternalModule(parent_4)) { + var parent_1 = node.parent; + if (!ts.isExternalModule(parent_1)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_4.isDeclarationFile) { + if (!parent_1.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -22443,12 +22492,12 @@ var ts; function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); // Declare a 'member' if the container is an ES5 class or ES6 constructor - if (container.kind === 226 /* FunctionDeclaration */ || container.kind === 184 /* FunctionExpression */) { + if (container.kind === 227 /* FunctionDeclaration */ || container.kind === 185 /* FunctionExpression */) { container.symbol.members = container.symbol.members || ts.createMap(); // It's acceptable for multiple 'this' assignments of the same identifier to occur declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */); } - else if (container.kind === 150 /* Constructor */) { + else if (container.kind === 151 /* Constructor */) { // this.foo assignment in a JavaScript class // Bind this property to the containing class var saveContainer = container; @@ -22472,7 +22521,7 @@ var ts; leftSideOfAssignment.parent = node; constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - var funcSymbol = container.locals[constructorFunction.text]; + var funcSymbol = container.locals.get(constructorFunction.text); if (!funcSymbol || !(funcSymbol.flags & 16 /* Function */ || ts.isDeclarationOfFunctionExpression(funcSymbol))) { return; } @@ -22491,7 +22540,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 227 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -22499,7 +22548,7 @@ var ts; bindAnonymousDeclaration(node, 32 /* Class */, bindingName); // Add name of class expression into the map for semantic classifier if (node.name) { - classifiableNames[node.name.text] = node.name.text; + classifiableNames.set(node.name.text, node.name.text); } } var symbol = node.symbol; @@ -22513,13 +22562,14 @@ var ts; // module might have an exported variable called 'prototype'. We can't allow that as // that would clash with the built-in 'prototype' for the class. var prototypeSymbol = createSymbol(4 /* Property */ | 134217728 /* Prototype */, "prototype"); - if (symbol.exports[prototypeSymbol.name]) { + var symbolExport = symbol.exports.get(prototypeSymbol.name); + if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; + symbol.exports.set(prototypeSymbol.name, prototypeSymbol); prototypeSymbol.parent = symbol; } function bindEnumDeclaration(node) { @@ -22627,13 +22677,13 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 207 /* EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 208 /* EmptyStatement */) || // report error on class declarations - node.kind === 227 /* ClassDeclaration */ || + node.kind === 228 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 231 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 232 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 230 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 231 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; // unreachable code is reported if @@ -22647,7 +22697,7 @@ var ts; // On the other side we do want to report errors on non-initialized 'lets' because of TDZ var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 206 /* VariableStatement */ || + (node.kind !== 207 /* VariableStatement */ || ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -22667,56 +22717,56 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 179 /* CallExpression */: + case 180 /* CallExpression */: return computeCallExpression(node, subtreeFlags); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return computeNewExpression(node, subtreeFlags); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return computeModuleDeclaration(node, subtreeFlags); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return computeParenthesizedExpression(node, subtreeFlags); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return computeBinaryExpression(node, subtreeFlags); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return computeExpressionStatement(node, subtreeFlags); - case 144 /* Parameter */: + case 145 /* Parameter */: return computeParameter(node, subtreeFlags); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return computeArrowFunction(node, subtreeFlags); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return computeFunctionExpression(node, subtreeFlags); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return computeFunctionDeclaration(node, subtreeFlags); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return computeVariableDeclaration(node, subtreeFlags); - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return computeVariableDeclarationList(node, subtreeFlags); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return computeVariableStatement(node, subtreeFlags); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return computeLabeledStatement(node, subtreeFlags); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return computeClassDeclaration(node, subtreeFlags); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return computeCatchClause(node, subtreeFlags); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); - case 150 /* Constructor */: + case 151 /* Constructor */: return computeConstructor(node, subtreeFlags); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return computePropertyDeclaration(node, subtreeFlags); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return computeMethod(node, subtreeFlags); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return computeAccessor(node, subtreeFlags); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return computeImportEquals(node, subtreeFlags); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return computePropertyAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -22743,8 +22793,8 @@ var ts; switch (kind) { case 96 /* SuperKeyword */: return true; - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: var expression = node.expression; var expressionKind = expression.kind; return expressionKind === 96 /* SuperKeyword */; @@ -22768,12 +22818,12 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ObjectLiteralExpression */) { + if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 177 /* ObjectLiteralExpression */) { // Destructuring object assignments with are ES2015 syntax // and possibly ESNext if they contain rest transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } - else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 175 /* ArrayLiteralExpression */) { + else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ArrayLiteralExpression */) { // Destructuring assignments are ES2015 syntax. transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } @@ -22823,8 +22873,8 @@ 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 (expressionKind === 200 /* AsExpression */ - || expressionKind === 182 /* TypeAssertionExpression */) { + if (expressionKind === 201 /* AsExpression */ + || expressionKind === 183 /* TypeAssertionExpression */) { transformFlags |= 3 /* AssertTypeScript */; } // If the expression of a ParenthesizedExpression is a destructuring assignment, @@ -23189,7 +23239,7 @@ var ts; var excludeFlags = 536872257 /* NodeExcludes */; switch (kind) { case 119 /* AsyncKeyword */: - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: // async/await is ES2017 syntax transformFlags |= 16 /* AssertES2017 */; break; @@ -23199,27 +23249,27 @@ var ts; case 116 /* AbstractKeyword */: case 123 /* DeclareKeyword */: case 75 /* ConstKeyword */: - case 230 /* EnumDeclaration */: - case 261 /* EnumMember */: - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: - case 201 /* NonNullExpression */: + case 231 /* EnumDeclaration */: + case 262 /* EnumMember */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: + case 202 /* NonNullExpression */: case 130 /* ReadonlyKeyword */: // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; break; - case 247 /* JsxElement */: - case 248 /* JsxSelfClosingElement */: - case 249 /* JsxOpeningElement */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: case 10 /* JsxText */: - case 250 /* JsxClosingElement */: - case 251 /* JsxAttribute */: - case 252 /* JsxSpreadAttribute */: - case 253 /* JsxExpression */: + case 251 /* JsxClosingElement */: + case 252 /* JsxAttribute */: + case 253 /* JsxSpreadAttribute */: + case 254 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: // for-of might be ESNext if it has a rest destructuring transformFlags |= 8 /* AssertESNext */; // FALLTHROUGH @@ -23227,54 +23277,55 @@ var ts; case 13 /* TemplateHead */: case 14 /* TemplateMiddle */: case 15 /* TemplateTail */: - case 194 /* TemplateExpression */: - case 181 /* TaggedTemplateExpression */: - case 259 /* ShorthandPropertyAssignment */: + case 195 /* TemplateExpression */: + case 182 /* TaggedTemplateExpression */: + case 260 /* ShorthandPropertyAssignment */: case 114 /* StaticKeyword */: - case 202 /* MetaProperty */: + case 203 /* MetaProperty */: // These nodes are ES6 syntax. transformFlags |= 192 /* AssertES2015 */; break; - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: // This node is ES6 syntax. transformFlags |= 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; break; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: - case 134 /* StringKeyword */: + case 133 /* ObjectKeyword */: + case 135 /* StringKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 143 /* TypeParameter */: - case 146 /* PropertySignature */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 156 /* TypePredicate */: - case 157 /* TypeReference */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 160 /* TypeQuery */: - case 161 /* TypeLiteral */: - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 167 /* ThisType */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 171 /* LiteralType */: + case 144 /* TypeParameter */: + case 147 /* PropertySignature */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 157 /* TypePredicate */: + case 158 /* TypeReference */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 161 /* TypeQuery */: + case 162 /* TypeLiteral */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* ParenthesizedType */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 168 /* ThisType */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 172 /* LiteralType */: // Types and signatures are TypeScript syntax, and exclude all other facts. transformFlags = 3 /* AssertTypeScript */; excludeFlags = -3 /* TypeExcludes */; break; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: // Even though computed property names are ES6, we don't treat them as such. // This is so that they can flow through PropertyName transforms unaffected. // Instead, we mark the container as ES6, so that it can properly handle the transform. @@ -23291,10 +23342,10 @@ var ts; transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */; } break; - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 96 /* SuperKeyword */: @@ -23305,28 +23356,28 @@ var ts; // Mark this node and its ancestors as containing a lexical `this` keyword. transformFlags |= 16384 /* ContainsLexicalThis */; break; - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; if (subtreeFlags & 524288 /* ContainsRest */) { transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */; } excludeFlags = 537396545 /* BindingPatternExcludes */; break; - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; excludeFlags = 537396545 /* BindingPatternExcludes */; break; - case 174 /* BindingElement */: + case 175 /* BindingElement */: transformFlags |= 192 /* AssertES2015 */; if (node.dotDotDotToken) { transformFlags |= 524288 /* ContainsRest */; } break; - case 145 /* Decorator */: + case 146 /* Decorator */: // This node is TypeScript syntax, and marks its container as also being TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */; break; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: excludeFlags = 540087617 /* ObjectLiteralExcludes */; if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) { // If an ObjectLiteralExpression contains a ComputedPropertyName, then it @@ -23344,8 +23395,8 @@ var ts; transformFlags |= 8 /* AssertESNext */; } break; - case 175 /* ArrayLiteralExpression */: - case 180 /* NewExpression */: + case 176 /* ArrayLiteralExpression */: + case 181 /* NewExpression */: excludeFlags = 537396545 /* ArrayLiteralOrCallOrNewExcludes */; if (subtreeFlags & 524288 /* ContainsSpread */) { // If the this node contains a SpreadExpression, then it is an ES6 @@ -23353,23 +23404,23 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 262 /* SourceFile */: + case 263 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 217 /* ReturnStatement */: - case 215 /* ContinueStatement */: - case 216 /* BreakStatement */: + case 218 /* ReturnStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; break; } @@ -23385,56 +23436,57 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */) { + if (kind >= 157 /* FirstTypeNode */ && kind <= 172 /* LastTypeNode */) { return -3 /* TypeExcludes */; } switch (kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 175 /* ArrayLiteralExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 176 /* ArrayLiteralExpression */: return 537396545 /* ArrayLiteralOrCallOrNewExcludes */; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return 574674241 /* ModuleExcludes */; - case 144 /* Parameter */: + case 145 /* Parameter */: return 536872257 /* ParameterExcludes */; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return 601249089 /* ArrowFunctionExcludes */; - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: return 601281857 /* FunctionExcludes */; - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return 546309441 /* VariableDeclarationListExcludes */; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return 539358529 /* ClassExcludes */; - case 150 /* Constructor */: + case 151 /* Constructor */: return 601015617 /* ConstructorExcludes */; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return 601015617 /* MethodOrAccessorExcludes */; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: + case 133 /* ObjectKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 143 /* TypeParameter */: - case 146 /* PropertySignature */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: + case 144 /* TypeParameter */: + case 147 /* PropertySignature */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: return -3 /* TypeExcludes */; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return 540087617 /* ObjectLiteralExcludes */; - case 257 /* CatchClause */: + case 258 /* CatchClause */: return 537920833 /* CatchClauseExcludes */; - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return 537396545 /* BindingPatternExcludes */; default: return 536872257 /* NodeExcludes */; @@ -23712,9 +23764,10 @@ var ts; if (!moduleHasNonRelativeName(nonRelativeModuleName)) { return undefined; } - var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); if (!perModuleNameCache) { - moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); } return perModuleNameCache; } @@ -23750,12 +23803,12 @@ var ts; var commonPrefix = getCommonPrefix(path, resolvedFileName); var current = path; while (true) { - var parent_5 = ts.getDirectoryPath(current); - if (parent_5 === current || directoryPathMap.contains(parent_5)) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { break; } - directoryPathMap.set(parent_5, result); - current = parent_5; + directoryPathMap.set(parent, result); + current = parent; if (current == commonPrefix) { break; } @@ -23788,7 +23841,7 @@ var ts; } var containingDirectory = ts.getDirectoryPath(containingFile); var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); - var result = perFolderCache && perFolderCache[moduleName]; + var result = perFolderCache && perFolderCache.get(moduleName); if (result) { if (traceEnabled) { trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); @@ -23816,7 +23869,7 @@ var ts; break; } if (perFolderCache) { - perFolderCache[moduleName] = result; + perFolderCache.set(moduleName, result); // put result in per-module name cache var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); if (perModuleNameCache) { @@ -24423,6 +24476,7 @@ var ts; getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, getTypeFromTypeNode: getTypeFromTypeNode, + getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, @@ -24447,6 +24501,7 @@ var ts; getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule, getAmbientModules: getAmbientModules, getJsxElementAttributesType: getJsxElementAttributesType, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, @@ -24484,6 +24539,7 @@ var ts; var voidType = createIntrinsicType(1024 /* Void */, "void"); var neverType = createIntrinsicType(8192 /* Never */, "never"); var silentNeverType = createIntrinsicType(8192 /* Never */, "never"); + var nonPrimitiveType = createIntrinsicType(16777216 /* NonPrimitive */, "object"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */ | 67108864 /* Transient */, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); @@ -24495,6 +24551,7 @@ var ts; // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); @@ -24627,7 +24684,7 @@ var ts; TypeFacts[TypeFacts["UndefinedFacts"] = 2457472] = "UndefinedFacts"; TypeFacts[TypeFacts["NullFacts"] = 2340752] = "NullFacts"; })(TypeFacts || (TypeFacts = {})); - var typeofEQFacts = ts.createMap({ + var typeofEQFacts = ts.createMapFromTemplate({ "string": 1 /* TypeofEQString */, "number": 2 /* TypeofEQNumber */, "boolean": 4 /* TypeofEQBoolean */, @@ -24636,7 +24693,7 @@ var ts; "object": 16 /* TypeofEQObject */, "function": 32 /* TypeofEQFunction */ }); - var typeofNEFacts = ts.createMap({ + var typeofNEFacts = ts.createMapFromTemplate({ "string": 128 /* TypeofNEString */, "number": 256 /* TypeofNENumber */, "boolean": 512 /* TypeofNEBoolean */, @@ -24645,7 +24702,7 @@ var ts; "object": 2048 /* TypeofNEObject */, "function": 4096 /* TypeofNEFunction */ }); - var typeofTypesByName = ts.createMap({ + var typeofTypesByName = ts.createMapFromTemplate({ "string": stringType, "number": numberType, "boolean": booleanType, @@ -24681,7 +24738,7 @@ var ts; TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType"; })(TypeSystemPropertyName || (TypeSystemPropertyName = {})); var builtinGlobals = ts.createMap(); - builtinGlobals[undefinedSymbol.name] = undefinedSymbol; + builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); initializeTypeChecker(); return checker; function getJsxNamespace() { @@ -24782,7 +24839,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 231 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 231 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 232 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 232 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } @@ -24799,6 +24856,9 @@ var ts; } recordMergedSymbol(target, source); } + else if (target.flags & 1024 /* NamespaceModule */) { + error(source.valueDeclaration.name, ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } else { var message_2 = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; @@ -24811,18 +24871,19 @@ var ts; } } function mergeSymbolTable(target, source) { - for (var id in source) { - var targetSymbol = target[id]; + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); if (!targetSymbol) { - target[id] = source[id]; + target.set(id, sourceSymbol); } else { if (!(targetSymbol.flags & 33554432 /* Merged */)) { - target[id] = targetSymbol = cloneSymbol(targetSymbol); + targetSymbol = cloneSymbol(targetSymbol); + target.set(id, targetSymbol); } - mergeSymbol(targetSymbol, source[id]); + mergeSymbol(targetSymbol, sourceSymbol); } - } + }); } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; @@ -24860,15 +24921,16 @@ var ts; } } function addToSymbolTable(target, source, message) { - for (var id in source) { - if (target[id]) { + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); + if (targetSymbol) { // Error on redeclarations - ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); } else { - target[id] = source[id]; + target.set(id, sourceSymbol); } - } + }); function addDeclarationDiagnostic(id, message) { return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; } @@ -24887,11 +24949,11 @@ var ts; return type.flags & 32768 /* Object */ ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 262 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 263 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { - var symbol = symbols[name]; + var symbol = symbols.get(name); if (symbol) { ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { @@ -24943,17 +25005,17 @@ var ts; } if (declaration.pos <= usage.pos) { // declaration is before usage - if (declaration.kind === 174 /* BindingElement */) { + if (declaration.kind === 175 /* BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 174 /* BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 175 /* BindingElement */); if (errorBindingElement) { return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 224 /* VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 225 /* VariableDeclaration */), usage); } - else if (declaration.kind === 224 /* VariableDeclaration */) { + else if (declaration.kind === 225 /* VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -24966,9 +25028,9 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 206 /* VariableStatement */: - case 212 /* ForStatement */: - case 214 /* ForOfStatement */: + case 207 /* VariableStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, container)) { @@ -24977,8 +25039,8 @@ var ts; break; } switch (declaration.parent.parent.kind) { - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: // ForIn/ForOf case - use site should not be used in expression part if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; @@ -24996,7 +25058,7 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 147 /* PropertyDeclaration */ && + current.parent.kind === 148 /* PropertyDeclaration */ && (ts.getModifierFlags(current.parent) & 32 /* Static */) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { @@ -25038,11 +25100,11 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 279 /* JSDocComment */) { + if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 280 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || - lastLocation.kind === 144 /* Parameter */ || - lastLocation.kind === 143 /* TypeParameter */ + lastLocation.kind === 145 /* Parameter */ || + lastLocation.kind === 144 /* TypeParameter */ : false; } if (meaning & 107455 /* Value */ && result.flags & 1 /* FunctionScopedVariable */) { @@ -25051,9 +25113,9 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 144 /* Parameter */ || + lastLocation.kind === 145 /* Parameter */ || (lastLocation === location.type && - result.valueDeclaration.kind === 144 /* Parameter */); + result.valueDeclaration.kind === 145 /* Parameter */); } } if (useResult) { @@ -25065,16 +25127,16 @@ var ts; } } switch (location.kind) { - case 262 /* SourceFile */: + case 263 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 262 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 263 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. - if (result = moduleExports["default"]) { + if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; @@ -25092,9 +25154,10 @@ var ts; // 2. We check === SymbolFlags.Alias in order to check that the symbol is *purely* // an alias. If we used &, we'd be throwing out symbols that have non alias aspects, // which is not the desired behavior. - if (moduleExports[name] && - moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 244 /* ExportSpecifier */)) { + var moduleExport = moduleExports.get(name); + if (moduleExport && + moduleExport.flags === 8388608 /* Alias */ && + ts.getDeclarationOfKind(moduleExport, 245 /* ExportSpecifier */)) { break; } } @@ -25102,13 +25165,13 @@ var ts; break loop; } break; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* 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 @@ -25125,9 +25188,9 @@ var ts; } } break; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064 /* Type */)) { if (lastLocation && ts.getModifierFlags(lastLocation) & 32 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -25138,7 +25201,7 @@ var ts; } break loop; } - if (location.kind === 197 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 198 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -25154,9 +25217,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 228 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 229 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -25164,19 +25227,19 @@ var ts; } } break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -25189,7 +25252,7 @@ var ts; } } break; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -25198,7 +25261,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 === 144 /* Parameter */) { + if (location.parent && location.parent.kind === 145 /* Parameter */) { location = location.parent; } // @@ -25262,7 +25325,7 @@ var ts; // If we're in an external module, we can't reference value symbols created from UMD export declarations if (result && isInExternalModule && (meaning & 107455 /* Value */) === 107455 /* Value */) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 234 /* NamespaceExportDeclaration */) { + if (decls && decls.length === 1 && decls[0].kind === 235 /* NamespaceExportDeclaration */) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } @@ -25316,9 +25379,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: ts.Debug.assert(ts.isEntityNameExpression(node.expression)); return node.expression; default: @@ -25371,10 +25434,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 235 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 236 /* ImportDeclaration */) { + while (node && node.kind !== 237 /* ImportDeclaration */) { node = node.parent; } return node; @@ -25384,7 +25447,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 246 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 247 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); @@ -25392,11 +25455,16 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ? - moduleSymbol : - moduleSymbol.exports["export="] ? - getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : - resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = void 0; + if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } + else { + var exportValue = moduleSymbol.exports.get("export="); + exportDefaultSymbol = exportValue + ? getPropertyOfType(getTypeOfSymbol(exportValue), "default") + : resolveSymbol(moduleSymbol.exports.get("default")); + } if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } @@ -25445,7 +25513,7 @@ var ts; } function getExportOfModule(symbol, name) { if (symbol.flags & 1536 /* Module */) { - var exportedSymbol = getExportsOfSymbol(symbol)[name]; + var exportedSymbol = getExportsOfSymbol(symbol).get(name); if (exportedSymbol) { return resolveSymbol(exportedSymbol); } @@ -25463,31 +25531,31 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_16 = specifier.propertyName || specifier.name; - if (name_16.text) { + var name = specifier.propertyName || specifier.name; + if (name.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; // First check if module was specified with "export=". If so, get the member from the resolved type - if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text); + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); } // if symbolFromVariable is export - get its final target symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_16.text); + var symbolFromModule = getExportOfModule(targetSymbol, name.text); // If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default - if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") { + if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16)); + error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); } return symbol; } @@ -25509,19 +25577,19 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 237 /* ImportClause */: + case 238 /* ImportClause */: return getTargetOfImportClause(node); - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 240 /* ImportSpecifier */: + case 241 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 244 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return getTargetOfExportAssignment(node); - case 234 /* NamespaceExportDeclaration */: + case 235 /* NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node); } } @@ -25568,11 +25636,11 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 241 /* ExportAssignment */) { + if (node.kind === 242 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 244 /* ExportSpecifier */) { + else if (node.kind === 245 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -25594,13 +25662,13 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 141 /* QualifiedName */) { + if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 142 /* QualifiedName */) { return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 235 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 236 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } @@ -25622,9 +25690,9 @@ var ts; return undefined; } } - else if (name.kind === 141 /* QualifiedName */ || name.kind === 177 /* PropertyAccessExpression */) { - var left = name.kind === 141 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 141 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 142 /* QualifiedName */ || name.kind === 178 /* PropertyAccessExpression */) { + var left = name.kind === 142 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 142 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1920 /* Namespace */, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -25723,7 +25791,7 @@ var ts; // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, // and an external module with no 'export =' declaration resolves to the module itself. function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="))) || moduleSymbol; } // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' // references a symbol that is at least declared as a module or a variable. The target of the 'export =' may @@ -25737,15 +25805,23 @@ var ts; return symbol; } function hasExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="] !== undefined; + return moduleSymbol.exports.get("export=") !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function getExportsAndPropertiesOfModule(moduleSymbol) { + var exports = getExportsOfModuleAsArray(moduleSymbol); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + ts.addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))); + } + return exports; + } function tryGetMemberInModuleExports(memberName, moduleSymbol) { var symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { - return symbolTable[memberName]; + return symbolTable.get(memberName); } } function getExportsOfSymbol(symbol) { @@ -25760,24 +25836,28 @@ var ts; * Not passing `lookupTable` and `exportNode` disables this collection, and just extends the tables */ function extendExportSymbols(target, source, lookupTable, exportNode) { - for (var id in source) { - if (id !== "default" && !target[id]) { - target[id] = source[id]; + source && source.forEach(function (sourceSymbol, id) { + if (id === "default") + return; + var targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); if (lookupTable && exportNode) { - lookupTable[id] = { + lookupTable.set(id, { specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) - }; + }); } } - else if (lookupTable && exportNode && id !== "default" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { - if (!lookupTable[id].exportsWithDuplicate) { - lookupTable[id].exportsWithDuplicate = [exportNode]; + else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + var collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; } else { - lookupTable[id].exportsWithDuplicate.push(exportNode); + collisionTracker.exportsWithDuplicate.push(exportNode); } } - } + }); } function getExportsForModule(moduleSymbol) { var visitedSymbols = []; @@ -25793,27 +25873,27 @@ var ts; visitedSymbols.push(symbol); var symbols = ts.cloneMap(symbol.exports); // All export * declarations are collected in an __export symbol by the binder - var exportStars = symbol.exports["__export"]; + var exportStars = symbol.exports.get("__export"); if (exportStars) { var nestedSymbols = ts.createMap(); - var lookupTable = ts.createMap(); + var lookupTable_1 = ts.createMap(); for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); var exportedSymbols = visit(resolvedModule); - extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node); } - for (var id in lookupTable) { - var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; + lookupTable_1.forEach(function (_a, id) { + var exportsWithDuplicate = _a.exportsWithDuplicate; // It's not an error if the file with multiple `export *`s with duplicate names exports a member with that name itself - if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) { - continue; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; } - for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { - var node = exportsWithDuplicate_1[_b]; - diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { + var node = exportsWithDuplicate_1[_i]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, id)); } - } + }); extendExportSymbols(symbols, nestedSymbols); } return symbols; @@ -25854,7 +25934,7 @@ var ts; var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 150 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 151 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -25894,16 +25974,15 @@ var ts; } function getNamedMembers(members) { var result; - for (var id in members) { + members.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { if (!result) result = []; - var symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } } - } + }); return result || emptyArray; } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { @@ -25922,20 +26001,20 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { + for (var location = enclosingDeclaration; location; location = location.parent) { // Locals of a source file are not in scope (because they get merged into the global symbol table) - if (location_1.locals && !isGlobalSourceFile(location_1)) { - if (result = callback(location_1.locals)) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { return result; } } - switch (location_1.kind) { - case 262 /* SourceFile */: - if (!ts.isExternalOrCommonJsModule(location_1)) { + switch (location.kind) { + case 263 /* SourceFile */: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 231 /* ModuleDeclaration */: - if (result = callback(getSymbolOfNode(location_1).exports)) { + case 232 /* ModuleDeclaration */: + if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; @@ -25979,14 +26058,14 @@ var ts; } function trySymbolTable(symbols) { // If symbol is directly available by its name in the symbol table - if (isAccessible(symbols[symbol.name])) { + if (isAccessible(symbols.get(symbol.name))) { return [symbol]; } // Check if symbol is any of the alias - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { + return ts.forEachEntry(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -26015,7 +26094,7 @@ var ts; var qualify = false; forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { // If symbol of this name is not available in the symbol table we are ok - var symbolFromSymbolTable = symbolTable[symbol.name]; + var symbolFromSymbolTable = symbolTable.get(symbol.name); if (!symbolFromSymbolTable) { // Continue to the next symbol table return false; @@ -26026,7 +26105,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, 244 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -26041,10 +26120,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: continue; default: return false; @@ -26125,7 +26204,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 263 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -26166,12 +26245,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 160 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === 161 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 141 /* QualifiedName */ || entityName.kind === 177 /* PropertyAccessExpression */ || - entityName.parent.kind === 235 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 142 /* QualifiedName */ || entityName.kind === 178 /* PropertyAccessExpression */ || + entityName.parent.kind === 236 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* Namespace */; @@ -26267,10 +26346,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 166 /* ParenthesizedType */) { + while (node.kind === 167 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 229 /* TypeAliasDeclaration */) { + if (node.kind === 230 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -26278,29 +26357,29 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 232 /* ModuleBlock */ && + node.parent.kind === 233 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { return type.flags & 32 /* StringLiteral */ ? "\"" + ts.escapeString(type.text) + "\"" : type.text; } - function getSymbolDisplayBuilder() { - function getNameOfSymbol(symbol) { - if (symbol.declarations && symbol.declarations.length) { - var declaration = symbol.declarations[0]; - if (declaration.name) { - return ts.declarationNameToString(declaration.name); - } - switch (declaration.kind) { - case 197 /* ClassExpression */: - return "(Anonymous class)"; - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - return "(Anonymous function)"; - } + function getNameOfSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + switch (declaration.kind) { + case 198 /* ClassExpression */: + return "(Anonymous class)"; + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + return "(Anonymous function)"; } - return symbol.name; } + return symbol.name; + } + function getSymbolDisplayBuilder() { /** * Writes only the name of the symbol out to the writer. Uses the original source text * for the name of the symbol if it is available to match how the user wrote the name. @@ -26370,9 +26449,9 @@ var ts; if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { // Go up and add our parent. - var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_6) { - walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + walkSymbol(parent, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); } } if (accessibleSymbolChain) { @@ -26410,7 +26489,7 @@ var ts; function writeType(type, flags) { var nextFlags = flags & ~512 /* InTypeAlias */; // Write undefined/null type as any - if (type.flags & 16015 /* Intrinsic */) { + if (type.flags & 16793231 /* 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" @@ -26522,14 +26601,14 @@ var ts; while (i < length_1) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); + writeSymbolTypeReference(parent, typeArguments, start, i, flags); writePunctuation(writer, 22 /* DotToken */); } } @@ -26556,7 +26635,8 @@ var ts; var symbol = type.symbol; if (symbol) { // Always use 'typeof T' for type of class, enum, and module objects - if (symbol.flags & (32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { + if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 /* Enum */ | 512 /* ValueModule */)) { writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -26595,7 +26675,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 262 /* SourceFile */ || declaration.parent.kind === 232 /* ModuleBlock */; + return declaration.parent.kind === 263 /* SourceFile */ || declaration.parent.kind === 233 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -26780,12 +26860,12 @@ var ts; } function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { // We have to explicitly emit square bracket and bracket because these tokens are not stored inside the node. - if (bindingPattern.kind === 172 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 173 /* ObjectBindingPattern */) { writePunctuation(writer, 16 /* OpenBraceToken */); buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 17 /* CloseBraceToken */); } - else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 174 /* ArrayBindingPattern */) { writePunctuation(writer, 20 /* OpenBracketToken */); var elements = bindingPattern.elements; buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); @@ -26799,7 +26879,7 @@ var ts; if (ts.isOmittedExpression(bindingElement)) { return; } - ts.Debug.assert(bindingElement.kind === 174 /* BindingElement */); + ts.Debug.assert(bindingElement.kind === 175 /* BindingElement */); if (bindingElement.propertyName) { writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55 /* ColonToken */); @@ -26923,7 +27003,7 @@ var ts; writeKeyword(writer, 132 /* NumberKeyword */); break; case 0 /* String */: - writeKeyword(writer, 134 /* StringKeyword */); + writeKeyword(writer, 135 /* StringKeyword */); break; } writePunctuation(writer, 21 /* CloseBracketToken */); @@ -26959,75 +27039,75 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174 /* BindingElement */: + case 175 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 224 /* VariableDeclaration */: + case 225 /* 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 231 /* ModuleDeclaration */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 226 /* FunctionDeclaration */: - case 230 /* EnumDeclaration */: - case 235 /* ImportEqualsDeclaration */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 227 /* FunctionDeclaration */: + case 231 /* EnumDeclaration */: + case 236 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_8 = getDeclarationContainer(node); + var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 235 /* ImportEqualsDeclaration */ && parent_8.kind !== 262 /* SourceFile */ && ts.isInAmbientContext(parent_8))) { - return isGlobalSourceFile(parent_8); + !(node.kind !== 236 /* ImportEqualsDeclaration */ && parent.kind !== 263 /* SourceFile */ && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_8); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + return isDeclarationVisible(parent); + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.getModifierFlags(node) & (8 /* Private */ | 16 /* Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so const it fall into next case statement - case 150 /* Constructor */: - case 154 /* ConstructSignature */: - case 153 /* CallSignature */: - case 155 /* IndexSignature */: - case 144 /* Parameter */: - case 232 /* ModuleBlock */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 161 /* TypeLiteral */: - case 157 /* TypeReference */: - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: + case 151 /* Constructor */: + case 155 /* ConstructSignature */: + case 154 /* CallSignature */: + case 156 /* IndexSignature */: + case 145 /* Parameter */: + case 233 /* ModuleBlock */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 162 /* TypeLiteral */: + case 158 /* TypeReference */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* 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 237 /* ImportClause */: - case 238 /* NamespaceImport */: - case 240 /* ImportSpecifier */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: return false; // Type parameters are always visible - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: // Source file and namespace export are always visible - case 262 /* SourceFile */: - case 234 /* NamespaceExportDeclaration */: + case 263 /* SourceFile */: + case 235 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return false; default: return false; @@ -27036,10 +27116,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 241 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 242 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 244 /* ExportSpecifier */) { + else if (node.parent.kind === 245 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -27132,12 +27212,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 224 /* VariableDeclaration */: - case 225 /* VariableDeclarationList */: - case 240 /* ImportSpecifier */: - case 239 /* NamedImports */: - case 238 /* NamespaceImport */: - case 237 /* ImportClause */: + case 225 /* VariableDeclaration */: + case 226 /* VariableDeclarationList */: + case 241 /* ImportSpecifier */: + case 240 /* NamedImports */: + case 239 /* NamespaceImport */: + case 238 /* ImportClause */: node = node.parent; break; default: @@ -27168,7 +27248,7 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false); } function isComputedNonLiteralName(name) { - return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression); + return name.kind === 143 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { source = filterType(source, function (t) { return !(t.flags & 6144 /* Nullable */); }); @@ -27181,17 +27261,16 @@ var ts; var members = ts.createMap(); var names = ts.createMap(); for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_17 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_17)] = true; + var name = properties_2[_i]; + names.set(ts.getTextOfPropertyName(name), true); } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; - var inNamesToRemove = prop.name in names; + var inNamesToRemove = names.has(prop.name); var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */); - var isMethod = prop.flags & 8192 /* Method */; var isSetOnlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */); - if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { - members[prop.name] = prop; + if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { + members.set(prop.name, prop); } } var stringIndexInfo = getIndexInfoOfType(source, 0 /* String */); @@ -27216,7 +27295,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 172 /* ObjectBindingPattern */) { + if (pattern.kind === 173 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); @@ -27233,8 +27312,8 @@ var ts; } else { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) - var name_18 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_18)) { + var name = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name)) { // computed properties with non-literal names are treated as 'any' return anyType; } @@ -27243,12 +27322,12 @@ var ts; } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - var text = ts.getTextOfPropertyName(name_18); + var text = ts.getTextOfPropertyName(name); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); if (!type) { - error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } @@ -27301,7 +27380,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 175 /* ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 176 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, optional) { return strictNullChecks && optional ? includeFalsyTypes(type, 2048 /* Undefined */) : type; @@ -27319,11 +27398,11 @@ var ts; } // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (declaration.parent.parent.kind === 213 /* ForInStatement */) { + if (declaration.parent.parent.kind === 214 /* ForInStatement */) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType; } - if (declaration.parent.parent.kind === 214 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 215 /* 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, @@ -27338,7 +27417,7 @@ var ts; return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality); } if ((compilerOptions.noImplicitAny || declaration.flags & 65536 /* JavaScriptFile */) && - declaration.kind === 224 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + declaration.kind === 225 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) { // If --noImplicitAny is on or the declaration is in a Javascript file, // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no @@ -27352,11 +27431,11 @@ var ts; return autoArrayType; } } - if (declaration.kind === 144 /* Parameter */) { + if (declaration.kind === 145 /* 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 === 152 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151 /* GetAccessor */); + if (func.kind === 153 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 152 /* GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -27386,7 +27465,7 @@ var ts; return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 259 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 260 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -27432,7 +27511,7 @@ var ts; var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members[symbol.name] = symbol; + members.set(symbol.name, symbol); }); var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { @@ -27467,7 +27546,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 172 /* ObjectBindingPattern */ + return pattern.kind === 173 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -27489,7 +27568,7 @@ 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. - if (declaration.kind === 258 /* PropertyAssignment */) { + if (declaration.kind === 259 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -27506,7 +27585,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 144 /* Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 145 /* Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol) { @@ -27522,10 +27601,10 @@ var ts; return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 241 /* ExportAssignment */) { + if (declaration.kind === 242 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 287 /* JSDocPropertyTag */ && declaration.typeExpression) { + if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 288 /* JSDocPropertyTag */ && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } // Handle variable, parameter or property @@ -27538,8 +27617,8 @@ var ts; // * exports.p = expr // * this.p = expr // * className.prototype.method = expr - if (declaration.kind === 192 /* BinaryExpression */ || - declaration.kind === 177 /* PropertyAccessExpression */ && declaration.parent.kind === 192 /* BinaryExpression */) { + if (declaration.kind === 193 /* BinaryExpression */ || + declaration.kind === 178 /* PropertyAccessExpression */ && declaration.parent.kind === 193 /* BinaryExpression */) { // Use JS Doc type if present on parent expression statement if (declaration.flags & 65536 /* JavaScriptFile */) { var jsdocType = ts.getJSDocType(declaration.parent); @@ -27547,7 +27626,7 @@ var ts; return links.type = getTypeFromTypeNode(jsdocType); } } - var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 /* BinaryExpression */ ? + var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 193 /* BinaryExpression */ ? checkExpressionCached(decl.right) : checkExpressionCached(decl.parent.right); }); type = getUnionType(declaredTypes, /*subtypeReduction*/ true); @@ -27564,7 +27643,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 151 /* GetAccessor */) { + if (accessor.kind === 152 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -27584,8 +27663,8 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - var getter = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 152 /* SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 152 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 153 /* SetAccessor */); if (getter && getter.flags & 65536 /* JavaScriptFile */) { var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); if (jsDocType) { @@ -27629,7 +27708,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 152 /* 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)); } } @@ -27637,6 +27716,10 @@ var ts; } return links.type; } + function getBaseTypeVariableOfClass(symbol) { + var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); + return baseConstructorType.flags & 540672 /* TypeVariable */ ? baseConstructorType : undefined; + } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -27645,8 +27728,13 @@ var ts; } else { var type = createObjectType(16 /* Anonymous */, symbol); - links.type = strictNullChecks && symbol.flags & 536870912 /* Optional */ ? - includeFalsyTypes(type, 2048 /* Undefined */) : type; + if (symbol.flags & 32 /* Class */) { + var baseTypeVariable = getBaseTypeVariableOfClass(symbol); + links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; + } + else { + links.type = strictNullChecks && symbol.flags & 536870912 /* Optional */ ? includeFalsyTypes(type, 2048 /* Undefined */) : type; + } } } return links.type; @@ -27726,8 +27814,13 @@ var ts; function hasBaseType(type, checkBase) { return check(type); function check(type) { - var target = getTargetType(type); - return target === checkBase || ts.forEach(getBaseTypes(target), check); + if (getObjectFlags(type) & (3 /* ClassOrInterface */ | 4 /* Reference */)) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(getBaseTypes(target), check); + } + else if (type.flags & 131072 /* Intersection */) { + return ts.forEach(type.types, check); + } } } // Appends the type parameters given by a list of declarations to a set of type parameters and returns the resulting set. @@ -27755,9 +27848,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 227 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */ || - node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ || - node.kind === 149 /* MethodDeclaration */ || node.kind === 185 /* ArrowFunction */) { + if (node.kind === 228 /* ClassDeclaration */ || node.kind === 198 /* ClassExpression */ || + node.kind === 227 /* FunctionDeclaration */ || node.kind === 185 /* FunctionExpression */ || + node.kind === 150 /* MethodDeclaration */ || node.kind === 186 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -27767,7 +27860,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, 228 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 229 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -27776,8 +27869,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 228 /* InterfaceDeclaration */ || node.kind === 227 /* ClassDeclaration */ || - node.kind === 197 /* ClassExpression */ || node.kind === 229 /* TypeAliasDeclaration */) { + if (node.kind === 229 /* InterfaceDeclaration */ || node.kind === 228 /* ClassDeclaration */ || + node.kind === 198 /* ClassExpression */ || node.kind === 230 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -27791,8 +27884,25 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); } + // A type is a mixin constructor if it has a single construct signature taking no type parameters and a single + // rest parameter of type any[]. + function isMixinConstructorType(type) { + var signatures = getSignaturesOfType(type, 1 /* Construct */); + if (signatures.length === 1) { + var s = signatures[0]; + return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType; + } + return false; + } function isConstructorType(type) { - return type.flags & 32768 /* Object */ && getSignaturesOfType(type, 1 /* Construct */).length > 0; + if (isValidBaseType(type) && getSignaturesOfType(type, 1 /* Construct */).length > 0) { + return true; + } + if (type.flags & 540672 /* TypeVariable */) { + var constraint = getBaseConstraintOfType(type); + return isValidBaseType(constraint) && isMixinConstructorType(constraint); + } + return false; } function getBaseTypeNodeOfClass(type) { return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); @@ -27826,7 +27936,7 @@ var ts; return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); - if (baseConstructorType.flags & 32768 /* Object */) { + if (baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */)) { // Resolving the members of a class requires us to resolve the base class of that class. // We force resolution here such that we catch circularities now. resolveStructuredTypeMembers(baseConstructorType); @@ -27864,8 +27974,8 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseConstructorType = getBaseConstructorTypeOfClass(type); - if (!(baseConstructorType.flags & 32768 /* Object */)) { + var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); + if (!(baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */))) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -27900,7 +28010,7 @@ var ts; if (baseType === unknownType) { return; } - if (!(getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */)) { + if (!isValidBaseType(baseType)) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); return; } @@ -27926,16 +28036,22 @@ var ts; } return true; } + // A valid base type is any non-generic object type or intersection of non-generic + // object types. + function isValidBaseType(type) { + return type.flags & 32768 /* Object */ && !isGenericMappedType(type) || + type.flags & 131072 /* Intersection */ && !ts.forEach(type.types, function (t) { return !isValidBaseType(t); }); + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 228 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 229 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { - if (getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */) { + if (isValidBaseType(baseType)) { if (type !== baseType && !hasBaseType(baseType, type)) { if (type.resolvedBaseTypes === emptyArray) { type.resolvedBaseTypes = [baseType]; @@ -27962,7 +28078,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 228 /* InterfaceDeclaration */) { + if (declaration.kind === 229 /* InterfaceDeclaration */) { if (declaration.flags & 64 /* ContainsThis */) { return false; } @@ -28000,7 +28116,7 @@ var ts; type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384 /* TypeParameter */); @@ -28019,7 +28135,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 286 /* JSDocTypedefTag */); + var declaration = ts.getDeclarationOfKind(symbol, 287 /* JSDocTypedefTag */); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -28030,7 +28146,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 229 /* TypeAliasDeclaration */); + declaration = ts.getDeclarationOfKind(symbol, 230 /* TypeAliasDeclaration */); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -28040,7 +28156,7 @@ var ts; // an instantiation of the type alias with the type parameters supplied as type arguments. links.typeParameters = typeParameters; links.instantiations = ts.createMap(); - links.instantiations[getTypeListId(typeParameters)] = type; + links.instantiations.set(getTypeListId(typeParameters), type); } } else { @@ -28057,14 +28173,14 @@ var ts; return !ts.isInAmbientContext(member); } return expr.kind === 8 /* NumericLiteral */ || - expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && + expr.kind === 191 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */ || - expr.kind === 70 /* Identifier */ && !!symbol.exports[expr.text]; + expr.kind === 70 /* Identifier */ && !!symbol.exports.get(expr.text); } function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 230 /* EnumDeclaration */) { + if (declaration.kind === 231 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -28089,10 +28205,10 @@ var ts; enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { var memberTypeList = []; - var memberTypes = ts.createMap(); + var memberTypes = []; for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 230 /* EnumDeclaration */) { + if (declaration.kind === 231 /* EnumDeclaration */) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -28109,7 +28225,7 @@ var ts; if (memberTypeList.length > 1) { enumType.flags |= 65536 /* Union */; enumType.types = memberTypeList; - unionTypes[getTypeListId(memberTypeList)] = enumType; + unionTypes.set(getTypeListId(memberTypeList), enumType); } } } @@ -28130,9 +28246,6 @@ var ts; if (!links.declaredType) { var type = createType(16384 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */).constraint) { - type.constraint = noConstraintType; - } links.declaredType = type; } return links.declaredType; @@ -28145,7 +28258,6 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0); if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { return getDeclaredTypeOfClassOrInterface(symbol); } @@ -28184,19 +28296,20 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: + case 133 /* ObjectKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 129 /* NeverKeyword */: - case 171 /* LiteralType */: + case 172 /* LiteralType */: return true; - case 162 /* ArrayType */: + case 163 /* ArrayType */: return isIndependentType(node.elementType); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return isIndependentTypeReference(node); } return false; @@ -28209,7 +28322,7 @@ var ts; // A function-like declaration is considered independent (free of this references) if it has a return type // annotation that is considered independent and if each parameter is considered independent. function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 150 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 151 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -28230,12 +28343,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return isIndependentVariableLikeDeclaration(declaration); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -28246,7 +28359,7 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; - result[symbol.name] = symbol; + result.set(symbol.name, symbol); } return result; } @@ -28256,15 +28369,15 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; - result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; - if (!symbols[s.name]) { - symbols[s.name] = s; + if (!symbols.has(s.name)) { + symbols.set(s.name, s); } } } @@ -28272,8 +28385,8 @@ var ts; if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get("__call")); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get("__new")); type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); } @@ -28281,7 +28394,14 @@ var ts; } function getTypeWithThisArgument(type, thisArgument) { if (getObjectFlags(type) & 4 /* Reference */) { - return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + var target = type.target; + var typeArguments = type.typeArguments; + if (ts.length(target.typeParameters) === ts.length(typeArguments)) { + return createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType])); + } + } + else if (type.flags & 131072 /* Intersection */) { + return getIntersectionType(ts.map(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument); })); } return type; } @@ -28317,7 +28437,7 @@ var ts; for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0 /* String */); @@ -28474,19 +28594,51 @@ var ts; function unionSpreadIndexInfos(info1, info2) { return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly); } + function includeMixinType(type, types, index) { + var mixedTypes = []; + for (var i = 0; i < types.length; i++) { + if (i === index) { + mixedTypes.push(type); + } + else if (isMixinConstructorType(types[i])) { + mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1 /* Construct */)[0])); + } + } + return getIntersectionType(mixedTypes); + } function resolveIntersectionTypeMembers(type) { // The members and properties collections are empty for intersection types. To get all properties of an // intersection type use getPropertiesOfType (only the language service uses this). var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexInfo = undefined; - var numberIndexInfo = undefined; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; + var stringIndexInfo; + var numberIndexInfo; + var types = type.types; + var mixinCount = ts.countWhere(types, isMixinConstructorType); + var _loop_3 = function (i) { + var t = type.types[i]; + // When an intersection type contains mixin constructor types, the construct signatures from + // those types are discarded and their return types are mixed into the return types of all + // other construct signatures in the intersection type. For example, the intersection type + // '{ new(...args: any[]) => A } & { new(s: string) => B }' has a single construct signature + // 'new(s: string) => A & B'. + if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) { + var signatures = getSignaturesOfType(t, 1 /* Construct */); + if (signatures.length && mixinCount > 0) { + signatures = ts.map(signatures, function (s) { + var clone = cloneSignature(s); + clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i); + return clone; + }); + } + constructSignatures = ts.concatenate(constructSignatures, signatures); + } callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0 /* Call */)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1 /* Construct */)); stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0 /* String */)); numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1 /* Number */)); + }; + for (var i = 0; i < types.length; i++) { + _loop_3(i); } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } @@ -28505,8 +28657,8 @@ var ts; } else if (symbol.flags & 2048 /* TypeLiteral */) { var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var callSignatures = getSignaturesOfSymbol(members.get("__call")); + var constructSignatures = getSignaturesOfSymbol(members.get("__new")); var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); @@ -28520,14 +28672,14 @@ var ts; } if (symbol.flags & 32 /* Class */) { var classType = getDeclaredTypeOfClassOrInterface(symbol); - constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); } var baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & 32768 /* Object */) { + if (baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */ | 540672 /* TypeVariable */)) { members = createSymbolTable(getNamedMembers(members)); - addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); + addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); } } var numberIndexInfo = symbol.flags & 384 /* Enum */ ? enumNumberIndexInfo : undefined; @@ -28552,12 +28704,15 @@ var ts; var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); // The 'T' in 'keyof T' var templateReadonly = !!type.declaration.readonlyToken; var templateOptional = !!type.declaration.questionToken; - if (type.declaration.typeParameter.constraint.kind === 168 /* TypeOperator */) { + if (type.declaration.typeParameter.constraint.kind === 169 /* TypeOperator */) { // We have a { [P in keyof T]: X } - forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + for (var _i = 0, _a = getPropertiesOfType(modifiersType); _i < _a.length; _i++) { + var propertySymbol = _a[_i]; + addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); + } if (getIndexInfoOfType(modifiersType, 0 /* String */)) { addMemberForKeyType(stringType); } @@ -28571,11 +28726,11 @@ var ts; forEachType(iterationType, addMemberForKeyType); } setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); - function addMemberForKeyType(t) { + function addMemberForKeyType(t, propertySymbol) { // Create a mapper from T to the current iteration type constituent. Then, if the // mapped type is itself an instantiated type, combine the iteration mapper with the // instantiation mapper. - var iterationMapper = createUnaryTypeMapper(typeParameter, t); + var iterationMapper = createTypeMapper([typeParameter], [t]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); // If the current iteration type constituent is a string literal type, create a property. @@ -28587,7 +28742,10 @@ var ts; var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | (isOptional ? 536870912 /* Optional */ : 0), propName); prop.type = propType; prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); - members[propName] = prop; + if (propertySymbol) { + prop.mappedTypeOrigin = propertySymbol; + } + members.set(propName, prop); } else if (t.flags & 2 /* String */) { stringIndexInfo = createIndexInfo(propType, templateReadonly); @@ -28611,7 +28769,7 @@ var ts; function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { var constraintDeclaration = type.declaration.typeParameter.constraint; - if (constraintDeclaration.kind === 168 /* TypeOperator */) { + if (constraintDeclaration.kind === 169 /* TypeOperator */) { // If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check // AST nodes here because, when T is a non-generic type, the logic below eagerly resolves // 'keyof T' to a literal union type and we can't recover T from that type. @@ -28629,9 +28787,6 @@ var ts; } return type.modifiersType; } - function getErasedTemplateTypeFromMappedType(type) { - return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); - } function isGenericMappedType(type) { if (getObjectFlags(type) & 32 /* Mapped */) { var constraintType = getConstraintTypeFromMappedType(type); @@ -28676,38 +28831,35 @@ var ts; function getPropertyOfObjectType(type, name) { if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } } } function getPropertiesOfUnionOrIntersectionType(type) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var current = _a[_i]; - for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { - var prop = _c[_b]; - getUnionOrIntersectionProperty(type, prop.name); - } - // The properties of a union type are those that are present in all constituent types, so - // we only need to check the properties of the first type - if (type.flags & 65536 /* Union */) { - break; - } - } - var props = type.resolvedProperties; - if (props) { - var result = []; - for (var key in props) { - var prop = props[key]; - // We need to filter out partial properties in union types - if (!(prop.flags & 268435456 /* SyntheticProperty */ && prop.isPartial)) { - result.push(prop); + if (!type.resolvedProperties) { + var members = ts.createMap(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.name)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.name); + if (combinedProp) { + members.set(prop.name, combinedProp); + } + } + } + // The properties of a union type are those that are present in all constituent types, so + // we only need to check the properties of the first type + if (type.flags & 65536 /* Union */) { + break; } } - return result; + type.resolvedProperties = getNamedMembers(members); } - return emptyArray; + return type.resolvedProperties; } function getPropertiesOfType(type) { type = getApparentType(type); @@ -28715,19 +28867,77 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } + function getConstraintOfType(type) { + return type.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(type) : getBaseConstraintOfType(type); + } + function getConstraintOfTypeParameter(typeParameter) { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; + } + function getBaseConstraintOfType(type) { + var constraint = getResolvedBaseConstraint(type); + return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined; + } + function hasNonCircularBaseConstraint(type) { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } /** - * The apparent type of a type parameter is the base constraint instantiated with the type parameter - * as the type argument for the 'this' type. + * Return the resolved base constraint of a type variable. The noConstraintType singleton is returned if the + * type variable has no constraint, and the circularConstraintType singleton is returned if the constraint + * circularly references the type variable. */ - function getApparentTypeOfTypeVariable(type) { - if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeVariable(type); - while (constraintType && constraintType.flags & 16384 /* TypeParameter */) { - constraintType = getConstraintOfTypeVariable(constraintType); + function getResolvedBaseConstraint(type) { + var typeStack; + var circular; + if (!type.resolvedBaseConstraint) { + typeStack = []; + var constraint = getBaseConstraint(type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + } + return type.resolvedBaseConstraint; + function getBaseConstraint(t) { + if (ts.contains(typeStack, t)) { + circular = true; + return undefined; + } + typeStack.push(t); + var result = computeBaseConstraint(t); + typeStack.pop(); + return result; + } + function computeBaseConstraint(t) { + if (t.flags & 16384 /* TypeParameter */) { + var constraint = getConstraintFromTypeParameter(t); + return t.isThisType ? constraint : + constraint ? getBaseConstraint(constraint) : undefined; } - type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + if (t.flags & 196608 /* UnionOrIntersection */) { + var types = t.types; + var baseTypes = []; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var type_1 = types_2[_i]; + var baseType = getBaseConstraint(type_1); + if (baseType) { + baseTypes.push(baseType); + } + } + return t.flags & 65536 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : + t.flags & 131072 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : + undefined; + } + if (t.flags & 262144 /* Index */) { + return stringType; + } + if (t.flags & 524288 /* IndexedAccess */) { + var baseObjectType = getBaseConstraint(t.objectType); + var baseIndexType = getBaseConstraint(t.indexType); + var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; + return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; + } + return t; } - return type.resolvedApparentType; + } + function getApparentTypeOfIntersectionType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type)); } /** * For a type parameter, return the base constraint of the type parameter. For the string, number, @@ -28735,26 +28945,29 @@ var ts; * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type) { - var t = type.flags & 540672 /* TypeVariable */ ? getApparentTypeOfTypeVariable(type) : type; - return t.flags & 262178 /* StringLike */ ? globalStringType : - t.flags & 340 /* NumberLike */ ? globalNumberType : - t.flags & 136 /* BooleanLike */ ? globalBooleanType : - t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() : - t; + var t = type.flags & 540672 /* TypeVariable */ ? getBaseConstraintOfType(type) || emptyObjectType : type; + return t.flags & 131072 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : + t.flags & 262178 /* StringLike */ ? globalStringType : + t.flags & 340 /* NumberLike */ ? globalNumberType : + t.flags & 136 /* BooleanLike */ ? globalBooleanType : + t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() : + t.flags & 16777216 /* NonPrimitive */ ? globalObjectType : + t; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; + var excludeModifiers = containingType.flags & 65536 /* Union */ ? 8 /* Private */ | 16 /* Protected */ : 0; var props; // Flags we want to propagate to the result if they exist in all source symbols var commonFlags = (containingType.flags & 131072 /* Intersection */) ? 536870912 /* Optional */ : 0 /* None */; var isReadonly = false; var isPartial = false; - for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { - var current = types_2[_i]; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var current = types_3[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))) { + if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & excludeModifiers)) { commonFlags &= prop.flags; if (!props) { props = [prop]; @@ -28810,12 +29023,12 @@ var ts; // these partial properties when identifying discriminant properties, but otherwise they are filtered out // and do not appear to be present in the union type. function getUnionOrIntersectionProperty(type, name) { - var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap()); - var property = properties[name]; + var properties = type.propertyCache || (type.propertyCache = ts.createMap()); + var property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); if (property) { - properties[name] = property; + properties.set(name, property); } } return property; @@ -28837,7 +29050,7 @@ var ts; type = getApparentType(type); if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -28926,16 +29139,16 @@ var ts; } function symbolsToArray(symbols) { var result = []; - for (var id in symbols) { + symbols.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { - result.push(symbols[id]); + result.push(symbol); } - } + }); return result; } function isJSDocOptionalParameter(node) { if (node.flags & 65536 /* JavaScriptFile */) { - if (node.type && node.type.kind === 274 /* JSDocOptionalType */) { + if (node.type && node.type.kind === 275 /* JSDocOptionalType */) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -28946,7 +29159,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 274 /* JSDocOptionalType */; + return paramTag.typeExpression.type.kind === 275 /* JSDocOptionalType */; } } } @@ -28995,9 +29208,10 @@ var ts; if (!links.resolvedSignature) { var parameters = []; var hasLiteralTypes = false; - var minArgumentCount = -1; + var minArgumentCount = 0; var thisParameter = undefined; var hasThisParameter = void 0; + var iife = ts.getImmediatelyInvokedFunctionExpression(declaration); var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); // If this is a JSDoc construct signature, then skip the first parameter in the // parameter list. The first parameter represents the return type of the construct @@ -29017,43 +29231,35 @@ var ts; else { parameters.push(paramSymbol); } - if (param.type && param.type.kind === 171 /* LiteralType */) { + if (param.type && param.type.kind === 172 /* LiteralType */) { hasLiteralTypes = true; } - if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { - if (minArgumentCount < 0) { - minArgumentCount = i - (hasThisParameter ? 1 : 0); - } - } - else { - // If we see any required parameters, it means the prior ones were not in fact optional. - minArgumentCount = -1; + // Record a new minimum argument count if this is not an optional parameter + var isOptionalParameter_1 = param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !param.type || + isJSDocOptionalParameter(param); + if (!isOptionalParameter_1) { + minArgumentCount = parameters.length; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 151 /* GetAccessor */ || declaration.kind === 152 /* SetAccessor */) && + if ((declaration.kind === 152 /* GetAccessor */ || declaration.kind === 153 /* SetAccessor */) && !ts.hasDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */; + var otherKind = declaration.kind === 152 /* GetAccessor */ ? 153 /* SetAccessor */ : 152 /* GetAccessor */; var other = ts.getDeclarationOfKind(declaration.symbol, otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); - } - if (isJSConstructSignature) { - minArgumentCount--; - } - var classType = declaration.kind === 150 /* Constructor */ ? + var classType = declaration.kind === 151 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : getTypeParametersFromJSDocTemplate(declaration); var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType); - var typePredicate = declaration.type && declaration.type.kind === 156 /* TypePredicate */ ? + var typePredicate = declaration.type && declaration.type.kind === 157 /* TypePredicate */ ? createTypePredicateFromTypePredicateNode(declaration.type) : undefined; links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes); @@ -29078,8 +29284,8 @@ var ts; } // 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 === 151 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 152 /* SetAccessor */); + if (declaration.kind === 152 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 153 /* SetAccessor */); return getAnnotatedAccessorType(setter); } if (ts.nodeIsMissing(declaration.body)) { @@ -29093,20 +29299,20 @@ var ts; for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 275 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 276 /* JSDocFunctionType */: // 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). @@ -29179,7 +29385,11 @@ var ts; function getSignatureInstantiation(signature, typeArguments) { var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()); var id = getTypeListId(typeArguments); - return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + var instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; } function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), /*eraseTypeParameters*/ true); @@ -29198,7 +29408,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 === 150 /* Constructor */ || signature.declaration.kind === 154 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 151 /* Constructor */ || signature.declaration.kind === 155 /* ConstructSignature */; var type = createObjectType(16 /* Anonymous */); type.members = emptySymbols; type.properties = emptyArray; @@ -29209,10 +29419,10 @@ var ts; return signature.isolatedSignatureType; } function getIndexSymbol(symbol) { - return symbol.members["__index"]; + return symbol.members.get("__index"); } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 132 /* NumberKeyword */ : 134 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 132 /* NumberKeyword */ : 135 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -29239,21 +29449,9 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 143 /* TypeParameter */).constraint; - } - function hasConstraintReferenceTo(type, target) { - var checked; - while (type && type.flags & 16384 /* TypeParameter */ && !(type.isThisType) && !ts.contains(checked, type)) { - if (type === target) { - return true; - } - (checked || (checked = [])).push(type); - var constraintDeclaration = getConstraintDeclaration(type); - type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); - } - return false; + return ts.getDeclarationOfKind(type.symbol, 144 /* TypeParameter */).constraint; } - function getConstraintOfTypeParameter(typeParameter) { + function getConstraintFromTypeParameter(typeParameter) { if (!typeParameter.constraint) { if (typeParameter.target) { var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); @@ -29261,23 +29459,13 @@ var ts; } else { var constraintDeclaration = getConstraintDeclaration(typeParameter); - var constraint = getTypeFromTypeNode(constraintDeclaration); - if (hasConstraintReferenceTo(constraint, typeParameter)) { - error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); - constraint = unknownType; - } - typeParameter.constraint = constraint; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } - function getConstraintOfTypeVariable(type) { - return type.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(type) : - type.flags & 524288 /* IndexedAccess */ ? type.constraint : - undefined; - } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 144 /* TypeParameter */).parent); } function getTypeListId(types) { var result = ""; @@ -29308,8 +29496,8 @@ var ts; // that care about the presence of such types at arbitrary depth in a containing type. function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; - for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { - var type = types_3[_i]; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var type = types_4[_i]; if (!(type.flags & excludeKinds)) { result |= type.flags; } @@ -29318,9 +29506,10 @@ var ts; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); - var type = target.instantiations[id]; + var type = target.instantiations.get(id); if (!type) { - type = target.instantiations[id] = createObjectType(4 /* Reference */, target.symbol); + type = createObjectType(4 /* Reference */, target.symbol); + target.instantiations.set(id, type); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -29363,7 +29552,11 @@ var ts; var links = getSymbolLinks(symbol); var typeParameters = links.typeParameters; var id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + var instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + } + return instantiation; } // Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include // references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the @@ -29395,11 +29588,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 157 /* TypeReference */: + case 158 /* TypeReference */: return node.typeName; - case 273 /* JSDocTypeReference */: + case 274 /* JSDocTypeReference */: return node.name; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -29425,7 +29618,7 @@ var ts; if (symbol.flags & 524288 /* TypeAlias */) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 /* Value */ && node.kind === 273 /* JSDocTypeReference */) { + if (symbol.flags & 107455 /* Value */ && node.kind === 274 /* JSDocTypeReference */) { // A JSDocTypeReference may have resolved to a value (as opposed to a type). In // that case, the type of this reference is just the type of the value we resolved // to. @@ -29438,14 +29631,14 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 273 /* JSDocTypeReference */) { + if (node.kind === 274 /* JSDocTypeReference */) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(typeReferenceName); type = getTypeReferenceType(node, symbol); } else { // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 157 /* TypeReference */ + var typeNameOrExpression = node.kind === 158 /* TypeReference */ ? node.typeName : ts.isEntityNameExpression(node.expression) ? node.expression @@ -29480,9 +29673,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: return declaration; } } @@ -29576,7 +29769,7 @@ var ts; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384 /* TypeParameter */); @@ -29660,14 +29853,14 @@ var ts; // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToUnion(typeSet, types) { - for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { - var type = types_4[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; addTypeToUnion(typeSet, type); } } function containsIdenticalType(types, type) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var t = types_5[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -29675,8 +29868,8 @@ var ts; return false; } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var type = types_7[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } @@ -29763,10 +29956,11 @@ var ts; return types[0]; } var id = getTypeListId(types); - var type = unionTypes[id]; + var type = unionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 6144 /* Nullable */); - type = unionTypes[id] = createType(65536 /* Union */ | propagatedFlags); + type = createType(65536 /* Union */ | propagatedFlags); + unionTypes.set(id, type); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -29797,8 +29991,8 @@ var ts; // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var type = types_8[_i]; addTypeToIntersection(typeSet, type); } } @@ -29833,10 +30027,11 @@ var ts; /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); } var id = getTypeListId(typeSet); - var type = intersectionTypes[id]; + var type = intersectionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 6144 /* Nullable */); - type = intersectionTypes[id] = createType(131072 /* Intersection */ | propagatedFlags); + type = createType(131072 /* Intersection */ | propagatedFlags); + intersectionTypes.set(id, type); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -29886,28 +30081,10 @@ var ts; var type = createType(524288 /* IndexedAccess */); type.objectType = objectType; type.indexType = indexType; - // We eagerly compute the constraint of the indexed access type such that circularity - // errors are immediately caught and reported. For example, class C { x: this["x"] } - // becomes an error only when the constraint is eagerly computed. - if (type.objectType.flags & 229376 /* StructuredType */) { - // The constraint of T[K], where T is an object, union, or intersection type, - // is the type of the string index signature of T, if any. - type.constraint = getIndexTypeOfType(type.objectType, 0 /* String */); - } - else if (type.objectType.flags & 540672 /* TypeVariable */) { - // The constraint of T[K], where T is a type variable, is A[K], where A is the - // apparent type of T. - var apparentType = getApparentTypeOfTypeVariable(type.objectType); - if (apparentType !== emptyObjectType) { - type.constraint = isTypeOfKind(type.indexType, 262178 /* StringLike */) ? - getIndexedAccessType(apparentType, type.indexType) : - getIndexTypeOfType(apparentType, 0 /* String */); - } - } return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode : undefined; var propName = indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */) ? indexType.text : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ? @@ -29955,7 +30132,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType)); } @@ -29969,12 +30146,12 @@ var ts; return unknownType; } function getIndexedAccessForMappedType(type, indexType, accessNode) { - var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode : undefined; if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); return unknownType; } - var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } @@ -29986,18 +30163,11 @@ var ts; // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. if (maybeTypeOfKind(indexType, 540672 /* TypeVariable */ | 262144 /* Index */) || - maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && !(accessNode && accessNode.kind === 178 /* ElementAccessExpression */) || + maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && !(accessNode && accessNode.kind === 179 /* ElementAccessExpression */) || isGenericMappedType(objectType)) { if (objectType.flags & 1 /* Any */) { return objectType; } - // We first check that the index type is assignable to 'keyof T' for the object type. - if (accessNode) { - if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } - } // If the object type is a mapped type { [P in K]: E }, we instantiate E using a mapper that substitutes // the index type for P. For example, for an index access { [P in K]: Box }[X], we construct the // type Box. @@ -30006,7 +30176,11 @@ var ts; } // Otherwise we defer the operation by creating an indexed access type. var id = objectType.id + "," + indexType.id; - return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + var type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); + } + return type; } // In the following we resolve T[K] to the type of the property in T selected by K. var apparentObjectType = getApparentType(objectType); @@ -30050,7 +30224,7 @@ var ts; if (!links.resolvedType) { // Deferred resolution of members is handled by resolveObjectTypeMembers var aliasSymbol = getAliasSymbolForTypeNode(node); - if (ts.isEmpty(node.symbol.members) && !aliasSymbol) { + if (node.symbol.members.size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -30063,7 +30237,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 229 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 230 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -30074,7 +30248,7 @@ var ts; * this function should be called in a left folding style, with left = previous result of getSpreadType * and right = the new element to be spread. */ - function getSpreadType(left, right, isFromObjectLiteral) { + function getSpreadType(left, right) { if (left.flags & 1 /* Any */ || right.flags & 1 /* Any */) { return anyType; } @@ -30087,10 +30261,13 @@ var ts; return left; } if (left.flags & 65536 /* Union */) { - return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); }); + return mapType(left, function (t) { return getSpreadType(t, right); }); } if (right.flags & 65536 /* Union */) { - return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); }); + return mapType(right, function (t) { return getSpreadType(left, t); }); + } + if (right.flags & 16777216 /* NonPrimitive */) { + return emptyObjectType; } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); @@ -30108,23 +30285,23 @@ var ts; for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { var rightProp = _a[_i]; // we approximate own properties as non-methods plus methods that are inside the object literal - var isOwnProperty = !(rightProp.flags & 8192 /* Method */) || isFromObjectLiteral; var isSetterWithoutGetter = rightProp.flags & 65536 /* SetAccessor */ && !(rightProp.flags & 32768 /* GetAccessor */); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 /* Private */ | 16 /* Protected */)) { - skippedPrivateMembers[rightProp.name] = true; + skippedPrivateMembers.set(rightProp.name, true); } - else if (isOwnProperty && !isSetterWithoutGetter) { - members[rightProp.name] = rightProp; + else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { + members.set(rightProp.name, rightProp); } } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (leftProp.flags & 65536 /* SetAccessor */ && !(leftProp.flags & 32768 /* GetAccessor */) - || leftProp.name in skippedPrivateMembers) { + || skippedPrivateMembers.has(leftProp.name) + || isClassMethod(leftProp)) { continue; } - if (leftProp.name in members) { - var rightProp = members[leftProp.name]; + if (members.has(leftProp.name)) { + var rightProp = members.get(leftProp.name); var rightType = getTypeOfSymbol(rightProp); if (maybeTypeOfKind(rightType, 2048 /* Undefined */) || rightProp.flags & 536870912 /* Optional */) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); @@ -30135,15 +30312,18 @@ var ts; result.rightSpread = rightProp; result.declarations = declarations; result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); - members[leftProp.name] = result; + members.set(leftProp.name, result); } } else { - members[leftProp.name] = leftProp; + members.set(leftProp.name, leftProp); } } return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } + function isClassMethod(prop) { + return prop.flags & 8192 /* Method */ && ts.find(prop.declarations, function (decl) { return ts.isClassLike(decl.parent); }); + } function createLiteralType(flags, text) { var type = createType(flags); type.text = text; @@ -30165,7 +30345,11 @@ var ts; } function getLiteralTypeForText(flags, text) { var map = flags & 32 /* StringLiteral */ ? stringLiteralTypes : numericLiteralTypes; - return map[text] || (map[text] = createLiteralType(flags, text)); + var type = map.get(text); + if (!type) { + map.set(text, type = createLiteralType(flags, text)); + } + return type; } function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); @@ -30193,9 +30377,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 228 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 229 /* InterfaceDeclaration */)) { if (!(ts.getModifierFlags(container) & 32 /* Static */) && - (container.kind !== 150 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { + (container.kind !== 151 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -30212,87 +30396,89 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118 /* AnyKeyword */: - case 264 /* JSDocAllType */: - case 265 /* JSDocUnknownType */: + case 265 /* JSDocAllType */: + case 266 /* JSDocUnknownType */: return anyType; - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: return stringType; case 132 /* NumberKeyword */: return numberType; case 121 /* BooleanKeyword */: return booleanType; - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: return esSymbolType; case 104 /* VoidKeyword */: return voidType; - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: return undefinedType; case 94 /* NullKeyword */: return nullType; case 129 /* NeverKeyword */: return neverType; - case 290 /* JSDocNullKeyword */: + case 133 /* ObjectKeyword */: + return nonPrimitiveType; + case 291 /* JSDocNullKeyword */: return nullType; - case 291 /* JSDocUndefinedKeyword */: + case 292 /* JSDocUndefinedKeyword */: return undefinedType; - case 292 /* JSDocNeverKeyword */: + case 293 /* JSDocNeverKeyword */: return neverType; - case 167 /* ThisType */: + case 168 /* ThisType */: case 98 /* ThisKeyword */: return getTypeFromThisTypeNode(node); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 289 /* JSDocLiteralType */: + case 290 /* JSDocLiteralType */: return getTypeFromLiteralTypeNode(node.literal); - case 157 /* TypeReference */: - case 273 /* JSDocTypeReference */: + case 158 /* TypeReference */: + case 274 /* JSDocTypeReference */: return getTypeFromTypeReference(node); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return booleanType; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 162 /* ArrayType */: - case 266 /* JSDocArrayType */: + case 163 /* ArrayType */: + case 267 /* JSDocArrayType */: return getTypeFromArrayTypeNode(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 164 /* UnionType */: - case 267 /* JSDocUnionType */: + case 165 /* UnionType */: + case 268 /* JSDocUnionType */: return getTypeFromUnionTypeNode(node); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 166 /* ParenthesizedType */: - case 269 /* JSDocNullableType */: - case 270 /* JSDocNonNullableType */: - case 277 /* JSDocConstructorType */: - case 278 /* JSDocThisType */: - case 274 /* JSDocOptionalType */: + case 167 /* ParenthesizedType */: + case 270 /* JSDocNullableType */: + case 271 /* JSDocNonNullableType */: + case 278 /* JSDocConstructorType */: + case 279 /* JSDocThisType */: + case 275 /* JSDocOptionalType */: return getTypeFromTypeNode(node.type); - case 271 /* JSDocRecordType */: + case 272 /* JSDocRecordType */: return getTypeFromTypeNode(node.literal); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 161 /* TypeLiteral */: - case 288 /* JSDocTypeLiteral */: - case 275 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 162 /* TypeLiteral */: + case 289 /* JSDocTypeLiteral */: + case 276 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return getTypeFromMappedTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode case 70 /* Identifier */: - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 268 /* JSDocTupleType */: + case 269 /* JSDocTupleType */: return getTypeFromJSDocTupleType(node); - case 276 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -30319,13 +30505,13 @@ var ts; var instantiations = mapper.instantiations || (mapper.instantiations = []); return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); } - function createUnaryTypeMapper(source, target) { + function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } - function createBinaryTypeMapper(source1, target1, source2, target2) { + function makeBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createArrayTypeMapper(sources, targets) { + function makeArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { @@ -30336,10 +30522,9 @@ var ts; }; } function createTypeMapper(sources, targets) { - var count = sources.length; - var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : - count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : - createArrayTypeMapper(sources, targets); + var mapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + makeArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; return mapper; } @@ -30369,7 +30554,12 @@ var ts; } function combineTypeMappers(mapper1, mapper2) { var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; - mapper.mappedTypes = mapper1.mappedTypes; + mapper.mappedTypes = ts.concatenate(mapper1.mappedTypes, mapper2.mappedTypes); + return mapper; + } + function createReplacementMapper(source, target, baseMapper) { + var mapper = function (t) { return t === source ? target : baseMapper(t); }; + mapper.mappedTypes = baseMapper.mappedTypes; return mapper; } function cloneTypeParameter(typeParameter) { @@ -30459,10 +30649,7 @@ var ts; if (typeVariable_1 !== mappedTypeVariable) { return mapType(mappedTypeVariable, function (t) { if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); + return instantiateMappedObjectType(type, createReplacementMapper(typeVariable_1, t, mapper)); } return t; }); @@ -30493,23 +30680,23 @@ var ts; var node = symbol.declarations[0]; while (node) { switch (node.kind) { - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -30519,14 +30706,19 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 228 /* InterfaceDeclaration */) { + if (ts.isClassLike(node) || node.kind === 229 /* InterfaceDeclaration */) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 275 /* JSDocFunctionType */: + case 171 /* MappedType */: + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)))) { + return true; + } + break; + case 276 /* JSDocFunctionType */: var func = node; for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { var p = _c[_b]; @@ -30535,8 +30727,8 @@ var ts; } } break; - case 231 /* ModuleDeclaration */: - case 262 /* SourceFile */: + case 232 /* ModuleDeclaration */: + case 263 /* SourceFile */: return false; } node = node.parent; @@ -30546,7 +30738,7 @@ var ts; function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 262 /* SourceFile */ || parentKind === 232 /* ModuleBlock */; + return parentKind === 263 /* SourceFile */ || parentKind === 233 /* ModuleBlock */; } return false; } @@ -30623,27 +30815,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 !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return node.operatorToken.kind === 53 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; @@ -30658,7 +30850,7 @@ var ts; return true; } // For arrow functions we now know we're not context sensitive. - if (node.kind === 185 /* ArrowFunction */) { + if (node.kind === 186 /* ArrowFunction */) { return false; } // If the first parameter is not an explicit 'this' parameter, then the function has @@ -30680,9 +30872,12 @@ var ts; result.properties = resolved.properties; result.callSignatures = emptyArray; result.constructSignatures = emptyArray; - type = result; + return result; } } + else if (type.flags & 131072 /* Intersection */) { + return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures)); + } return type; } // TYPE CHECKING @@ -30873,13 +31068,15 @@ var ts; return true; } var id = source.id + "," + target.id; - if (enumRelation[id] !== undefined) { - return enumRelation[id]; + var relation = enumRelation.get(id); + if (relation !== undefined) { + return relation; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256 /* RegularEnum */) || !(target.symbol.flags & 256 /* RegularEnum */) || (source.flags & 65536 /* Union */) !== (target.flags & 65536 /* Union */)) { - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } var targetEnumType = getTypeOfSymbol(target.symbol); for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { @@ -30890,11 +31087,13 @@ var ts; if (errorReporter) { errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */)); } - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } } } - return enumRelation[id] = true; + enumRelation.set(id, true); + return true; } function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { if (target.flags & 8192 /* Never */) @@ -30915,6 +31114,8 @@ var ts; return true; if (source.flags & 4096 /* Null */ && (!strictNullChecks || target.flags & 4096 /* Null */)) return true; + if (source.flags & 32768 /* Object */ && target.flags & 16777216 /* NonPrimitive */) + return true; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & 1 /* Any */) return true; @@ -30946,12 +31147,12 @@ var ts; } if (source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */) { var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { return related === 1 /* Succeeded */; } } - if (source.flags & 507904 /* StructuredOrTypeParameter */ || target.flags & 507904 /* StructuredOrTypeParameter */) { + if (source.flags & 1032192 /* StructuredOrTypeVariable */ || target.flags & 1032192 /* StructuredOrTypeVariable */) { return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); } return false; @@ -31130,16 +31331,6 @@ var ts; } } } - else { - // Given a type parameter K with a constraint keyof T, a type S is - // assignable to K if S is assignable to keyof T. - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144 /* Index */) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; - } - } - } } else if (target.flags & 262144 /* Index */) { // A keyof S is related to a keyof T if T is related to S. @@ -31148,14 +31339,12 @@ var ts; return result; } } - // Given a type variable T with a constraint C, a type S is assignable to - // keyof T if S is assignable to keyof C. - if (target.type.flags & 540672 /* TypeVariable */) { - var constraint = getConstraintOfTypeVariable(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; - } + // A type S is assignable to keyof T if S is assignable to keyof C, where C is the + // constraint of T. + var constraint = getConstraintOfType(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; } } } @@ -31169,8 +31358,9 @@ var ts; } // A type S is related to a type T[K] if S is related to A[K], where K is string-like and // A is the apparent type of S. - if (target.constraint) { - if (result = isRelatedTo(source, target.constraint, reportErrors)) { + var constraint = getBaseConstraintOfType(target); + if (constraint) { + if (result = isRelatedTo(source, constraint, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -31188,24 +31378,28 @@ var ts; } else { var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1 /* Any */) { - constraint = emptyObjectType; - } - // The constraint may need to be further instantiated with its 'this' type. - constraint = getTypeWithThisArgument(constraint, source); - // 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; + // A type parameter with no constraint is not related to the non-primitive object type. + if (constraint || !(target.flags & 16777216 /* NonPrimitive */)) { + if (!constraint || constraint.flags & 1 /* Any */) { + constraint = emptyObjectType; + } + // The constraint may need to be further instantiated with its 'this' type. + constraint = getTypeWithThisArgument(constraint, source); + // 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 & 524288 /* IndexedAccess */) { // A type S[K] is related to a type T if A[K] is related to T, where K is string-like and // A is the apparent type of S. - if (source.constraint) { - if (result = isRelatedTo(source.constraint, target, reportErrors)) { + var constraint = getBaseConstraintOfType(source); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -31272,7 +31466,7 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) || + if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyResolvedType(resolved)) || resolved.stringIndexInfo || (resolved.numberIndexInfo && isNumericLiteralName(name)) || getPropertyOfType(type, name)) { @@ -31289,13 +31483,16 @@ var ts; } return false; } - function isEmptyObjectType(t) { + function isEmptyResolvedType(t) { return t.properties.length === 0 && t.callSignatures.length === 0 && t.constructSignatures.length === 0 && !t.stringIndexInfo && !t.numberIndexInfo; } + function isEmptyObjectType(type) { + return type.flags & 32768 /* Object */ && isEmptyResolvedType(resolveStructuredTypeMembers(type)); + } function hasExcessProperties(source, target, reportErrors) { if (maybeTypeOfKind(target, 32768 /* Object */) && !(getObjectFlags(target) & 512 /* ObjectLiteralPatternWithComputedProperties */)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { @@ -31409,12 +31606,12 @@ var ts; return 0 /* False */; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { if (reportErrors && related === 2 /* Failed */) { // We are elaborating errors and the cached result is an unreported failure. Record the result as a reported // failure and continue computing the relation such that errors get reported. - relation[id] = 3 /* FailedAndReported */; + relation.set(id, 3 /* FailedAndReported */); } else { return related === 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */; @@ -31423,7 +31620,7 @@ var ts; if (depth > 0) { for (var i = 0; i < depth; i++) { // If source and target are already being compared, consider them related with assumptions - if (maybeStack[i][id]) { + if (maybeStack[i].get(id)) { return 1 /* Maybe */; } } @@ -31441,7 +31638,7 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = ts.createMap(); - maybeStack[depth][id] = 1 /* Succeeded */; + maybeStack[depth].set(id, 1 /* Succeeded */); depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) @@ -31476,41 +31673,43 @@ var ts; var maybeCache = maybeStack[depth]; // If result is definitely true, copy assumptions to global cache, else copy to next level up var destinationCache = (result === -1 /* True */ || depth === 0) ? relation : maybeStack[depth - 1]; - ts.copyProperties(maybeCache, destinationCache); + ts.copyEntries(maybeCache, destinationCache); } else { // A false result goes straight into global cache (when something is false under assumptions it // will also be false without assumptions) - relation[id] = reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */; + relation.set(id, reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */); } return result; } - // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y. + // A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is + // related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice + // that S and T are contra-variant whereas X and Y are co-variant. function mappedTypeRelatedTo(source, target, reportErrors) { if (isGenericMappedType(target)) { if (isGenericMappedType(source)) { - var result_2; - if (relation === identityRelation) { - var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; - var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else { - if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); - } + var sourceReadonly = !!source.declaration.readonlyToken; + var sourceOptional = !!source.declaration.questionToken; + var targetReadonly = !!target.declaration.readonlyToken; + var targetOptional = !!target.declaration.questionToken; + var modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + var result_2; + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); } } } + else if (target.declaration.questionToken && isEmptyObjectType(source)) { + return -1 /* True */; + } } else if (relation !== identityRelation) { var resolved = resolveStructuredTypeMembers(target); - if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1 /* Any */) { + if (isEmptyResolvedType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1 /* Any */) { return -1 /* True */; } } @@ -31918,8 +32117,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var t = types_9[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -31927,8 +32126,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -32034,8 +32233,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; result |= getFalsyFlags(t); } return result; @@ -32103,7 +32302,7 @@ var ts; var property = _a[_i]; var original = getTypeOfSymbol(property); var updated = f(original); - members[property.name] = updated === original ? property : createTransientSymbol(property, updated); + members.set(property.name, updated === original ? property : createTransientSymbol(property, updated)); } ; return members; @@ -32205,25 +32404,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 144 /* Parameter */: + case 145 /* 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 174 /* BindingElement */: + case 175 /* BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -32328,7 +32527,7 @@ var ts; inferredProp.declarations = prop.declarations; inferredProp.type = inferredPropType; inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); - members[prop.name] = inferredProp; + members.set(prop.name, inferredProp); } if (indexInfo) { var inferredIndexType = inferTargetType(indexInfo.type); @@ -32502,10 +32701,10 @@ var ts; return; } var key = source.id + "," + target.id; - if (visited[key]) { + if (visited.get(key)) { return; } - visited[key] = true; + visited.set(key, true); if (depth === 0) { sourceStack = []; targetStack = []; @@ -32603,8 +32802,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -32701,10 +32900,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 160 /* TypeQuery */: + case 161 /* TypeQuery */: return true; case 70 /* Identifier */: - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: node = node.parent; continue; default: @@ -32725,7 +32924,7 @@ var ts; if (node.kind === 98 /* ThisKeyword */) { return "0"; } - if (node.kind === 177 /* PropertyAccessExpression */) { + if (node.kind === 178 /* PropertyAccessExpression */) { var key = getFlowCacheKey(node.expression); return key && key + "." + node.name.text; } @@ -32736,7 +32935,7 @@ var ts; case 70 /* Identifier */: case 98 /* ThisKeyword */: return node; - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return getLeftmostIdentifierOrThis(node.expression); } return undefined; @@ -32745,19 +32944,19 @@ var ts; switch (source.kind) { case 70 /* Identifier */: return target.kind === 70 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 224 /* VariableDeclaration */ || target.kind === 174 /* BindingElement */) && + (target.kind === 225 /* VariableDeclaration */ || target.kind === 175 /* BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98 /* ThisKeyword */: return target.kind === 98 /* ThisKeyword */; - case 177 /* PropertyAccessExpression */: - return target.kind === 177 /* PropertyAccessExpression */ && + case 178 /* PropertyAccessExpression */: + return target.kind === 178 /* PropertyAccessExpression */ && source.name.text === target.name.text && isMatchingReference(source.expression, target.expression); } return false; } function containsMatchingReference(source, target) { - while (source.kind === 177 /* PropertyAccessExpression */) { + while (source.kind === 178 /* PropertyAccessExpression */) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -32770,7 +32969,7 @@ var ts; // a possible discriminant if its type differs in the constituents of containing union type, and if every // choice is a unit type or a union of unit types. function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 177 /* PropertyAccessExpression */ && + return target.kind === 178 /* PropertyAccessExpression */ && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); } @@ -32778,7 +32977,7 @@ var ts; if (expr.kind === 70 /* Identifier */) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 177 /* PropertyAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.text); } @@ -32808,7 +33007,7 @@ var ts; } } } - if (callExpression.expression.kind === 177 /* PropertyAccessExpression */ && + if (callExpression.expression.kind === 178 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -32850,8 +33049,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0 /* None */; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; result |= getTypeFacts(t); } return result; @@ -32861,7 +33060,7 @@ var ts; // check. This gives us a quicker out in the common case where an object type is not a function. var resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || - resolved.members["bind"] && isTypeSubtypeOf(type, globalFunctionType)); + resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type) { var flags = type.flags; @@ -32904,6 +33103,9 @@ var ts; if (flags & 512 /* ESSymbol */) { return strictNullChecks ? 1981320 /* SymbolStrictFacts */ : 4193160 /* SymbolFacts */; } + if (flags & 16777216 /* NonPrimitive */) { + return strictNullChecks ? 6166480 /* ObjectStrictFacts */ : 8378320 /* ObjectFacts */; + } if (flags & 16384 /* TypeParameter */) { var constraint = getConstraintOfTypeParameter(type); return getTypeFacts(constraint || emptyObjectType); @@ -32939,7 +33141,7 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 258 /* PropertyAssignment */ ? + return node.parent.kind === 176 /* ArrayLiteralExpression */ || node.parent.kind === 259 /* PropertyAssignment */ ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } @@ -32958,21 +33160,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return stringType; - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return checkRightHandSideOfForOf(parent.expression) || unknownType; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return undefinedType; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -32980,7 +33182,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 172 /* ObjectBindingPattern */ ? + var type = pattern.kind === 173 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : @@ -32998,35 +33200,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 213 /* ForInStatement */) { + if (node.parent.parent.kind === 214 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 214 /* ForOfStatement */) { + if (node.parent.parent.kind === 215 /* ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 224 /* VariableDeclaration */ ? + return node.kind === 225 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 224 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */ ? + return node.kind === 225 /* VariableDeclaration */ || node.kind === 175 /* BindingElement */ ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 224 /* VariableDeclaration */ && node.initializer && + return node.kind === 225 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 174 /* BindingElement */ && node.parent.kind === 192 /* BinaryExpression */ && + node.kind !== 175 /* BindingElement */ && node.parent.kind === 193 /* BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (node.operatorToken.kind) { case 57 /* EqualsToken */: return getReferenceCandidate(node.left); @@ -33038,13 +33240,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 183 /* ParenthesizedExpression */ || - parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node || - parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ? + return parent.kind === 184 /* ParenthesizedExpression */ || + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node || + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 254 /* CaseClause */) { + if (clause.kind === 255 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -33159,8 +33361,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var t = types_13[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var t = types_14[_i]; if (!(t.flags & 8192 /* Never */)) { if (!(getObjectFlags(t) & 256 /* EvolvingArray */)) { return false; @@ -33183,11 +33385,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 177 /* PropertyAccessExpression */ && (parent.name.text === "length" || - parent.parent.kind === 179 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 178 /* ElementAccessExpression */ && + var isLengthPushOrUnshift = parent.kind === 178 /* PropertyAccessExpression */ && (parent.name.text === "length" || + parent.parent.kind === 180 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 179 /* ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 192 /* BinaryExpression */ && + parent.parent.kind === 193 /* BinaryExpression */ && parent.parent.operatorToken.kind === 57 /* EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -33216,7 +33418,7 @@ var ts; } function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) { var key; - if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215 /* Narrowable */)) { + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 17810431 /* Narrowable */)) { return declaredType; } var initialType = assumeInitialized ? declaredType : @@ -33230,7 +33432,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent.kind === 201 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) { + if (reference.parent.kind === 202 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) { return declaredType; } return resultType; @@ -33279,7 +33481,7 @@ var ts; else if (flow.flags & 2 /* Start */) { // Check if we should continue with the control flow of the containing function. var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 177 /* PropertyAccessExpression */) { + if (container && container !== flowContainer && reference.kind !== 178 /* PropertyAccessExpression */) { flow = container.flowNode; continue; } @@ -33333,7 +33535,7 @@ var ts; } function getTypeAtFlowArrayMutation(flow) { var node = flow.node; - var expr = node.kind === 179 /* CallExpression */ ? + var expr = node.kind === 180 /* CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -33341,7 +33543,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256 /* EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 179 /* CallExpression */) { + if (node.kind === 180 /* CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -33432,8 +33634,9 @@ var ts; if (!key) { key = getFlowCacheKey(reference); } - if (cache[key]) { - return cache[key]; + var cached = cache.get(key); + if (cached) { + return cached; } // If this flow loop junction and reference are already being processed, return // the union of the types computed for each branch so far, marked as incomplete. @@ -33468,8 +33671,9 @@ var ts; // If we see a value appear in the cache it is a sign that control flow analysis // was restarted and completed by checkExpressionCached. We can simply pick up // the resulting type and bail out. - if (cache[key]) { - return cache[key]; + var cached_1 = cache.get(key); + if (cached_1) { + return cached_1; } if (!ts.contains(antecedentTypes, type)) { antecedentTypes.push(type); @@ -33493,10 +33697,11 @@ var ts; if (isIncomplete(firstAntecedentType)) { return createFlowType(result, /*incomplete*/ true); } - return cache[key] = result; + cache.set(key, result); + return result; } function isMatchingReferenceDiscriminant(expr) { - return expr.kind === 177 /* PropertyAccessExpression */ && + return expr.kind === 178 /* PropertyAccessExpression */ && declaredType.flags & 65536 /* Union */ && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(declaredType, expr.name.text); @@ -33530,10 +33735,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 187 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) { + if (left_1.kind === 188 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 187 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) { + if (right_1.kind === 188 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -33579,7 +33784,7 @@ var ts; assumeTrue ? 16384 /* EQUndefined */ : 131072 /* NEUndefined */; return getTypeWithFacts(type, facts); } - if (type.flags & 33281 /* NotUnionOrUnit */) { + if (type.flags & 16810497 /* NotUnionOrUnit */) { return type; } if (assumeTrue) { @@ -33610,14 +33815,14 @@ var ts; // We narrow a non-union type to an exact primitive type if the non-union type // is a supertype of that primitive type. For example, type 'any' can be narrowed // to one of the primitive types. - var targetType = typeofTypesByName[literal.text]; + var targetType = typeofTypesByName.get(literal.text); if (targetType && isTypeSubtypeOf(targetType, type)) { return targetType; } } var facts = assumeTrue ? - typeofEQFacts[literal.text] || 64 /* TypeofEQHostObject */ : - typeofNEFacts[literal.text] || 8192 /* TypeofNEHostObject */; + typeofEQFacts.get(literal.text) || 64 /* TypeofEQHostObject */ : + typeofNEFacts.get(literal.text) || 8192 /* TypeofNEHostObject */; return getTypeWithFacts(type, facts); } function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { @@ -33732,7 +33937,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 178 /* ElementAccessExpression */ || invokedExpression.kind === 177 /* PropertyAccessExpression */) { + if (invokedExpression.kind === 179 /* ElementAccessExpression */ || invokedExpression.kind === 178 /* PropertyAccessExpression */) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -33751,15 +33956,15 @@ var ts; switch (expr.kind) { case 70 /* Identifier */: case 98 /* ThisKeyword */: - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: if (expr.operator === 50 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -33795,9 +34000,9 @@ var ts; while (true) { node = node.parent; if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 232 /* ModuleBlock */ || - node.kind === 262 /* SourceFile */ || - node.kind === 147 /* PropertyDeclaration */) { + node.kind === 233 /* ModuleBlock */ || + node.kind === 263 /* SourceFile */ || + node.kind === 148 /* PropertyDeclaration */) { return node; } } @@ -33829,7 +34034,7 @@ var ts; if (node.kind === 70 /* Identifier */) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144 /* Parameter */) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 145 /* Parameter */) { symbol.isAssigned = true; } } @@ -33855,7 +34060,7 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ES2015 */) { - if (container.kind === 185 /* ArrowFunction */) { + if (container.kind === 186 /* ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (ts.hasModifier(container, 256 /* Async */)) { @@ -33876,7 +34081,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration_1.kind === 227 /* ClassDeclaration */ + if (declaration_1.kind === 228 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -33888,14 +34093,14 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration_1.kind === 197 /* ClassExpression */) { + else if (declaration_1.kind === 198 /* ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); while (container !== undefined) { if (container.parent === declaration_1) { - if (container.kind === 147 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) { + if (container.kind === 148 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) { getNodeLinks(declaration_1).flags |= 8388608 /* ClassWithConstructorReference */; getNodeLinks(node).flags |= 16777216 /* ConstructorReferenceInClass */; } @@ -33930,15 +34135,15 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 144 /* Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 145 /* Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 184 /* FunctionExpression */ || - flowContainer.kind === 185 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 185 /* FunctionExpression */ || + flowContainer.kind === 186 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -33981,7 +34186,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 257 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 258 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -34006,8 +34211,8 @@ var ts; } // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. - if (container.kind === 212 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 225 /* VariableDeclarationList */).parent === container && + if (container.kind === 213 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 226 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -34021,7 +34226,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { var current = node; // skip parenthesized nodes - while (current.parent.kind === 183 /* ParenthesizedExpression */) { + while (current.parent.kind === 184 /* ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -34029,7 +34234,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 190 /* PrefixUnaryExpression */ || current.parent.kind === 191 /* PostfixUnaryExpression */)) { + else if ((current.parent.kind === 191 /* PrefixUnaryExpression */ || current.parent.kind === 192 /* PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 42 /* PlusPlusToken */ || expr.operator === 43 /* MinusMinusToken */; } @@ -34050,7 +34255,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 147 /* PropertyDeclaration */ || container.kind === 150 /* Constructor */) { + if (container.kind === 148 /* PropertyDeclaration */ || container.kind === 151 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -34118,36 +34323,36 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; - if (container.kind === 150 /* Constructor */) { + if (container.kind === 151 /* Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 185 /* ArrowFunction */) { + if (container.kind === 186 /* 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 /* ES2015 */); } switch (container.kind) { - case 231 /* ModuleDeclaration */: + case 232 /* 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 230 /* EnumDeclaration */: + case 231 /* 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 150 /* Constructor */: + case 151 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: if (ts.getModifierFlags(container) & 32 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -34159,7 +34364,7 @@ var ts; // Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated. // If this is a function in a JS file, it might be a class method. Check if it's the RHS // of a x.prototype.y = function [name]() { .... } - if (container.kind === 184 /* FunctionExpression */ && + if (container.kind === 185 /* FunctionExpression */ && ts.isInJavaScriptFile(container.parent) && ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') @@ -34196,28 +34401,28 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 275 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 276 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 278 /* JSDocThisType */) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 279 /* JSDocThisType */) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 144 /* Parameter */) { + if (n.kind === 145 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 179 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 180 /* CallExpression */ && node.parent.expression === node; var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var needToCaptureLexicalThis = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 185 /* ArrowFunction */) { + while (container && container.kind === 186 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */; } @@ -34231,16 +34436,16 @@ var ts; // [super.foo()]() {} // } var current = node; - while (current && current !== container && current.kind !== 142 /* ComputedPropertyName */) { + while (current && current !== container && current.kind !== 143 /* ComputedPropertyName */) { current = current.parent; } - if (current && current.kind === 142 /* ComputedPropertyName */) { + if (current && current.kind === 143 /* 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 if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 177 /* ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -34248,7 +34453,7 @@ var ts; } return unknownType; } - if (!isCallExpression && container.kind === 150 /* Constructor */) { + if (!isCallExpression && container.kind === 151 /* Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if ((ts.getModifierFlags(container) & 32 /* Static */) || isCallExpression) { @@ -34314,7 +34519,7 @@ var ts; // This helper creates an object with a "value" property that wraps the `super` property or indexed access for both get and set. // This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment // while a property access can. - if (container.kind === 149 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) { + if (container.kind === 150 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */; } @@ -34328,7 +34533,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 176 /* ObjectLiteralExpression */) { + if (container.parent.kind === 177 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -34348,7 +34553,7 @@ var ts; } return unknownType; } - if (container.kind === 150 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 151 /* 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; @@ -34363,7 +34568,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 150 /* Constructor */; + return container.kind === 151 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -34371,21 +34576,21 @@ var ts; // - 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 // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 177 /* ObjectLiteralExpression */) { if (ts.getModifierFlags(container) & 32 /* Static */) { - return container.kind === 149 /* MethodDeclaration */ || - container.kind === 148 /* MethodSignature */ || - container.kind === 151 /* GetAccessor */ || - container.kind === 152 /* SetAccessor */; + return container.kind === 150 /* MethodDeclaration */ || + container.kind === 149 /* MethodSignature */ || + container.kind === 152 /* GetAccessor */ || + container.kind === 153 /* SetAccessor */; } else { - return container.kind === 149 /* MethodDeclaration */ || - container.kind === 148 /* MethodSignature */ || - container.kind === 151 /* GetAccessor */ || - container.kind === 152 /* SetAccessor */ || - container.kind === 147 /* PropertyDeclaration */ || - container.kind === 146 /* PropertySignature */ || - container.kind === 150 /* Constructor */; + return container.kind === 150 /* MethodDeclaration */ || + container.kind === 149 /* MethodSignature */ || + container.kind === 152 /* GetAccessor */ || + container.kind === 153 /* SetAccessor */ || + container.kind === 148 /* PropertyDeclaration */ || + container.kind === 147 /* PropertySignature */ || + container.kind === 151 /* Constructor */; } } } @@ -34393,7 +34598,7 @@ var ts; } } function getContextualThisParameterType(func) { - if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185 /* ArrowFunction */) { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 186 /* ArrowFunction */) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { var thisParameter = contextualSignature.thisParameter; @@ -34409,23 +34614,23 @@ var ts; var func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var iife = ts.getImmediatelyInvokedFunctionExpression(func); - if (iife) { + if (iife && iife.arguments) { var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (iife.arguments && indexOfParameter < iife.arguments.length) { - if (parameter.dotDotDotToken) { - var restTypes = []; - for (var i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); - } - return createArrayType(getUnionType(restTypes)); - } - var links = getNodeLinks(iife); - var cached = links.resolvedSignature; - links.resolvedSignature = anySignature; - var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); - links.resolvedSignature = cached; - return type; - } + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); + } + return restTypes.length ? createArrayType(getUnionType(restTypes)) : undefined; + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = indexOfParameter < iife.arguments.length ? + getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : + parameter.initializer ? undefined : undefinedWideningType; + links.resolvedSignature = cached; + return type; } var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -34459,7 +34664,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 144 /* Parameter */) { + if (declaration.kind === 145 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -34470,11 +34675,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_19 = declaration.propertyName || declaration.name; + var name = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_19)) { - var text = ts.getTextOfPropertyName(name_19); + !ts.isBindingPattern(name)) { + var text = ts.getTextOfPropertyName(name); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -34511,7 +34716,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 144 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 145 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -34522,8 +34727,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 === 150 /* Constructor */ || - functionDecl.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152 /* SetAccessor */))) { + functionDecl.kind === 151 /* Constructor */ || + functionDecl.kind === 152 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 153 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -34545,7 +34750,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 181 /* TaggedTemplateExpression */) { + if (template.parent.kind === 182 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -34589,8 +34794,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -34673,13 +34878,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 251 /* JsxAttribute */) { + if (attribute.kind === 252 /* JsxAttribute */) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 252 /* JsxSpreadAttribute */) { + else if (attribute.kind === 253 /* JsxSpreadAttribute */) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -34717,41 +34922,41 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 224 /* VariableDeclaration */: - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 174 /* BindingElement */: + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 175 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 185 /* ArrowFunction */: - case 217 /* ReturnStatement */: + case 186 /* ArrowFunction */: + case 218 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 258 /* PropertyAssignment */: - case 259 /* ShorthandPropertyAssignment */: + case 259 /* PropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 203 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 194 /* TemplateExpression */); + case 204 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 195 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return getContextualType(parent); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return getContextualType(parent); - case 251 /* JsxAttribute */: - case 252 /* JsxSpreadAttribute */: + case 252 /* JsxAttribute */: + case 253 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -34783,7 +34988,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */; + return node.kind === 185 /* FunctionExpression */ || node.kind === 186 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -34802,7 +35007,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 !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; @@ -34812,8 +35017,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var current = types_15[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var current = types_16[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -34863,8 +35068,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function hasDefaultValue(node) { - return (node.kind === 174 /* BindingElement */ && !!node.initializer) || - (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */); + return (node.kind === 175 /* BindingElement */ && !!node.initializer) || + (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -34873,7 +35078,7 @@ var ts; var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 196 /* SpreadElement */) { + if (inDestructuringPattern && e.kind === 197 /* SpreadElement */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -34897,7 +35102,7 @@ var ts; var type = checkExpressionForMutableLocation(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 196 /* SpreadElement */; + hasSpreadElement = hasSpreadElement || e.kind === 197 /* SpreadElement */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -34912,7 +35117,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 173 /* ArrayBindingPattern */ || pattern.kind === 175 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 174 /* ArrayBindingPattern */ || pattern.kind === 176 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -34920,7 +35125,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 198 /* OmittedExpression */) { + if (patternElement.kind !== 199 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -34937,7 +35142,7 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 142 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 143 /* 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, @@ -35009,7 +35214,7 @@ var ts; var propagatedFlags = 0; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 172 /* ObjectBindingPattern */ || contextualType.pattern.kind === 176 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 173 /* ObjectBindingPattern */ || contextualType.pattern.kind === 177 /* ObjectLiteralExpression */); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -35018,18 +35223,18 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 258 /* PropertyAssignment */ || - memberDecl.kind === 259 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 259 /* PropertyAssignment */ || + memberDecl.kind === 260 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 258 /* PropertyAssignment */) { + if (memberDecl.kind === 259 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 149 /* MethodDeclaration */) { + else if (memberDecl.kind === 150 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 259 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 260 /* ShorthandPropertyAssignment */); type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -35037,8 +35242,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 258 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 259 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 259 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 260 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912 /* Optional */; } @@ -35066,12 +35271,12 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 260 /* SpreadAssignment */) { - if (languageVersion < 5 /* ESNext */) { + else if (memberDecl.kind === 261 /* SpreadAssignment */) { + if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; propertiesTable = ts.createMap(); hasComputedStringProperty = false; @@ -35083,7 +35288,7 @@ var ts; error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } - spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false); + spread = getSpreadType(spread, type); offset = i + 1; continue; } @@ -35093,7 +35298,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 === 151 /* GetAccessor */ || memberDecl.kind === 152 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 152 /* GetAccessor */ || memberDecl.kind === 153 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } if (ts.hasDynamicName(memberDecl)) { @@ -35105,7 +35310,7 @@ var ts; } } else { - propertiesTable[member.name] = member; + propertiesTable.set(member.name, member); } propertiesArray.push(member); } @@ -35114,18 +35319,18 @@ var ts; if (contextualTypeHasPattern) { for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; - if (!propertiesTable[prop.name]) { + if (!propertiesTable.get(prop.name)) { if (!(prop.flags & 536870912 /* Optional */)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable[prop.name] = prop; + propertiesTable.set(prop.name, prop); propertiesArray.push(prop); } } } if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + spread = getSpreadType(spread, createObjectLiteralType()); } if (spread.flags & 32768 /* Object */) { // only set the symbol and flags if this is a (fresh) object type @@ -35155,7 +35360,7 @@ var ts; } } function isValidSpreadType(type) { - return !!(type.flags & (1 /* Any */ | 4096 /* Null */ | 2048 /* Undefined */) || + return !!(type.flags & (1 /* Any */ | 4096 /* Null */ | 2048 /* Undefined */ | 16777216 /* NonPrimitive */) || type.flags & 32768 /* Object */ && !isGenericMappedType(type) || type.flags & 196608 /* UnionOrIntersection */ && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); } @@ -35177,13 +35382,13 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: checkJsxExpression(child); break; - case 247 /* JsxElement */: + case 248 /* JsxElement */: checkJsxElement(child); break; - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; } @@ -35202,7 +35407,7 @@ var ts; */ function isJsxIntrinsicIdentifier(tagName) { // TODO (yuisu): comment - if (tagName.kind === 177 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) { + if (tagName.kind === 178 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) { return false; } else { @@ -35211,6 +35416,15 @@ var ts; } function checkJsxAttribute(node, elementAttributesType, nameTable) { var correspondingPropType = undefined; + // We need to unconditionally get the expression type + var exprType; + if (node.initializer) { + exprType = checkExpression(node.initializer); + } + else { + // is sugar for + exprType = booleanType; + } // Look up the corresponding property for this attribute if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) { // If there is no 'props' property, you may not have non-"data-" attributes @@ -35233,18 +35447,10 @@ var ts; } } } - var exprType; - if (node.initializer) { - exprType = checkExpression(node.initializer); - } - else { - // is sugar for - exprType = booleanType; - } if (correspondingPropType) { checkTypeAssignableTo(exprType, correspondingPropType, node); } - nameTable[node.name.text] = true; + nameTable.set(node.name.text, true); return exprType; } function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { @@ -35257,22 +35463,23 @@ var ts; var prop = props_2[_i]; // Is there a corresponding property in the element attributes type? Skip checking of properties // that have already been assigned to, as these are not actually pushed into the resulting type - if (!nameTable[prop.name]) { + if (!nameTable.get(prop.name)) { var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); if (targetPropSym) { var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); } - nameTable[prop.name] = true; + nameTable.set(prop.name, true); } } return type; } function getJsxType(name) { - if (jsxTypes[name] === undefined) { - return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + var jsxType = jsxTypes.get(name); + if (jsxType === undefined) { + jsxTypes.set(name, jsxType = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } - return jsxTypes[name]; + return jsxType; } /** * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic @@ -35558,11 +35765,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 === 251 /* JsxAttribute */) { + if (node.attributes[i].kind === 252 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 252 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 253 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -35573,10 +35780,10 @@ var ts; // was spreaded in, though, assume that it provided all required properties if (targetAttributesType && !sawSpreadedAny) { var targetProperties = getPropertiesOfType(targetAttributesType); - for (var i = 0; i < targetProperties.length; i++) { - if (!(targetProperties[i].flags & 536870912 /* Optional */) && - !nameTable[targetProperties[i].name]) { - error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); + for (var _i = 0, targetProperties_1 = targetProperties; _i < targetProperties_1.length; _i++) { + var targetProperty = targetProperties_1[_i]; + if (!(targetProperty.flags & 536870912 /* Optional */) && !nameTable.get(targetProperty.name)) { + error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperty.name, typeToString(targetAttributesType)); } } } @@ -35596,7 +35803,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 : 147 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 148 /* PropertyDeclaration */; } function getDeclarationModifierFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0; @@ -35615,7 +35822,7 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 /* PropertyAccessExpression */ || node.kind === 224 /* VariableDeclaration */ ? + var errorNode = node.kind === 178 /* PropertyAccessExpression */ || node.kind === 225 /* VariableDeclaration */ ? node.name : node.right; if (left.kind === 96 /* SuperKeyword */) { @@ -35626,11 +35833,14 @@ 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 (languageVersion < 2 /* ES2015 */ && getDeclarationKindFromSymbol(prop) !== 149 /* 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); - return false; + if (languageVersion < 2 /* ES2015 */) { + var propKind = getDeclarationKindFromSymbol(prop); + if (propKind !== 150 /* MethodDeclaration */ && propKind !== 149 /* MethodSignature */) { + // `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); + return false; + } } if (flags & 128 /* Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. @@ -35687,16 +35897,17 @@ var ts; return true; } function checkNonNullExpression(node) { - var type = checkExpression(node); - if (strictNullChecks) { - var kind = getFalsyFlags(type) & 6144 /* Nullable */; - if (kind) { - error(node, kind & 2048 /* Undefined */ ? kind & 4096 /* Null */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); - } - return getNonNullableType(type); + return checkNonNullType(checkExpression(node), node); + } + function checkNonNullType(type, errorNode) { + var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 6144 /* Nullable */; + if (kind) { + error(errorNode, kind & 2048 /* Undefined */ ? kind & 4096 /* Null */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + var t = getNonNullableType(type); + return t.flags & (6144 /* Nullable */ | 8192 /* Never */) ? unknownType : t; } return type; } @@ -35745,6 +35956,10 @@ var ts; } var prop = getPropertyOfType(apparentType, right.text); if (!prop) { + var stringIndexType = getIndexTypeOfType(apparentType, 0 /* String */); + if (stringIndexType) { + return stringIndexType; + } if (right.text && !checkAndReportErrorForExtendingInterface(node)) { reportNonexistentProperty(right, type.flags & 16384 /* TypeParameter */ && type.isThisType ? apparentType : type); } @@ -35766,7 +35981,7 @@ var ts; // Only compute control flow type if this is a property access expression that isn't an // assignment target, and the referenced property was declared as a variable, property, // accessor, or optional method. - if (node.kind !== 177 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || + if (node.kind !== 178 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 65536 /* Union */)) { return propType; @@ -35775,7 +35990,7 @@ var ts; return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 177 /* PropertyAccessExpression */ + var left = node.kind === 178 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); @@ -35792,7 +36007,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 225 /* VariableDeclarationList */) { + if (initializer.kind === 226 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -35821,7 +36036,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 213 /* ForInStatement */ && + if (node.kind === 214 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -35839,7 +36054,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 180 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 181 /* 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); @@ -35859,7 +36074,7 @@ var ts; error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } - return getIndexedAccessType(objectType, indexType, node); + return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node); } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) { @@ -35897,10 +36112,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 145 /* Decorator */) { + else if (node.kind !== 146 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -35930,13 +36145,13 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_9 = signature.declaration && signature.declaration.parent; + var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_9 === lastParent) { + if (lastParent && parent === lastParent) { index++; } else { - lastParent = parent_9; + lastParent = parent; index = cutoffIndex; } } @@ -35944,7 +36159,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_9; + lastParent = parent; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -35966,7 +36181,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 196 /* SpreadElement */) { + if (arg && arg.kind === 197 /* SpreadElement */) { return i; } } @@ -35979,13 +36194,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 === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* 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 argCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 194 /* TemplateExpression */) { + if (tagExpression.template.kind === 195 /* 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; @@ -36002,7 +36217,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 145 /* Decorator */) { + else if (node.kind === 146 /* Decorator */) { isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); @@ -36011,7 +36226,7 @@ var ts; var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 180 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 181 /* NewExpression */); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -36095,7 +36310,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 !== 198 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 199 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); // If the effective argument type is 'undefined', there is no synthetic type @@ -36152,7 +36367,7 @@ var ts; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 180 /* NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 181 /* NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -36169,7 +36384,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 !== 198 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 199 /* 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); @@ -36191,12 +36406,12 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - if (node.kind === 179 /* CallExpression */) { + if (node.kind === 180 /* CallExpression */) { var callee = node.expression; - if (callee.kind === 177 /* PropertyAccessExpression */) { + if (callee.kind === 178 /* PropertyAccessExpression */) { return callee.expression; } - else if (callee.kind === 178 /* ElementAccessExpression */) { + else if (callee.kind === 179 /* ElementAccessExpression */) { return callee.expression; } } @@ -36212,16 +36427,16 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 194 /* TemplateExpression */) { + if (template.kind === 195 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 145 /* Decorator */) { + else if (node.kind === 146 /* 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. @@ -36246,19 +36461,19 @@ var ts; * Otherwise, the argument count is the length of the 'args' array. */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { switch (node.parent.kind) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts) // If we are emitting decorators for ES3, we will only pass two arguments. @@ -36268,7 +36483,7 @@ var 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 144 /* Parameter */: + case 145 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -36292,25 +36507,25 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 227 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { // 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); } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* 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 @@ -36337,21 +36552,21 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 227 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { node = node.parent; - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* 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 @@ -36362,7 +36577,7 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return getLiteralTypeForText(32 /* StringLiteral */, element.name.text); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 512 /* ESSymbol */)) { return nameType; @@ -36388,21 +36603,21 @@ var ts; function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a parameter decorator - if (node.kind === 227 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { // The `parameterIndex` for a parameter decorator is always a number return numberType; } - if (node.kind === 147 /* PropertyDeclaration */) { + if (node.kind === 148 /* PropertyDeclaration */) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -36434,10 +36649,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 === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */) { return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' @@ -36449,8 +36664,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 === 145 /* Decorator */ || - (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */)) { + if (node.kind === 146 /* Decorator */ || + (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -36459,11 +36674,11 @@ var ts; * Gets the error node to use when reporting errors for an effective argument. */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -36472,8 +36687,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 181 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 145 /* Decorator */; + var isTaggedTemplate = node.kind === 182 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 146 /* Decorator */; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -36544,7 +36759,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 /* CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 180 /* CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -36893,16 +37108,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 144 /* Parameter */: + case 145 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -36932,13 +37147,13 @@ var ts; } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 179 /* CallExpression */: + case 180 /* CallExpression */: return resolveCallExpression(node, candidatesOutArray); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return resolveNewExpression(node, candidatesOutArray); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray); - case 145 /* Decorator */: + case 146 /* Decorator */: return resolveDecorator(node, candidatesOutArray); } ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); @@ -36987,12 +37202,12 @@ var ts; if (node.expression.kind === 96 /* SuperKeyword */) { return voidType; } - if (node.kind === 180 /* NewExpression */) { + if (node.kind === 181 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 150 /* Constructor */ && - declaration.kind !== 154 /* ConstructSignature */ && - declaration.kind !== 159 /* ConstructorType */ && + declaration.kind !== 151 /* Constructor */ && + declaration.kind !== 155 /* ConstructSignature */ && + declaration.kind !== 160 /* ConstructorType */ && !ts.isJSDocConstructSignature(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any, unless // the declaring function had members created through 'x.prototype.y = expr' or 'this.y = expr' psuedodeclarations @@ -37032,9 +37247,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 226 /* FunctionDeclaration */ + ? 227 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 224 /* VariableDeclaration */ + ? 225 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -37069,7 +37284,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return unknownType; } - else if (container.kind === 150 /* Constructor */) { + else if (container.kind === 151 /* Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -37148,8 +37363,8 @@ var ts; links.type = instantiateType(contextualType, mapper); // if inference didn't come up with anything but {}, fall back to the binding pattern if present. if (links.type === emptyObjectType && - (parameter.valueDeclaration.name.kind === 172 /* ObjectBindingPattern */ || - parameter.valueDeclaration.name.kind === 173 /* ArrayBindingPattern */)) { + (parameter.valueDeclaration.name.kind === 173 /* ObjectBindingPattern */ || + parameter.valueDeclaration.name.kind === 174 /* ArrayBindingPattern */)) { links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); } assignBindingElementTypes(parameter.valueDeclaration); @@ -37219,7 +37434,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 205 /* Block */) { + if (func.body.kind !== 206 /* 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 @@ -37309,7 +37524,7 @@ var ts; return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 219 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 220 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; @@ -37342,7 +37557,7 @@ var ts; } }); if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || - func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */)) { + func.kind === 185 /* FunctionExpression */ || func.kind === 186 /* ArrowFunction */)) { return undefined; } if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) { @@ -37371,7 +37586,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (ts.nodeIsMissing(func.body) || func.body.kind !== 205 /* Block */ || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 206 /* Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */; @@ -37404,10 +37619,10 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 184 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 185 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -37448,7 +37663,7 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 149 /* MethodDeclaration */) { + if (produceDiagnostics && node.kind !== 150 /* MethodDeclaration */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithCapturedNewTargetVariable(node, node.name); @@ -37456,7 +37671,7 @@ var ts; return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); if (!node.asteriskToken) { @@ -37472,7 +37687,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 205 /* Block */) { + if (node.body.kind === 206 /* Block */) { checkSourceElement(node.body); } else { @@ -37519,11 +37734,11 @@ var ts; if (isReadonlySymbol(symbol)) { // Allow assignments to readonly properties within constructors of the same class declaration. if (symbol.flags & 4 /* Property */ && - (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) && + (expr.kind === 178 /* PropertyAccessExpression */ || expr.kind === 179 /* ElementAccessExpression */) && expr.expression.kind === 98 /* ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 150 /* Constructor */)) + if (!(func && func.kind === 151 /* Constructor */)) return true; // If func.parent is a class and symbol is a (readonly) property of that class, or // if func is a constructor and symbol is a (readonly) parameter property declared in it, @@ -37535,13 +37750,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */ || expr.kind === 179 /* ElementAccessExpression */) { var node = ts.skipParentheses(expr.expression); if (node.kind === 70 /* Identifier */) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 238 /* NamespaceImport */; + return declaration && declaration.kind === 239 /* NamespaceImport */; } } } @@ -37550,7 +37765,7 @@ var ts; function checkReferenceExpression(expr, invalidReferenceMessage) { // References are combinations of identifiers, parentheses, and property accesses. var node = ts.skipParentheses(expr); - if (node.kind !== 70 /* Identifier */ && node.kind !== 177 /* PropertyAccessExpression */ && node.kind !== 178 /* ElementAccessExpression */) { + if (node.kind !== 70 /* Identifier */ && node.kind !== 178 /* PropertyAccessExpression */ && node.kind !== 179 /* ElementAccessExpression */) { error(expr, invalidReferenceMessage); return false; } @@ -37559,7 +37774,7 @@ var ts; function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); - if (expr.kind !== 177 /* PropertyAccessExpression */ && expr.kind !== 178 /* ElementAccessExpression */) { + if (expr.kind !== 178 /* PropertyAccessExpression */ && expr.kind !== 179 /* ElementAccessExpression */) { error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } @@ -37603,6 +37818,7 @@ var ts; case 36 /* PlusToken */: case 37 /* MinusToken */: case 51 /* TildeToken */: + checkNonNullType(operandType, node.operand); if (maybeTypeOfKind(operandType, 512 /* ESSymbol */)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } @@ -37614,7 +37830,7 @@ var ts; booleanType; case 42 /* PlusPlusToken */: case 43 /* MinusMinusToken */: - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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 checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); @@ -37628,7 +37844,7 @@ var ts; if (operandType === silentNeverType) { return silentNeverType; } - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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 checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); @@ -37643,8 +37859,8 @@ var ts; } if (type.flags & 196608 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var t = types_17[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -37661,8 +37877,8 @@ var ts; } if (type.flags & 65536 /* Union */) { var types = type.types; - for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { - var t = types_17[_i]; + for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { + var t = types_18[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -37671,8 +37887,8 @@ var ts; } if (type.flags & 131072 /* Intersection */) { var types = type.types; - for (var _a = 0, types_18 = types; _a < types_18.length; _a++) { - var t = types_18[_a]; + for (var _a = 0, types_19 = types; _a < types_19.length; _a++) { + var t = types_19[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -37692,14 +37908,17 @@ var ts; } // TypeScript 1.0 spec (April 2014): 4.15.4 // The instanceof operator requires the left operand to be of type Any, an object type, or a type parameter type, - // and the right operand to be of type Any or a subtype of the 'Function' interface type. + // and the right operand to be of type Any, a subtype of the 'Function' interface type, or have a call or construct signature. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported if (isTypeOfKind(leftType, 8190 /* Primitive */)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported - if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(isTypeAny(rightType) || + getSignaturesOfType(rightType, 0 /* Call */).length || + getSignaturesOfType(rightType, 1 /* Construct */).length || + isTypeSubtypeOf(rightType, globalFunctionType))) { error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; @@ -37708,6 +37927,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); // TypeScript 1.0 spec (April 2014): 4.15.5 // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. @@ -37730,22 +37951,22 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 258 /* PropertyAssignment */ || property.kind === 259 /* ShorthandPropertyAssignment */) { - var name_20 = property.name; - if (name_20.kind === 142 /* ComputedPropertyName */) { - checkComputedPropertyName(name_20); + if (property.kind === 259 /* PropertyAssignment */ || property.kind === 260 /* ShorthandPropertyAssignment */) { + var name = property.name; + if (name.kind === 143 /* ComputedPropertyName */) { + checkComputedPropertyName(name); } - if (isComputedNonLiteralName(name_20)) { + if (isComputedNonLiteralName(name)) { return undefined; } - var text = ts.getTextOfPropertyName(name_20); + var text = ts.getTextOfPropertyName(name); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 259 /* ShorthandPropertyAssignment */) { + if (property.kind === 260 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -37754,10 +37975,10 @@ var ts; } } else { - error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 260 /* SpreadAssignment */) { + else if (property.kind === 261 /* SpreadAssignment */) { if (languageVersion < 5 /* ESNext */) { checkExternalEmitHelpers(property, 4 /* Rest */); } @@ -37788,8 +38009,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 198 /* OmittedExpression */) { - if (element.kind !== 196 /* SpreadElement */) { + if (element.kind !== 199 /* OmittedExpression */) { + if (element.kind !== 197 /* SpreadElement */) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -37817,7 +38038,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 192 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) { + if (restExpression.kind === 193 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -37830,7 +38051,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 259 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 260 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -37846,21 +38067,21 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 192 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) { + if (target.kind === 193 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 176 /* ObjectLiteralExpression */) { + if (target.kind === 177 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 175 /* ArrayLiteralExpression */) { + if (target.kind === 176 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 260 /* SpreadAssignment */ ? + var error = target.parent.kind === 261 /* SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -37882,35 +38103,35 @@ var ts; case 70 /* Identifier */: case 9 /* StringLiteral */: case 11 /* RegularExpressionLiteral */: - case 181 /* TaggedTemplateExpression */: - case 194 /* TemplateExpression */: + case 182 /* TaggedTemplateExpression */: + case 195 /* TemplateExpression */: case 12 /* NoSubstitutionTemplateLiteral */: case 8 /* NumericLiteral */: case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: case 94 /* NullKeyword */: - case 137 /* UndefinedKeyword */: - case 184 /* FunctionExpression */: - case 197 /* ClassExpression */: - case 185 /* ArrowFunction */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 187 /* TypeOfExpression */: - case 201 /* NonNullExpression */: - case 248 /* JsxSelfClosingElement */: - case 247 /* JsxElement */: + case 138 /* UndefinedKeyword */: + case 185 /* FunctionExpression */: + case 198 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 188 /* TypeOfExpression */: + case 202 /* NonNullExpression */: + case 249 /* JsxSelfClosingElement */: + case 248 /* JsxElement */: return true; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -37922,9 +38143,9 @@ var ts; } return false; // Some forms listed here for clarity - case 188 /* VoidExpression */: // Explicit opt-out - case 182 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 200 /* AsExpression */: // Not SEF, but can produce useful type warnings + case 189 /* VoidExpression */: // Explicit opt-out + case 183 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 201 /* AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -37944,7 +38165,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 57 /* EqualsToken */ && (left.kind === 176 /* ObjectLiteralExpression */ || left.kind === 175 /* ArrayLiteralExpression */)) { + if (operator === 57 /* EqualsToken */ && (left.kind === 177 /* ObjectLiteralExpression */ || left.kind === 176 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -37975,18 +38196,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - // TypeScript 1.0 spec (April 2014): 4.19.1 - // These operators require their operands to be of type Any, the Number primitive type, - // or an enum type. Operands of an enum type are treated - // as having the primitive type Number. If one operand is the null or undefined value, - // it is treated as having the type of the other operand. - // The result is always of the Number primitive type. - if (leftType.flags & 6144 /* Nullable */) - leftType = rightType; - if (rightType.flags & 6144 /* Nullable */) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); var suggestedOperator = void 0; // if a user tries to apply a bitwise operator to 2 boolean operands // try and return them a helpful suggestion @@ -38009,16 +38220,10 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - // TypeScript 1.0 spec (April 2014): 4.19.2 - // The binary + operator requires both operands to be of the Number primitive type or an enum type, - // or at least one of the operands to be of type Any or the String primitive type. - // If one operand is the null or undefined value, it is treated as having the type of the other operand. - if (leftType.flags & 6144 /* Nullable */) - leftType = rightType; - if (rightType.flags & 6144 /* Nullable */) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + if (!isTypeOfKind(leftType, 1 /* Any */ | 262178 /* StringLike */) && !isTypeOfKind(rightType, 1 /* Any */ | 262178 /* StringLike */)) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } var resultType = void 0; if (isTypeOfKind(leftType, 340 /* NumberLike */) && isTypeOfKind(rightType, 340 /* NumberLike */)) { // Operands of an enum type are treated as having the primitive type Number. @@ -38053,8 +38258,8 @@ var ts; case 29 /* LessThanEqualsToken */: case 30 /* GreaterThanEqualsToken */: if (checkForDisallowedESSymbolOperand(operator)) { - leftType = getBaseTypeOfLiteralType(leftType); - rightType = getBaseTypeOfLiteralType(rightType); + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -38246,7 +38451,7 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 182 /* TypeAssertionExpression */ || node.kind === 200 /* AsExpression */; + return node.kind === 183 /* TypeAssertionExpression */ || node.kind === 201 /* AsExpression */; } function checkDeclarationInitializer(declaration) { var type = checkExpressionCached(declaration.initializer); @@ -38257,14 +38462,14 @@ var ts; function isLiteralContextualType(contextualType) { if (contextualType) { if (contextualType.flags & 540672 /* TypeVariable */) { - var apparentType = getApparentTypeOfTypeVariable(contextualType); + var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; // If the type parameter is constrained to the base primitive type we're checking for, // consider this a literal context. For example, given a type parameter 'T extends string', // this causes us to infer string literal types for T. - if (apparentType.flags & (2 /* String */ | 4 /* Number */ | 8 /* Boolean */ | 16 /* Enum */)) { + if (constraint.flags & (2 /* String */ | 4 /* Number */ | 8 /* Boolean */ | 16 /* Enum */)) { return true; } - contextualType = apparentType; + contextualType = constraint; } return maybeTypeOfKind(contextualType, (480 /* Literal */ | 262144 /* Index */)); } @@ -38278,7 +38483,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 === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, contextualMapper); @@ -38289,7 +38494,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 === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -38315,7 +38520,7 @@ var ts; function getTypeOfExpression(node) { // Optimize for the common case of a call to a function with a single non-generic call // signature where we can just fetch the return type without checking the arguments. - if (node.kind === 179 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */) { + if (node.kind === 180 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -38336,7 +38541,7 @@ var ts; // contextually typed function and arrow expressions in the initial phase. function checkExpression(node, contextualMapper) { var type; - if (node.kind === 141 /* QualifiedName */) { + if (node.kind === 142 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -38348,9 +38553,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 70 /* Identifier */ || node.kind === 142 /* 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); } @@ -38372,68 +38577,68 @@ var ts; case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: return checkLiteralExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return checkTemplateExpression(node); case 12 /* NoSubstitutionTemplateLiteral */: return stringType; case 11 /* RegularExpressionLiteral */: return globalRegExpType; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return checkCallExpression(node); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return checkClassExpression(node); - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: return checkAssertion(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return checkNonNullAssertion(node); - case 202 /* MetaProperty */: + case 203 /* MetaProperty */: return checkMetaProperty(node); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return checkDeleteExpression(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return checkVoidExpression(node); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return checkAwaitExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return checkSpreadExpression(node, contextualMapper); - case 198 /* OmittedExpression */: + case 199 /* OmittedExpression */: return undefinedWideningType; - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return checkYieldExpression(node); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return checkJsxExpression(node); - case 247 /* JsxElement */: + case 248 /* JsxElement */: return checkJsxElement(node); - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 249 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -38445,6 +38650,10 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!hasNonCircularBaseConstraint(typeParameter)) { + error(node.constraint, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + } getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); if (produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); @@ -38461,7 +38670,7 @@ var ts; var func = ts.getContainingFunction(node); if (ts.getModifierFlags(node) & 92 /* ParameterPropertyModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 150 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 151 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -38472,7 +38681,7 @@ var ts; if (ts.indexOf(func.parameters, node) !== 0) { error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); } - if (func.kind === 150 /* Constructor */ || func.kind === 154 /* ConstructSignature */ || func.kind === 159 /* ConstructorType */) { + if (func.kind === 151 /* Constructor */ || func.kind === 155 /* ConstructSignature */ || func.kind === 160 /* ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } } @@ -38486,9 +38695,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 149 /* MethodDeclaration */ || - node.kind === 226 /* FunctionDeclaration */ || - node.kind === 184 /* FunctionExpression */; + return node.kind === 150 /* MethodDeclaration */ || + node.kind === 227 /* FunctionDeclaration */ || + node.kind === 185 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -38531,9 +38740,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_21 = _a[_i].name; - if (ts.isBindingPattern(name_21) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) { + var name = _a[_i].name; + if (ts.isBindingPattern(name) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -38546,16 +38755,16 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 185 /* ArrowFunction */: - case 153 /* CallSignature */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 158 /* FunctionType */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - var parent_10 = node.parent; - if (node === parent_10.type) { - return parent_10; + case 186 /* ArrowFunction */: + case 154 /* CallSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 159 /* FunctionType */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + var parent = node.parent; + if (node === parent.type) { + return parent; } } } @@ -38565,15 +38774,15 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_22 = element.name; - if (name_22.kind === 70 /* Identifier */ && - name_22.text === predicateVariableName) { + var name = element.name; + if (name.kind === 70 /* Identifier */ && + name.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_22.kind === 173 /* ArrayBindingPattern */ || - name_22.kind === 172 /* ObjectBindingPattern */) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) { + else if (name.kind === 174 /* ArrayBindingPattern */ || + name.kind === 173 /* ObjectBindingPattern */) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } } @@ -38581,12 +38790,12 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 /* FunctionType */ || node.kind === 226 /* FunctionDeclaration */ || node.kind === 159 /* ConstructorType */ || - node.kind === 153 /* CallSignature */ || node.kind === 150 /* Constructor */ || - node.kind === 154 /* ConstructSignature */) { + else if (node.kind === 159 /* FunctionType */ || node.kind === 227 /* FunctionDeclaration */ || node.kind === 160 /* ConstructorType */ || + node.kind === 154 /* CallSignature */ || node.kind === 151 /* Constructor */ || + node.kind === 155 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } if (ts.isAsyncFunctionLike(node) && languageVersion < 4 /* ES2017 */) { @@ -38604,10 +38813,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 153 /* CallSignature */: + case 154 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -38650,7 +38859,7 @@ var ts; var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150 /* Constructor */) { + if (member.kind === 151 /* Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param)) { @@ -38659,18 +38868,18 @@ var ts; } } else { - var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114 /* StaticKeyword */; }); + var isStatic = ts.getModifierFlags(member) & 32 /* Static */; var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { switch (member.kind) { - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: addName(names, member.name, memberName, 1 /* Getter */); break; - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: addName(names, member.name, memberName, 2 /* Setter */); break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: addName(names, member.name, memberName, 3 /* Property */); break; } @@ -38678,17 +38887,49 @@ var ts; } } function addName(names, location, name, meaning) { - var prev = names[name]; + var prev = names.get(name); if (prev) { if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { - names[name] = prev | meaning; + names.set(name, prev | meaning); } } else { - names[name] = meaning; + names.set(name, meaning); + } + } + } + /** + * Static members being set on a constructor function may conflict with built-in properties + * of Function. Esp. in ECMAScript 5 there are non-configurable and non-writable + * built-in properties. This check issues a transpile error when a class has a static + * member with the same name as a non-writable built-in property. + * + * @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.3 + * @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.5 + * @see http://www.ecma-international.org/ecma-262/6.0/#sec-properties-of-the-function-constructor + * @see http://www.ecma-international.org/ecma-262/6.0/#sec-function-instances + */ + function checkClassForStaticPropertyNameConflicts(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var memberNameNode = member.name; + var isStatic = ts.getModifierFlags(member) & 32 /* Static */; + if (isStatic && memberNameNode) { + var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); + switch (memberName) { + case "name": + case "length": + case "caller": + case "arguments": + case "prototype": + var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; + var className = getNameOfSymbol(getSymbolOfNode(node)); + error(memberNameNode, message, memberName, className); + break; + } } } } @@ -38696,7 +38937,7 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind == 146 /* PropertySignature */) { + if (member.kind == 147 /* PropertySignature */) { var memberName = void 0; switch (member.name.kind) { case 9 /* StringLiteral */: @@ -38707,18 +38948,18 @@ var ts; default: continue; } - if (names[memberName]) { + if (names.get(memberName)) { error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName); error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName); } else { - names[memberName] = true; + names.set(memberName, true); } } } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 228 /* InterfaceDeclaration */) { + if (node.kind === 229 /* 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 @@ -38738,7 +38979,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -38814,12 +39055,12 @@ var ts; if (n.kind === 98 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 /* FunctionExpression */ && n.kind !== 226 /* FunctionDeclaration */) { + else if (n.kind !== 185 /* FunctionExpression */ && n.kind !== 227 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 147 /* PropertyDeclaration */ && + return n.kind === 148 /* PropertyDeclaration */ && !(ts.getModifierFlags(n) & 32 /* Static */) && !!n.initializer; } @@ -38849,7 +39090,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -38873,7 +39114,7 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 151 /* GetAccessor */) { + if (node.kind === 152 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) { if (!(node.flags & 256 /* HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -38883,13 +39124,13 @@ 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 === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } 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 === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */; + var otherKind = node.kind === 152 /* GetAccessor */ ? 153 /* SetAccessor */ : 152 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if ((ts.getModifierFlags(node) & 28 /* AccessibilityModifier */) !== (ts.getModifierFlags(otherAccessor) & 28 /* AccessibilityModifier */)) { @@ -38905,11 +39146,11 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 151 /* GetAccessor */) { + if (node.kind === 152 /* GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } - if (node.parent.kind !== 176 /* ObjectLiteralExpression */) { + if (node.parent.kind !== 177 /* ObjectLiteralExpression */) { checkSourceElement(node.body); registerForUnusedIdentifiersCheck(node); } @@ -38992,16 +39233,36 @@ var ts; function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement); } + function checkIndexedAccessIndexType(type, accessNode) { + if (!(type.flags & 524288 /* IndexedAccess */)) { + return type; + } + // Check if the index type is assignable to 'keyof T' for the object type. + var objectType = type.objectType; + var indexType = type.indexType; + if (isTypeAssignableTo(indexType, getIndexType(objectType))) { + return type; + } + // Check if we're indexing with a numeric type and the object type is a generic + // type with a constraint that has a numeric index signature. + if (maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && isTypeOfKind(indexType, 340 /* NumberLike */)) { + var constraint = getBaseConstraintOfType(objectType); + if (constraint && getIndexInfoOfType(constraint, 1 /* Number */)) { + return type; + } + } + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return type; + } function checkIndexedAccessType(node) { - getTypeFromIndexedAccessTypeNode(node); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node) { checkSourceElement(node.typeParameter); checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 540672 /* TypeVariable */ ? getApparentTypeOfTypeVariable(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8 /* Private */) && ts.isInAmbientContext(node); @@ -39010,9 +39271,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 228 /* InterfaceDeclaration */ && - n.parent.kind !== 227 /* ClassDeclaration */ && - n.parent.kind !== 197 /* ClassExpression */ && + if (n.parent.kind !== 229 /* InterfaceDeclaration */ && + n.parent.kind !== 228 /* ClassDeclaration */ && + n.parent.kind !== 198 /* ClassExpression */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported @@ -39100,7 +39361,7 @@ var ts; var errorNode_1 = subsequentNode.name || subsequentNode; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - var reportError = (node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */) && + var reportError = (node.kind === 150 /* MethodDeclaration */ || node.kind === 149 /* MethodSignature */) && (ts.getModifierFlags(node) & 32 /* Static */) !== (ts.getModifierFlags(subsequentNode) & 32 /* Static */); // we can get here in two cases // 1. mixed static and instance class members @@ -39139,7 +39400,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 228 /* InterfaceDeclaration */ || node.parent.kind === 161 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 229 /* InterfaceDeclaration */ || node.parent.kind === 162 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -39150,7 +39411,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 === 226 /* FunctionDeclaration */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */ || node.kind === 150 /* Constructor */) { + if (node.kind === 227 /* FunctionDeclaration */ || node.kind === 150 /* MethodDeclaration */ || node.kind === 149 /* MethodSignature */ || node.kind === 151 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -39272,16 +39533,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -39545,22 +39806,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 144 /* Parameter */: + case 145 /* 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 147 /* PropertyDeclaration */: + case 148 /* 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 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -39601,14 +39862,14 @@ var ts; } var firstDecorator = node.decorators[0]; checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */); - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -39617,19 +39878,19 @@ var ts; } } break; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); break; - case 144 /* Parameter */: + case 145 /* Parameter */: markTypeNodeAsReferenced(node.type); break; } @@ -39653,7 +39914,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 === 142 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 143 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -39713,43 +39974,43 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 262 /* SourceFile */: - case 231 /* ModuleDeclaration */: + case 263 /* SourceFile */: + case 232 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: checkUnusedTypeParameters(node); break; - case 205 /* Block */: - case 233 /* CaseBlock */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: checkUnusedLocalsAndParameters(node); break; - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: if (node.body) { checkUnusedLocalsAndParameters(node); } checkUnusedTypeParameters(node); break; - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: checkUnusedTypeParameters(node); break; } @@ -39758,11 +40019,10 @@ var ts; } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 228 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_2 = function (key) { - var local = node.locals[key]; + if (node.parent.kind !== 229 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + node.locals.forEach(function (local) { if (!local.isReferenced) { - if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144 /* Parameter */) { + if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 145 /* Parameter */) { var parameter = ts.getRootDeclaration(local.valueDeclaration); if (compilerOptions.noUnusedParameters && !ts.isParameterPropertyDeclaration(parameter) && @@ -39775,10 +40035,7 @@ var ts; ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); }); } } - }; - for (var key in node.locals) { - _loop_2(key); - } + }); } } function isRemovedPropertyFromObjectSpread(node) { @@ -39791,9 +40048,9 @@ var ts; function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 224 /* VariableDeclaration */ && - (declaration.parent.parent.kind === 213 /* ForInStatement */ || - declaration.parent.parent.kind === 214 /* ForOfStatement */)) { + if (declaration.kind === 225 /* VariableDeclaration */ && + (declaration.parent.parent.kind === 214 /* ForInStatement */ || + declaration.parent.parent.kind === 215 /* ForOfStatement */)) { return; } } @@ -39812,12 +40069,12 @@ var ts; if (node.members) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 149 /* MethodDeclaration */ || member.kind === 147 /* PropertyDeclaration */) { + if (member.kind === 150 /* MethodDeclaration */ || member.kind === 148 /* PropertyDeclaration */) { if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8 /* Private */) { error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); } } - else if (member.kind === 150 /* Constructor */) { + else if (member.kind === 151 /* Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8 /* Private */) { @@ -39850,8 +40107,7 @@ var ts; } function checkUnusedModuleMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { - for (var key in node.locals) { - var local = node.locals[key]; + node.locals.forEach(function (local) { if (!local.isReferenced && !local.exportSymbol) { for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; @@ -39860,12 +40116,12 @@ var ts; } } } - } + }); } } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 205 /* Block */) { + if (node.kind === 206 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -39888,12 +40144,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 146 /* PropertySignature */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 148 /* MethodSignature */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 147 /* PropertySignature */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 149 /* MethodSignature */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -39902,7 +40158,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 144 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 145 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -39980,12 +40236,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 231 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 232 /* 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 === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 263 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -39995,12 +40251,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 231 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 232 /* 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 === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { + if (parent.kind === 263 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -40035,7 +40291,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 224 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 225 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -40045,24 +40301,24 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 225 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 206 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 226 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 207 /* 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 === 205 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 232 /* ModuleBlock */ || - container.kind === 231 /* ModuleDeclaration */ || - container.kind === 262 /* SourceFile */); + (container.kind === 206 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 233 /* ModuleBlock */ || + container.kind === 232 /* ModuleDeclaration */ || + container.kind === 263 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail // since LHS will be block scoped name instead of function scoped if (!namesShareScope) { - var name_23 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23); + var name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } @@ -40070,7 +40326,7 @@ 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 !== 144 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 145 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -40081,7 +40337,7 @@ var ts; // skip declaration names (i.e. in object literal expressions) return; } - if (n.kind === 177 /* PropertyAccessExpression */) { + if (n.kind === 178 /* PropertyAccessExpression */) { // skip property names in property access expression return visit(n.expression); } @@ -40100,8 +40356,8 @@ var ts; // so we need to do a bit of extra work to check if reference is legal var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144 /* Parameter */ || - symbol.valueDeclaration.kind === 174 /* BindingElement */) { + if (symbol.valueDeclaration.kind === 145 /* Parameter */ || + symbol.valueDeclaration.kind === 175 /* BindingElement */) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { @@ -40115,7 +40371,7 @@ var ts; } // computed property names/initializers in instance property declaration of class like entities // are executed in constructor and thus deferred - if (current.parent.kind === 147 /* PropertyDeclaration */ && + if (current.parent.kind === 148 /* PropertyDeclaration */ && !(ts.hasModifier(current.parent, 32 /* Static */)) && ts.isClassLike(current.parent.parent)) { return; @@ -40142,28 +40398,28 @@ 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 === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 174 /* BindingElement */) { - if (node.parent.kind === 172 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */ && !ts.isInAmbientContext(node)) { + if (node.kind === 175 /* BindingElement */) { + if (node.parent.kind === 173 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */ && !ts.isInAmbientContext(node)) { checkExternalEmitHelpers(node, 4 /* Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 142 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access - var parent_11 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_11); - var name_24 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); + var parent = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent); + var name = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name)); markPropertyAsReferenced(property); - if (parent_11.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); + if (parent.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent, parent.initializer, parentType, property); } } // For a binding pattern, check contained binding elements @@ -40171,14 +40427,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 === 144 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 145 /* 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)) { // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 213 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 214 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -40189,7 +40445,7 @@ var ts; if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 213 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 214 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -40209,10 +40465,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */) { + if (node.kind !== 148 /* PropertyDeclaration */ && node.kind !== 147 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 224 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */) { + if (node.kind === 225 /* VariableDeclaration */ || node.kind === 175 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -40223,8 +40479,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 /* Parameter */ && right.kind === 224 /* VariableDeclaration */) || - (left.kind === 224 /* VariableDeclaration */ && right.kind === 144 /* Parameter */)) { + if ((left.kind === 145 /* Parameter */ && right.kind === 225 /* VariableDeclaration */) || + (left.kind === 225 /* VariableDeclaration */ && right.kind === 145 /* Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -40254,7 +40510,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 === 176 /* ObjectLiteralExpression */) { + if (node.modifiers && node.parent.kind === 177 /* ObjectLiteralExpression */) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -40275,7 +40531,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 207 /* EmptyStatement */) { + if (node.thenStatement.kind === 208 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -40295,12 +40551,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 225 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 226 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 225 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -40323,14 +40579,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 === 225 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* 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 === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) { + if (varExpr.kind === 176 /* ArrayLiteralExpression */ || varExpr.kind === 177 /* 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. @@ -40362,7 +40618,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 === 225 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* 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); @@ -40376,7 +40632,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 === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) { + if (varExpr.kind === 176 /* ArrayLiteralExpression */ || varExpr.kind === 177 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -40629,7 +40885,7 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152 /* SetAccessor */))); + return !!(node.kind === 152 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 153 /* SetAccessor */))); } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; @@ -40656,33 +40912,33 @@ var ts; // for generators. return; } - if (func.kind === 152 /* SetAccessor */) { + if (func.kind === 153 /* SetAccessor */) { if (node.expression) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 150 /* Constructor */) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { - error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + else if (func.kind === 151 /* Constructor */) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { // If the function has a return type, but promisedType is // undefined, an error will be reported in checkAsyncFunctionReturnType // so we don't need to report one here. - checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + checkTypeAssignableTo(awaitedType, promisedType, node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression || node); + checkTypeAssignableTo(exprType, returnType, node); } } } - else if (func.kind !== 150 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + else if (func.kind !== 151 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -40712,7 +40968,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 255 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 256 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -40724,7 +40980,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 254 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 255 /* 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 comparable @@ -40755,7 +41011,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 220 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 221 /* 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; @@ -40792,14 +41048,14 @@ var ts; grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var blockLocals = catchClause.block.locals; - if (blockLocals) { - for (var caughtName in catchClause.locals) { - var blockLocal = blockLocals[caughtName]; + var blockLocals_1 = catchClause.block.locals; + if (blockLocals_1) { + ts.forEachKey(catchClause.locals, function (caughtName) { + var blockLocal = blockLocals_1.get(caughtName); if (blockLocal && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); } - } + }); } } } @@ -40851,15 +41107,16 @@ var ts; if (!indexType) { return; } + var propDeclaration = prop.valueDeclaration; // index is numeric and property name is not valid numeric literal - if (indexKind === 1 /* Number */ && !isNumericName(prop.valueDeclaration.name)) { + if (indexKind === 1 /* Number */ && !(propDeclaration ? isNumericName(propDeclaration.name) : isNumericLiteralName(prop.name))) { return; } // 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 === 142 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + if (propDeclaration && (propDeclaration.name.kind === 143 /* ComputedPropertyName */ || prop.parent === containingType.symbol)) { + errorNode = propDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; @@ -40889,6 +41146,7 @@ var ts; case "string": case "symbol": case "void": + case "object": error(name, message, name.text); } } @@ -40916,7 +41174,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* ClassDeclaration */ || declaration.kind === 228 /* InterfaceDeclaration */) { + if (declaration.kind === 228 /* ClassDeclaration */ || declaration.kind === 229 /* InterfaceDeclaration */) { if (!firstDecl) { firstDecl = declaration; } @@ -40961,6 +41219,10 @@ var ts; var staticType = getTypeOfSymbol(symbol); checkTypeParameterListsIdentical(node, symbol); checkClassForDuplicateDeclarations(node); + // Only check for reserved static identifiers on non-ambient context. + if (!ts.isInAmbientContext(node)) { + checkClassForStaticPropertyNameConflicts(node); + } var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { if (languageVersion < 2 /* ES2015 */ && !ts.isInAmbientContext(node)) { @@ -40969,7 +41231,8 @@ var ts; var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; - var staticBaseType = getBaseConstructorTypeOfClass(type); + var baseConstructorType = getBaseConstructorTypeOfClass(type); + var staticBaseType = getApparentType(baseConstructorType); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { @@ -40983,14 +41246,17 @@ var ts; } checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType_1.symbol.valueDeclaration && + if (baseConstructorType.flags & 540672 /* TypeVariable */ && !isMixinConstructorType(staticType)) { + error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); + } + if (baseType_1.symbol && baseType_1.symbol.valueDeclaration && !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 227 /* ClassDeclaration */) { + baseType_1.symbol.valueDeclaration.kind === 228 /* ClassDeclaration */) { if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); } } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */)) { + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 540672 /* TypeVariable */)) { // When the static base type is a "class-like" constructor function (but not actually a class), we verify // that all instantiated base constructor signatures return the same type. We can simply compare the type // references (as opposed to checking the structure of the types) because elsewhere we have already checked @@ -41014,8 +41280,7 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { - var declaredType = getObjectFlags(t) & 4 /* Reference */ ? t.target : t; - if (getObjectFlags(declaredType) & 3 /* ClassOrInterface */) { + if (isValidBaseType(t)) { checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -41065,7 +41330,7 @@ var ts; // Base class instance member variables and accessors can be overridden by // derived class instance member variables and accessors, but not by other kinds of members. // NOTE: assignability is checked in checkClassDeclaration - var baseProperties = getPropertiesOfObjectType(baseType); + var baseProperties = getPropertiesOfType(baseType); for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); @@ -41086,7 +41351,7 @@ var ts; // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128 /* Abstract */))) { - if (derivedClassDecl.kind === 197 /* ClassExpression */) { + if (derivedClassDecl.kind === 198 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -41134,7 +41399,7 @@ var ts; } } function isAccessor(kind) { - return kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */; + return kind === 152 /* GetAccessor */ || kind === 153 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -41170,16 +41435,16 @@ var ts; return true; } var seen = ts.createMap(); - ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.name, { prop: p, containingType: type }); }); var ok = true; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); + var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { var prop = properties_7[_a]; - var existing = seen[prop.name]; + var existing = seen.get(prop.name); if (!existing) { - seen[prop.name] = { prop: prop, containingType: base }; + seen.set(prop.name, { prop: prop, containingType: base }); } else { var isInheritedProperty = existing.containingType !== type; @@ -41206,7 +41471,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 228 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 229 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -41313,7 +41578,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -41324,7 +41589,7 @@ var ts; case 51 /* TildeToken */: return ~value_1; } return undefined; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -41350,11 +41615,11 @@ var ts; case 8 /* NumericLiteral */: checkGrammarNumericLiteral(e); return +e.text; - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return evalConstant(e.expression); case 70 /* Identifier */: - case 178 /* ElementAccessExpression */: - case 177 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -41367,7 +41632,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 178 /* ElementAccessExpression */) { + if (e.kind === 179 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; @@ -41385,7 +41650,7 @@ var ts; if (current.kind === 70 /* Identifier */) { break; } - else if (current.kind === 177 /* PropertyAccessExpression */) { + else if (current.kind === 178 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -41458,7 +41723,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 230 /* EnumDeclaration */) { + if (declaration.kind !== 231 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -41481,8 +41746,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 227 /* ClassDeclaration */ || - (declaration.kind === 226 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 228 /* ClassDeclaration */ || + (declaration.kind === 227 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -41546,7 +41811,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, 227 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 228 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -41597,26 +41862,26 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 241 /* ExportAssignment */: - case 242 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 243 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 235 /* ImportEqualsDeclaration */: - case 236 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 237 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 174 /* BindingElement */: - case 224 /* VariableDeclaration */: - var name_25 = node.name; - if (ts.isBindingPattern(name_25)) { - for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { + case 175 /* BindingElement */: + case 225 /* VariableDeclaration */: + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); @@ -41624,12 +41889,12 @@ var ts; break; } // fallthrough - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: - case 226 /* FunctionDeclaration */: - case 228 /* InterfaceDeclaration */: - case 231 /* ModuleDeclaration */: - case 229 /* TypeAliasDeclaration */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 227 /* FunctionDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -41652,12 +41917,12 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return node; - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: do { node = node.left; } while (node.kind !== 70 /* Identifier */); return node; - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 70 /* Identifier */); @@ -41670,9 +41935,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 232 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 262 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 242 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 233 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 263 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 243 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -41705,7 +41970,7 @@ var ts; (symbol.flags & 793064 /* Type */ ? 793064 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 244 /* ExportSpecifier */ ? + var message = node.kind === 245 /* 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)); @@ -41733,7 +41998,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 238 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 239 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -41790,8 +42055,8 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 232 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 262 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 233 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 263 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -41805,7 +42070,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 262 /* SourceFile */ || node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 231 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 263 /* SourceFile */ || node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 232 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -41831,8 +42096,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 === 262 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 231 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 263 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 232 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -41864,18 +42129,13 @@ var ts; } } function hasExportedMembers(moduleSymbol) { - for (var id in moduleSymbol.exports) { - if (id !== "export=") { - return true; - } - } - return false; + return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; }); } function checkExternalModuleExports(node) { var moduleSymbol = getSymbolOfNode(node); var links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - var exportEqualsSymbol = moduleSymbol.exports["export="]; + var exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (!isTopLevelInExternalModuleAugmentation(declaration)) { @@ -41884,21 +42144,21 @@ var ts; } // Checks for export * conflicts var exports = getExportsOfModule(moduleSymbol); - for (var id in exports) { + exports && exports.forEach(function (_a, id) { + var declarations = _a.declarations, flags = _a.flags; if (id === "__export") { - continue; + return; } - var _a = exports[id], declarations = _a.declarations, flags = _a.flags; // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. // (TS Exceptions: namespaces, function overloads, enums, and interfaces) if (flags & (1920 /* Namespace */ | 64 /* Interface */ | 384 /* Enum */)) { - continue; + return; } var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); if (flags & 524288 /* TypeAlias */ && exportedDeclarationsCount <= 2) { // it is legal to merge type alias with other values // so count should be either 1 (just type alias) or 2 (type alias + merged value) - continue; + return; } if (exportedDeclarationsCount > 1) { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -41908,11 +42168,11 @@ var ts; } } } - } + }); links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 226 /* FunctionDeclaration */ && declaration.kind !== 149 /* MethodDeclaration */) || + return (declaration.kind !== 227 /* FunctionDeclaration */ && declaration.kind !== 150 /* MethodDeclaration */) || !!declaration.body; } } @@ -41925,123 +42185,123 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 231 /* ModuleDeclaration */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 226 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return checkTypeParameter(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return checkParameter(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return checkPropertyDeclaration(node); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return checkSignatureDeclaration(node); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return checkMethodDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return checkConstructorDeclaration(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return checkAccessorDeclaration(node); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return checkTypeReferenceNode(node); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return checkTypePredicate(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return checkTypeQuery(node); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return checkTypeLiteral(node); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return checkArrayType(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return checkTupleType(node); - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 166 /* ParenthesizedType */: - case 168 /* TypeOperator */: + case 167 /* ParenthesizedType */: + case 169 /* TypeOperator */: return checkSourceElement(node.type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return checkIndexedAccessType(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return checkMappedType(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 205 /* Block */: - case 232 /* ModuleBlock */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return checkBlock(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return checkVariableStatement(node); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return checkExpressionStatement(node); - case 209 /* IfStatement */: + case 210 /* IfStatement */: return checkIfStatement(node); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return checkDoStatement(node); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return checkWhileStatement(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return checkForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return checkForInStatement(node); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return checkForOfStatement(node); - case 215 /* ContinueStatement */: - case 216 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return checkReturnStatement(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return checkWithStatement(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return checkSwitchStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return checkLabeledStatement(node); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: return checkThrowStatement(node); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return checkTryStatement(node); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return checkBindingElement(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return checkClassDeclaration(node); - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return checkImportDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return checkExportDeclaration(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return checkExportAssignment(node); - case 207 /* EmptyStatement */: + case 208 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 223 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 245 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -42063,17 +42323,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: checkAccessorDeferred(node); break; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: checkClassExpressionDeferred(node); break; } @@ -42179,7 +42439,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 218 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 219 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -42202,25 +42462,25 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 262 /* SourceFile */: + case 263 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 197 /* ClassExpression */: + case 198 /* 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 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* 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. @@ -42229,7 +42489,7 @@ var ts; copySymbols(getSymbolOfNode(location).members, meaning & 793064 /* Type */); } break; - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -42257,17 +42517,16 @@ var ts; // We will copy all symbol regardless of its reserved name because // symbolsToArray will check whether the key is a reserved name and // it will not copy symbol with reserved name to the array - if (!symbols[id]) { - symbols[id] = symbol; + if (!symbols.has(id)) { + symbols.set(id, symbol); } } } function copySymbols(source, meaning) { if (meaning) { - for (var id in source) { - var symbol = source[id]; + source.forEach(function (symbol) { copySymbol(symbol, meaning); - } + }); } } } @@ -42278,28 +42537,28 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 143 /* TypeParameter */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 230 /* EnumDeclaration */: + case 144 /* TypeParameter */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* 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 === 141 /* QualifiedName */) { + while (node.parent && node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } - return node.parent && (node.parent.kind === 157 /* TypeReference */ || node.parent.kind === 273 /* JSDocTypeReference */); + return node.parent && (node.parent.kind === 158 /* TypeReference */ || node.parent.kind === 274 /* JSDocTypeReference */); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 177 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 178 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 199 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 200 /* ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -42316,13 +42575,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 141 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 142 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 235 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 236 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 241 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 242 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -42334,7 +42593,7 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177 /* PropertyAccessExpression */) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 178 /* PropertyAccessExpression */) { var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); switch (specialPropertyAssignmentKind) { case 1 /* ExportsProperty */: @@ -42346,13 +42605,13 @@ var ts; default: } } - if (entityName.parent.kind === 241 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 242 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 177 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { + if (entityName.kind !== 178 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(entityName, 235 /* ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(entityName, 236 /* ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true); } @@ -42362,7 +42621,7 @@ var ts; if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0 /* None */; // In an interface or class, we're definitely interested in a type. - if (entityName.parent.kind === 199 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 200 /* ExpressionWithTypeArguments */) { meaning = 793064 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -42386,14 +42645,14 @@ var ts; } return resolveEntityName(entityName, 107455 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.kind === 177 /* PropertyAccessExpression */) { + else if (entityName.kind === 178 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 141 /* QualifiedName */) { + else if (entityName.kind === 142 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -42402,20 +42661,20 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 /* TypeReference */ || entityName.parent.kind === 273 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; + var meaning = (entityName.parent.kind === 158 /* TypeReference */ || entityName.parent.kind === 274 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 251 /* JsxAttribute */) { + else if (entityName.parent.kind === 252 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 156 /* TypePredicate */) { + if (entityName.parent.kind === 157 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 262 /* SourceFile */) { + if (node.kind === 263 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -42433,8 +42692,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 174 /* BindingElement */ && - node.parent.parent.kind === 172 /* ObjectBindingPattern */ && + else if (node.parent.kind === 175 /* BindingElement */ && + node.parent.parent.kind === 173 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -42445,8 +42704,8 @@ var ts; } switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 98 /* ThisKeyword */: var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); @@ -42460,12 +42719,12 @@ var ts; case 96 /* SuperKeyword */: var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 167 /* ThisType */: + case 168 /* ThisType */: return getTypeFromTypeNode(node).symbol; case 122 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 150 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 151 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -42473,7 +42732,7 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 236 /* ImportDeclaration */ || node.parent.kind === 242 /* ExportDeclaration */) && + ((node.parent.kind === 237 /* ImportDeclaration */ || node.parent.kind === 243 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -42483,7 +42742,7 @@ var ts; // Fall through case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -42500,7 +42759,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 === 259 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 260 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */); } return undefined; @@ -42562,28 +42821,28 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 176 /* ObjectLiteralExpression */ || expr.kind === 175 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 177 /* ObjectLiteralExpression */ || expr.kind === 176 /* ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 214 /* ForOfStatement */) { + if (expr.parent.kind === 215 /* ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 192 /* BinaryExpression */) { + if (expr.parent.kind === 193 /* BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 258 /* PropertyAssignment */) { + if (expr.parent.kind === 259 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } // Array literal assignment - array destructuring pattern - ts.Debug.assert(expr.parent.kind === 175 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.parent.kind === 176 /* ArrayLiteralExpression */); // [{ property1: p1, property2 }] = elems; var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType; @@ -42623,8 +42882,8 @@ var ts; var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0 /* Call */).length || getSignaturesOfType(type, 1 /* Construct */).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { - if (!propsByName[p.name]) { - propsByName[p.name] = p; + if (!propsByName.has(p.name)) { + propsByName.set(p.name, p); } }); } @@ -42633,9 +42892,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456 /* SyntheticProperty */) { var symbols_3 = []; - var name_26 = symbol.name; + var name_2 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_26); + var symbol = getPropertyOfType(t, name_2); if (symbol) { symbols_3.push(symbol); } @@ -42647,6 +42906,9 @@ var ts; var links = symbol; return [links.leftSpread, links.rightSpread]; } + if (symbol.mappedTypeOrigin) { + return getRootSymbols(symbol.mappedTypeOrigin); + } var target = void 0; var next = symbol; while (next = getSymbolLinks(next).target) { @@ -42663,7 +42925,8 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - return getReferencedValueSymbol(node) === argumentsSymbol; + var isPropertyName_1 = node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node; + return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } return false; @@ -42684,7 +42947,7 @@ var ts; // otherwise - check if at least one export is value symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 107455 /* Value */) - : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue); + : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; function isValue(s) { @@ -42719,7 +42982,7 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 262 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 263 /* SourceFile */) { var symbolFile = parentSymbol.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -42776,7 +43039,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 205 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 206 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -42822,16 +43085,16 @@ var ts; return true; } switch (node.kind) { - case 235 /* ImportEqualsDeclaration */: - case 237 /* ImportClause */: - case 238 /* NamespaceImport */: - case 240 /* ImportSpecifier */: - case 244 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return node.expression && node.expression.kind === 70 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -42841,7 +43104,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 262 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 263 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -42907,7 +43170,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 261 /* EnumMember */) { + if (node.kind === 262 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -42925,16 +43188,18 @@ var ts; function getTypeReferenceSerializationKind(typeName, location) { // Resolve the symbol as a value to ensure the type can be reached at runtime during emit. var valueSymbol = resolveEntityName(typeName, 107455 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); - var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); - if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { - return ts.TypeReferenceSerializationKind.Promise; - } - var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; - if (constructorType && isConstructorType(constructorType)) { - return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; - } // Resolve the symbol as a type so that we can provide a more useful hint for the type serializer. var typeSymbol = resolveEntityName(typeName, 793064 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); + if (valueSymbol && valueSymbol === typeSymbol) { + var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return ts.TypeReferenceSerializationKind.Promise; + } + var constructorType = getTypeOfSymbol(valueSymbol); + if (constructorType && isConstructorType(constructorType)) { + return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + } // We might not be able to resolve type symbol so use unknown type in that case (eg error case) if (!typeSymbol) { return ts.TypeReferenceSerializationKind.ObjectType; @@ -42997,7 +43262,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); } function hasGlobalName(name) { - return !!globals[name]; + return globals.has(name); } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; @@ -43008,9 +43273,9 @@ var ts; if (startInDeclarationContainer) { // When resolving the name of a declaration as a value, we need to start resolution // at a point outside of the declaration. - var parent_12 = reference.parent; - if (ts.isDeclaration(parent_12) && reference === parent_12.name) { - location = getDeclarationContainer(parent_12); + var parent = reference.parent; + if (ts.isDeclaration(parent) && reference === parent.name) { + location = getDeclarationContainer(parent); } } return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); @@ -43046,14 +43311,13 @@ var ts; if (resolvedTypeReferenceDirectives) { // populate reverse mapping: file path -> type reference directive that was resolved to this file fileToDirective = ts.createFileMap(); - for (var key in resolvedTypeReferenceDirectives) { - var resolvedDirective = resolvedTypeReferenceDirectives[key]; + resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (!resolvedDirective) { - continue; + return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key); - } + }); } return { getReferencedExportContainer: getReferencedExportContainer, @@ -43096,7 +43360,7 @@ var ts; // property access can only be used as values // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries - var meaning = (node.kind === 177 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node)) + var meaning = (node.kind === 178 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node)) ? 107455 /* Value */ | 1048576 /* ExportValue */ : 793064 /* Type */ | 1920 /* Namespace */; var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true); @@ -43139,15 +43403,15 @@ var ts; // external modules cannot define or contribute to type declaration files var current = symbol; while (true) { - var parent_13 = getParentOfSymbol(current); - if (parent_13) { - current = parent_13; + var parent = getParentOfSymbol(current); + if (parent) { + current = parent; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 262 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 263 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -43167,7 +43431,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 262 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 263 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -43191,11 +43455,11 @@ var ts; if (file.symbol && file.symbol.globalExports) { // Merge in UMD exports with first-in-wins semantics (see #9771) var source = file.symbol.globalExports; - for (var id in source) { - if (!(id in globals)) { - globals[id] = source[id]; + source.forEach(function (sourceSymbol, id) { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); } - } + }); } } if (augmentations) { @@ -43265,10 +43529,10 @@ var ts; var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; for (var helper = 1 /* FirstEmitHelper */; helper <= 128 /* LastEmitHelper */; helper <<= 1) { if (uncheckedHelpers & helper) { - var name_27 = getHelperName(helper); - var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_27), 107455 /* Value */); + var name = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name), 107455 /* Value */); if (!symbol) { - error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_27); + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); } } } @@ -43319,14 +43583,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 149 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 150 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */) { + else if (node.kind === 152 /* GetAccessor */ || node.kind === 153 /* 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); @@ -43344,16 +43608,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 130 /* ReadonlyKeyword */) { - if (node.kind === 146 /* PropertySignature */ || node.kind === 148 /* MethodSignature */) { + if (node.kind === 147 /* PropertySignature */ || node.kind === 149 /* MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 75 /* ConstKeyword */: - if (node.kind !== 230 /* EnumDeclaration */ && node.parent.kind === 227 /* ClassDeclaration */) { + if (node.kind !== 231 /* EnumDeclaration */ && node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75 /* ConstKeyword */)); } break; @@ -43379,7 +43643,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { + else if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 263 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -43402,10 +43666,10 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { + else if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 263 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128 /* Abstract */) { @@ -43418,7 +43682,7 @@ var ts; if (flags & 64 /* Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */ && node.kind !== 155 /* IndexSignature */ && node.kind !== 144 /* Parameter */) { + else if (node.kind !== 148 /* PropertyDeclaration */ && node.kind !== 147 /* PropertySignature */ && node.kind !== 156 /* IndexSignature */ && node.kind !== 145 /* Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -43438,10 +43702,10 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 227 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; @@ -43453,13 +43717,13 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 227 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 232 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 233 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -43469,14 +43733,14 @@ var ts; if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 227 /* ClassDeclaration */) { - if (node.kind !== 149 /* MethodDeclaration */ && - node.kind !== 147 /* PropertyDeclaration */ && - node.kind !== 151 /* GetAccessor */ && - node.kind !== 152 /* SetAccessor */) { + if (node.kind !== 228 /* ClassDeclaration */) { + if (node.kind !== 150 /* MethodDeclaration */ && + node.kind !== 148 /* PropertyDeclaration */ && + node.kind !== 152 /* GetAccessor */ && + node.kind !== 153 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 227 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { + if (!(node.parent.kind === 228 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -43495,7 +43759,7 @@ var ts; 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 === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256 /* Async */; @@ -43503,7 +43767,7 @@ var ts; break; } } - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -43518,13 +43782,13 @@ var ts; } return; } - else if ((node.kind === 236 /* ImportDeclaration */ || node.kind === 235 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 237 /* ImportDeclaration */ || node.kind === 236 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 145 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 145 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256 /* Async */) { @@ -43544,37 +43808,37 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 155 /* IndexSignature */: - case 231 /* ModuleDeclaration */: - case 236 /* ImportDeclaration */: - case 235 /* ImportEqualsDeclaration */: - case 242 /* ExportDeclaration */: - case 241 /* ExportAssignment */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 144 /* Parameter */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 156 /* IndexSignature */: + case 232 /* ModuleDeclaration */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 145 /* Parameter */: return false; default: - if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { + if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 263 /* SourceFile */) { return false; } switch (node.kind) { - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return nodeHasAnyModifiersExcept(node, 119 /* AsyncKeyword */); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return nodeHasAnyModifiersExcept(node, 116 /* AbstractKeyword */); - case 228 /* InterfaceDeclaration */: - case 206 /* VariableStatement */: - case 229 /* TypeAliasDeclaration */: + case 229 /* InterfaceDeclaration */: + case 207 /* VariableStatement */: + case 230 /* TypeAliasDeclaration */: return true; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 75 /* ConstKeyword */); default: ts.Debug.fail(); @@ -43587,10 +43851,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 149 /* MethodDeclaration */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: if (!node.asteriskToken) { return false; } @@ -43653,7 +43917,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 185 /* ArrowFunction */) { + if (node.kind === 186 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -43688,7 +43952,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 !== 134 /* StringKeyword */ && parameter.type.kind !== 132 /* NumberKeyword */) { + if (parameter.type.kind !== 135 /* StringKeyword */ && parameter.type.kind !== 132 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -43716,7 +43980,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { var arg = args_4[_i]; - if (arg.kind === 198 /* OmittedExpression */) { + if (arg.kind === 199 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -43789,19 +44053,19 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 142 /* ComputedPropertyName */) { + if (node.kind !== 143 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 192 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* CommaToken */) { + if (computedPropertyName.expression.kind === 193 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* 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 === 226 /* FunctionDeclaration */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 149 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 227 /* FunctionDeclaration */ || + node.kind === 185 /* FunctionExpression */ || + node.kind === 150 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -43826,15 +44090,15 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 260 /* SpreadAssignment */) { + if (prop.kind === 261 /* SpreadAssignment */) { continue; } - var name_28 = prop.name; - if (name_28.kind === 142 /* ComputedPropertyName */) { + var name = prop.name; + if (name.kind === 143 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it - checkGrammarComputedPropertyName(name_28); + checkGrammarComputedPropertyName(name); } - if (prop.kind === 259 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 260 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -43843,7 +44107,7 @@ var ts; if (prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 149 /* MethodDeclaration */) { + if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 150 /* MethodDeclaration */) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -43857,48 +44121,48 @@ 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 === 258 /* PropertyAssignment */ || prop.kind === 259 /* ShorthandPropertyAssignment */) { + if (prop.kind === 259 /* PropertyAssignment */ || prop.kind === 260 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_28.kind === 8 /* NumericLiteral */) { - checkGrammarNumericLiteral(name_28); + if (name.kind === 8 /* NumericLiteral */) { + checkGrammarNumericLiteral(name); } currentKind = Property; } - else if (prop.kind === 149 /* MethodDeclaration */) { + else if (prop.kind === 150 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 151 /* GetAccessor */) { + else if (prop.kind === 152 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 152 /* SetAccessor */) { + else if (prop.kind === 153 /* SetAccessor */) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_28); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name); if (effectiveName === undefined) { continue; } - if (!seen[effectiveName]) { - seen[effectiveName] = currentKind; + var existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); } else { - var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_28, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_28)); + grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[effectiveName] = currentKind | existingKind; + seen.set(effectiveName, currentKind | existingKind); } else { - return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -43907,19 +44171,19 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 252 /* JsxSpreadAttribute */) { + if (attr.kind === 253 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; - var name_29 = jsxAttr.name; - if (!seen[name_29.text]) { - seen[name_29.text] = true; + var name = jsxAttr.name; + if (!seen.get(name.text)) { + seen.set(name.text, true); } else { - return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 253 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 254 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -43928,7 +44192,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 225 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 226 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -43943,20 +44207,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 213 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* 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 = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 213 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* 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 === 213 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* 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); @@ -43983,11 +44247,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 151 /* GetAccessor */ ? + return grammarErrorOnNode(accessor.name, kind === 152 /* GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 152 /* SetAccessor */) { + else if (kind === 153 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -44010,10 +44274,10 @@ var ts; A get accessor has no parameters or a single `this` parameter. A set accessor has one parameter or a `this` parameter and one more parameter */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 152 /* GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 152 /* GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } @@ -44028,7 +44292,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 176 /* ObjectLiteralExpression */) { + if (node.parent.kind === 177 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } @@ -44049,10 +44313,10 @@ 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 === 228 /* InterfaceDeclaration */) { + else if (node.parent.kind === 229 /* 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 === 161 /* TypeLiteral */) { + else if (node.parent.kind === 162 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -44063,11 +44327,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 220 /* LabeledStatement */: + case 221 /* 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 === 215 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 216 /* ContinueStatement */ && !ts.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); @@ -44075,8 +44339,8 @@ var ts; return false; } break; - case 219 /* SwitchStatement */: - if (node.kind === 216 /* BreakStatement */ && !node.label) { + case 220 /* SwitchStatement */: + if (node.kind === 217 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -44091,13 +44355,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 216 /* BreakStatement */ + var message = node.kind === 217 /* 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 === 216 /* BreakStatement */ + var message = node.kind === 217 /* 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); @@ -44109,7 +44373,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 173 /* ArrayBindingPattern */ || node.name.kind === 172 /* ObjectBindingPattern */) { + if (node.name.kind === 174 /* ArrayBindingPattern */ || node.name.kind === 173 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -44120,11 +44384,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ || - expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && + expr.kind === 191 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 213 /* ForInStatement */ && node.parent.parent.kind !== 214 /* ForOfStatement */) { + if (node.parent.parent.kind !== 214 /* ForInStatement */ && node.parent.parent.kind !== 215 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -44189,15 +44453,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 209 /* IfStatement */: - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - case 218 /* WithStatement */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 219 /* WithStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return false; - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -44259,7 +44523,7 @@ var ts; return true; } } - else if (node.parent.kind === 228 /* InterfaceDeclaration */) { + else if (node.parent.kind === 229 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -44267,7 +44531,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 161 /* TypeLiteral */) { + else if (node.parent.kind === 162 /* 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; } @@ -44292,13 +44556,13 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 228 /* InterfaceDeclaration */ || - node.kind === 229 /* TypeAliasDeclaration */ || - node.kind === 236 /* ImportDeclaration */ || - node.kind === 235 /* ImportEqualsDeclaration */ || - node.kind === 242 /* ExportDeclaration */ || - node.kind === 241 /* ExportAssignment */ || - node.kind === 234 /* NamespaceExportDeclaration */ || + if (node.kind === 229 /* InterfaceDeclaration */ || + node.kind === 230 /* TypeAliasDeclaration */ || + node.kind === 237 /* ImportDeclaration */ || + node.kind === 236 /* ImportEqualsDeclaration */ || + node.kind === 243 /* ExportDeclaration */ || + node.kind === 242 /* ExportAssignment */ || + node.kind === 235 /* NamespaceExportDeclaration */ || ts.getModifierFlags(node) & (2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) { return false; } @@ -44307,7 +44571,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 === 206 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 207 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -44333,7 +44597,7 @@ var ts; // to prevent noisiness. 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 === 205 /* Block */ || node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { + if (node.parent.kind === 206 /* Block */ || node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 263 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -44351,10 +44615,10 @@ var ts; if (languageVersion >= 1 /* ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 171 /* LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 172 /* LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 261 /* EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 262 /* EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -44374,11 +44638,11 @@ var ts; } function getAmbientModules() { var result = []; - for (var sym in globals) { + globals.forEach(function (global, sym) { if (ambientModuleSymbolRegex.test(sym)) { - result.push(globals[sym]); + result.push(global); } - } + }); return result; } } @@ -44406,54 +44670,56 @@ var ts; * supplant the existing `forEachChild` implementation if performance is not * significantly impacted. */ - var nodeEdgeTraversalMap = ts.createMap((_a = {}, - _a[141 /* QualifiedName */] = [ - { name: "left", test: ts.isEntityName }, - { name: "right", test: ts.isIdentifier } - ], - _a[145 /* Decorator */] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[182 /* TypeAssertionExpression */] = [ - { name: "type", test: ts.isTypeNode }, - { name: "expression", test: ts.isUnaryExpression } - ], - _a[200 /* AsExpression */] = [ - { name: "expression", test: ts.isExpression }, - { name: "type", test: ts.isTypeNode } - ], - _a[201 /* NonNullExpression */] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[230 /* EnumDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "members", test: ts.isEnumMember } - ], - _a[231 /* ModuleDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isModuleName }, - { name: "body", test: ts.isModuleBody } - ], - _a[232 /* ModuleBlock */] = [ - { name: "statements", test: ts.isStatement } - ], - _a[235 /* ImportEqualsDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "moduleReference", test: ts.isModuleReference } - ], - _a[246 /* ExternalModuleReference */] = [ - { name: "expression", test: ts.isExpression, optional: true } - ], - _a[261 /* EnumMember */] = [ - { name: "name", test: ts.isPropertyName }, - { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } - ], - _a)); + function getNodeEdgeTraversal(kind) { + switch (kind) { + case 142 /* QualifiedName */: return [ + { name: "left", test: ts.isEntityName }, + { name: "right", test: ts.isIdentifier } + ]; + case 146 /* Decorator */: return [ + { name: "expression", test: ts.isLeftHandSideExpression } + ]; + case 183 /* TypeAssertionExpression */: return [ + { name: "type", test: ts.isTypeNode }, + { name: "expression", test: ts.isUnaryExpression } + ]; + case 201 /* AsExpression */: return [ + { name: "expression", test: ts.isExpression }, + { name: "type", test: ts.isTypeNode } + ]; + case 202 /* NonNullExpression */: return [ + { name: "expression", test: ts.isLeftHandSideExpression } + ]; + case 231 /* EnumDeclaration */: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "members", test: ts.isEnumMember } + ]; + case 232 /* ModuleDeclaration */: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isModuleName }, + { name: "body", test: ts.isModuleBody } + ]; + case 233 /* ModuleBlock */: return [ + { name: "statements", test: ts.isStatement } + ]; + case 236 /* ImportEqualsDeclaration */: return [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "moduleReference", test: ts.isModuleReference } + ]; + case 247 /* ExternalModuleReference */: return [ + { name: "expression", test: ts.isExpression, optional: true } + ]; + case 262 /* EnumMember */: return [ + { name: "name", test: ts.isPropertyName }, + { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } + ]; + } + } function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } @@ -44477,47 +44743,47 @@ var ts; var cbNodes = cbNodeArray || cbNode; var kind = node.kind; // No need to visit nodes with no children. - if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) { + if ((kind > 0 /* FirstToken */ && kind <= 141 /* LastToken */)) { return initial; } // We do not yet support types. - if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) { + if ((kind >= 157 /* TypePredicate */ && kind <= 172 /* LiteralType */)) { return initial; } var result = initial; switch (node.kind) { // Leaf nodes - case 204 /* SemicolonClassElement */: - case 207 /* EmptyStatement */: - case 198 /* OmittedExpression */: - case 223 /* DebuggerStatement */: - case 294 /* NotEmittedStatement */: + case 205 /* SemicolonClassElement */: + case 208 /* EmptyStatement */: + case 199 /* OmittedExpression */: + case 224 /* DebuggerStatement */: + case 295 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: result = reduceNode(node.expression, cbNode, result); break; // Signature elements - case 144 /* Parameter */: + case 145 /* Parameter */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 145 /* Decorator */: + case 146 /* Decorator */: result = reduceNode(node.expression, cbNode, result); break; // Type member - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44526,12 +44792,12 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 150 /* Constructor */: + case 151 /* Constructor */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44539,7 +44805,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44547,45 +44813,45 @@ var ts; result = reduceNode(node.body, cbNode, result); break; // Binding patterns - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: result = reduceNodes(node.elements, cbNodes, result); break; - case 174 /* BindingElement */: + case 175 /* BindingElement */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Expression - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: result = reduceNodes(node.elements, cbNodes, result); break; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: result = reduceNodes(node.properties, cbNodes, result); break; - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.argumentExpression, cbNode, result); break; - case 179 /* CallExpression */: + case 180 /* CallExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 180 /* NewExpression */: + case 181 /* NewExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -44593,119 +44859,119 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 183 /* ParenthesizedExpression */: - case 186 /* DeleteExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 189 /* AwaitExpression */: - case 195 /* YieldExpression */: - case 196 /* SpreadElement */: - case 201 /* NonNullExpression */: + case 184 /* ParenthesizedExpression */: + case 187 /* DeleteExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 190 /* AwaitExpression */: + case 196 /* YieldExpression */: + case 197 /* SpreadElement */: + case 202 /* NonNullExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: result = reduceNode(node.operand, cbNode, result); break; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; // Misc - case 203 /* TemplateSpan */: + case 204 /* TemplateSpan */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; // Element - case 205 /* Block */: + case 206 /* Block */: result = reduceNodes(node.statements, cbNodes, result); break; - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 209 /* IfStatement */: + case 210 /* IfStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 210 /* DoStatement */: + case 211 /* DoStatement */: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 211 /* WhileStatement */: - case 218 /* WithStatement */: + case 212 /* WhileStatement */: + case 219 /* WithStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212 /* ForStatement */: + case 213 /* ForStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 217 /* ReturnStatement */: - case 221 /* ThrowStatement */: + case 218 /* ReturnStatement */: + case 222 /* ThrowStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 222 /* TryStatement */: + case 223 /* TryStatement */: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: result = reduceNodes(node.declarations, cbNodes, result); break; - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44714,7 +44980,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44722,101 +44988,101 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: result = reduceNodes(node.clauses, cbNodes, result); break; - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 237 /* ImportClause */: + case 238 /* ImportClause */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: result = reduceNode(node.name, cbNode, result); break; - case 239 /* NamedImports */: - case 243 /* NamedExports */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: result = reduceNodes(node.elements, cbNodes, result); break; - case 240 /* ImportSpecifier */: - case 244 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; // JSX - case 247 /* JsxElement */: + case 248 /* JsxElement */: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 248 /* JsxSelfClosingElement */: - case 249 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: result = reduceNode(node.tagName, cbNode, result); result = reduceNodes(node.attributes, cbNodes, result); break; - case 250 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: result = reduceNode(node.tagName, cbNode, result); break; - case 251 /* JsxAttribute */: + case 252 /* JsxAttribute */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 252 /* JsxSpreadAttribute */: + case 253 /* JsxSpreadAttribute */: result = reduceNode(node.expression, cbNode, result); break; - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: result = reduceNode(node.expression, cbNode, result); break; // Clauses - case 254 /* CaseClause */: + case 255 /* CaseClause */: result = reduceNode(node.expression, cbNode, result); // fall-through - case 255 /* DefaultClause */: + case 256 /* DefaultClause */: result = reduceNodes(node.statements, cbNodes, result); break; - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: result = reduceNodes(node.types, cbNodes, result); break; - case 257 /* CatchClause */: + case 258 /* CatchClause */: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; // Property assignments - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: result = reduceNode(node.expression, cbNode, result); break; // Top-level nodes - case 262 /* SourceFile */: + case 263 /* SourceFile */: result = reduceNodes(node.statements, cbNodes, result); break; - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: result = reduceNode(node.expression, cbNode, result); break; default: - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + var edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) { var edge = edgeTraversalPath_1[_i]; @@ -44962,197 +45228,197 @@ var ts; } var kind = node.kind; // No need to visit nodes with no children. - if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) { + if ((kind > 0 /* FirstToken */ && kind <= 141 /* LastToken */)) { return node; } // We do not yet support types. - if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) { + if ((kind >= 157 /* TypePredicate */ && kind <= 172 /* LiteralType */)) { return node; } switch (node.kind) { - case 204 /* SemicolonClassElement */: - case 207 /* EmptyStatement */: - case 198 /* OmittedExpression */: - case 223 /* DebuggerStatement */: + case 205 /* SemicolonClassElement */: + case 208 /* EmptyStatement */: + case 199 /* OmittedExpression */: + case 224 /* DebuggerStatement */: // No need to visit nodes with no children. return node; // Names - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); // Signature elements - case 144 /* Parameter */: + case 145 /* Parameter */: return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); // Type member - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 150 /* Constructor */: + case 151 /* Constructor */: return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); // Binding patterns - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); // Expression - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); // Misc - case 203 /* TemplateSpan */: + case 204 /* TemplateSpan */: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); // Element - case 205 /* Block */: + case 206 /* Block */: return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 209 /* IfStatement */: + case 210 /* IfStatement */: return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, /*optional*/ true, liftToBlock)); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 215 /* ContinueStatement */: + case 216 /* ContinueStatement */: return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 216 /* BreakStatement */: + case 217 /* BreakStatement */: return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true)); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, /*optional*/ true), visitNode(node.finallyBlock, visitor, ts.isBlock, /*optional*/ true)); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 237 /* ImportClause */: + case 238 /* ImportClause */: return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, /*optional*/ true)); - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 239 /* NamedImports */: + case 240 /* NamedImports */: return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); - case 240 /* ImportSpecifier */: + case 241 /* ImportSpecifier */: return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, /*optional*/ true)); - case 243 /* NamedExports */: + case 244 /* NamedExports */: return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); - case 244 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); // JSX - case 247 /* JsxElement */: + case 248 /* JsxElement */: return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 249 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 250 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 251 /* JsxAttribute */: + case 252 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 252 /* JsxSpreadAttribute */: + case 253 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 254 /* CaseClause */: + case 255 /* CaseClause */: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); - case 255 /* DefaultClause */: + case 256 /* DefaultClause */: return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Top-level nodes - case 262 /* SourceFile */: + case 263 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + var edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) { var edge = edgeTraversalPath_2[_i]; @@ -45264,7 +45530,7 @@ var ts; function aggregateTransformFlagsForSubtree(node) { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 199 /* ExpressionWithTypeArguments */)) { + if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 200 /* ExpressionWithTypeArguments */)) { return 0 /* None */; } // Aggregate the transform flags of each child. @@ -45317,7 +45583,6 @@ var ts; } } })(Debug = ts.Debug || (ts.Debug = {})); - var _a; })(ts || (ts = {})); /// /// @@ -45456,11 +45721,11 @@ var ts; } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { - var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_30 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; - var variable = ts.createVariableDeclaration(name_30, - /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name, + /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location); variable.original = original; - if (ts.isIdentifier(name_30)) { + if (ts.isIdentifier(name)) { ts.setEmitFlags(variable, 64 /* NoNestedSourceMaps */); } ts.aggregateTransformFlags(variable); @@ -45664,8 +45929,8 @@ var ts; return ts.createElementAccess(value, argumentExpression); } else { - var name_31 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); - return ts.createPropertyAccess(value, name_31); + var name = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name); } } /** @@ -45775,8 +46040,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(178 /* ElementAccessExpression */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(179 /* ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -45840,15 +46105,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 262 /* SourceFile */: - case 233 /* CaseBlock */: - case 232 /* ModuleBlock */: - case 205 /* Block */: + case 263 /* SourceFile */: + case 234 /* CaseBlock */: + case 233 /* ModuleBlock */: + case 206 /* Block */: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 227 /* ClassDeclaration */: - case 226 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 227 /* FunctionDeclaration */: if (ts.hasModifier(node, 2 /* Ambient */)) { break; } @@ -45895,13 +46160,13 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitImportDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitExportAssignment(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -45921,11 +46186,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 242 /* ExportDeclaration */ || - node.kind === 236 /* ImportDeclaration */ || - node.kind === 237 /* ImportClause */ || - (node.kind === 235 /* ImportEqualsDeclaration */ && - node.moduleReference.kind === 246 /* ExternalModuleReference */)) { + if (node.kind === 243 /* ExportDeclaration */ || + node.kind === 237 /* ImportDeclaration */ || + node.kind === 238 /* ImportClause */ || + (node.kind === 236 /* ImportEqualsDeclaration */ && + node.moduleReference.kind === 247 /* ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -45955,19 +46220,19 @@ var ts; */ function classElementVisitorWorker(node) { switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: // TypeScript constructors are transformed in `visitClassDeclaration`. // We elide them here as `visitorWorker` checks transform flags, which could // erronously include an ES6 constructor without TypeScript syntax. return undefined; - case 147 /* PropertyDeclaration */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: + case 148 /* PropertyDeclaration */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: // Fallback to the default visit behavior. return visitorWorker(node); - case 204 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -46007,47 +46272,47 @@ var ts; case 123 /* DeclareKeyword */: case 130 /* ReadonlyKeyword */: // TypeScript accessibility and readonly modifiers are elided. - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 161 /* TypeLiteral */: - case 156 /* TypePredicate */: - case 143 /* TypeParameter */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 162 /* TypeLiteral */: + case 157 /* TypePredicate */: + case 144 /* TypeParameter */: case 118 /* AnyKeyword */: case 121 /* BooleanKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: case 104 /* VoidKeyword */: - case 135 /* SymbolKeyword */: - case 159 /* ConstructorType */: - case 158 /* FunctionType */: - case 160 /* TypeQuery */: - case 157 /* TypeReference */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: - case 167 /* ThisType */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 171 /* LiteralType */: + case 136 /* SymbolKeyword */: + case 160 /* ConstructorType */: + case 159 /* FunctionType */: + case 161 /* TypeQuery */: + case 158 /* TypeReference */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* ParenthesizedType */: + case 168 /* ThisType */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 172 /* LiteralType */: // TypeScript type nodes are elided. - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: // TypeScript index signatures are elided. - case 145 /* Decorator */: + case 146 /* Decorator */: // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration. - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // TypeScript property declarations are elided. return undefined; - case 150 /* Constructor */: + case 151 /* Constructor */: return visitConstructor(node); - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return ts.createNotEmittedStatement(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: // This is a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -46058,7 +46323,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: // This is a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -46069,35 +46334,35 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 144 /* Parameter */: + case 145 /* Parameter */: // This is a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -46107,33 +46372,33 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); default: @@ -46541,7 +46806,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -46614,7 +46879,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member, isStatic) { - return member.kind === 147 /* PropertyDeclaration */ + return member.kind === 148 /* PropertyDeclaration */ && isStatic === ts.hasModifier(member, 32 /* Static */) && member.initializer !== undefined; } @@ -46749,12 +47014,12 @@ var ts; */ function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return getAllDecoratorsOfAccessors(node, member); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -46907,7 +47172,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true); var descriptor = languageVersion > 0 /* ES3 */ - ? member.kind === 147 /* PropertyDeclaration */ + ? member.kind === 148 /* PropertyDeclaration */ ? ts.createVoidZero() : ts.createNull() : undefined; @@ -47026,10 +47291,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 147 /* PropertyDeclaration */; + return kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 148 /* PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -47039,7 +47304,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 149 /* MethodDeclaration */; + return node.kind === 150 /* MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -47050,12 +47315,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return true; } return false; @@ -47067,15 +47332,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 147 /* PropertyDeclaration */: - case 144 /* Parameter */: - case 151 /* GetAccessor */: + case 148 /* PropertyDeclaration */: + case 145 /* Parameter */: + case 152 /* GetAccessor */: return serializeTypeNode(node.type); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 149 /* MethodDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 150 /* MethodDeclaration */: return ts.createIdentifier("Function"); default: return ts.createVoidZero(); @@ -47112,7 +47377,7 @@ var ts; return ts.createArrayLiteral(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 151 /* GetAccessor */) { + if (container && node.kind === 152 /* GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -47158,24 +47423,24 @@ var ts; } switch (node.kind) { case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 129 /* NeverKeyword */: return ts.createVoidZero(); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return serializeTypeNode(node.type); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return ts.createIdentifier("Function"); - case 162 /* ArrayType */: - case 163 /* TupleType */: + case 163 /* ArrayType */: + case 164 /* TupleType */: return ts.createIdentifier("Array"); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: case 121 /* BooleanKeyword */: return ts.createIdentifier("Boolean"); - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: return ts.createIdentifier("String"); - case 171 /* LiteralType */: + case 172 /* LiteralType */: switch (node.literal.kind) { case 9 /* StringLiteral */: return ts.createIdentifier("String"); @@ -47191,22 +47456,22 @@ var ts; break; case 132 /* NumberKeyword */: return ts.createIdentifier("Number"); - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: return languageVersion < 2 /* ES2015 */ ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return serializeTypeReferenceNode(node); - case 165 /* IntersectionType */: - case 164 /* UnionType */: + case 166 /* IntersectionType */: + case 165 /* UnionType */: return serializeUnionOrIntersectionType(node); - case 160 /* TypeQuery */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 161 /* TypeLiteral */: + case 161 /* TypeQuery */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 162 /* TypeLiteral */: case 118 /* AnyKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: break; default: ts.Debug.failBadSyntaxKind(node); @@ -47294,15 +47559,15 @@ var ts; case 70 /* Identifier */: // Create a clone of the name with a new parent, and treat it as if it were // a source tree node for the purposes of the checker. - var name_32 = ts.getMutableClone(node); - name_32.flags &= ~8 /* Synthesized */; - name_32.original = undefined; - name_32.parent = currentScope; + var name = ts.getMutableClone(node); + name.flags &= ~8 /* Synthesized */; + name.original = undefined; + name.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_32), ts.createLiteral("undefined")), name_32); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name); } - return name_32; - case 141 /* QualifiedName */: + return name; + case 142 /* QualifiedName */: return serializeQualifiedNameAsExpression(node, useFallback); } } @@ -47816,8 +48081,8 @@ var ts; if (!currentScopeFirstDeclarationsOfName) { currentScopeFirstDeclarationsOfName = ts.createMap(); } - if (!(name in currentScopeFirstDeclarationsOfName)) { - currentScopeFirstDeclarationsOfName[name] = node; + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } } @@ -47827,9 +48092,9 @@ var ts; */ function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_33 = node.symbol && node.symbol.name; - if (name_33) { - return currentScopeFirstDeclarationsOfName[name_33] === node; + var name = node.symbol && node.symbol.name; + if (name) { + return currentScopeFirstDeclarationsOfName.get(name) === node; } } return false; @@ -47846,7 +48111,7 @@ var ts; recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 230 /* EnumDeclaration */) { + if (node.kind === 231 /* EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -47965,7 +48230,7 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 232 /* ModuleBlock */) { + if (body.kind === 233 /* ModuleBlock */) { saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; @@ -48011,13 +48276,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (body.kind !== 232 /* ModuleBlock */) { + if (body.kind !== 233 /* ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 231 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 232 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -48058,7 +48323,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 238 /* NamespaceImport */) { + if (node.kind === 239 /* NamespaceImport */) { // Elide a namespace import if it is not referenced. return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } @@ -48281,7 +48546,7 @@ var ts; // substitute class names inside of a class declaration. context.enableSubstitution(70 /* Identifier */); // Keep track of class aliases. - classAliases = ts.createMap(); + classAliases = []; } } function enableSubstitutionForNamespaceExports() { @@ -48290,16 +48555,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(70 /* Identifier */); - context.enableSubstitution(259 /* ShorthandPropertyAssignment */); + context.enableSubstitution(260 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(231 /* ModuleDeclaration */); + context.enableEmitNotification(232 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 231 /* ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 232 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 230 /* EnumDeclaration */; + return ts.getOriginalNode(node).kind === 231 /* EnumDeclaration */; } /** * Hook for node emit. @@ -48337,16 +48602,16 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2 /* NamespaceExports */) { - var name_34 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_34); + var name = node.name; + var exportedName = trySubstituteNamespaceExportedName(name); if (exportedName) { // A shorthand property with an assignment initializer is probably part of a // destructuring assignment if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_34, initializer, /*location*/ node); + return ts.createPropertyAssignment(name, initializer, /*location*/ node); } - return ts.createPropertyAssignment(name_34, exportedName, /*location*/ node); + return ts.createPropertyAssignment(name, exportedName, /*location*/ node); } } return node; @@ -48355,9 +48620,9 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -48395,9 +48660,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 262 /* SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 231 /* ModuleDeclaration */) || - (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 230 /* EnumDeclaration */); + if (container && container.kind !== 263 /* SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 232 /* ModuleDeclaration */) || + (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 231 /* EnumDeclaration */); if (substitute) { return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, /*location*/ node); } @@ -48513,37 +48778,37 @@ var ts; return node; } switch (node.kind) { - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node, noDestructuringValue); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return visitForOfStatement(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return visitVoidExpression(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return visitConstructorDeclaration(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: return visitGetAccessorDeclaration(node); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return visitArrowFunction(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return visitParameter(node); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return visitExpressionStatement(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); default: return ts.visitEachChild(node, visitor, context); @@ -48554,7 +48819,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 260 /* SpreadAssignment */) { + if (e.kind === 261 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -48566,7 +48831,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 258 /* PropertyAssignment */) { + if (e.kind === 259 /* PropertyAssignment */) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -48588,7 +48853,7 @@ var ts; // If the first element is a spread element, then the first argument to __assign is {}: // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 177 /* ObjectLiteralExpression */) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -48755,6 +49020,10 @@ var ts; text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" }; function createAssignHelper(context, attributesSegments) { + if (context.getCompilerOptions().target >= 2 /* ES2015 */) { + return ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), + /*typeArguments*/ undefined, attributesSegments); + } context.requestEmitHelper(assignHelper); return ts.createCall(ts.getHelperName("__assign"), /*typeArguments*/ undefined, attributesSegments); @@ -48796,11 +49065,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 247 /* JsxElement */: + case 248 /* JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -48810,11 +49079,11 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return visitJsxExpression(node); - case 247 /* JsxElement */: + case 248 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); default: ts.Debug.failBadSyntaxKind(node); @@ -48875,7 +49144,7 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.createLiteral(decoded, /*location*/ node) : node; } - else if (node.kind === 253 /* JsxExpression */) { + else if (node.kind === 254 /* JsxExpression */) { if (node.expression === undefined) { return ts.createLiteral(true); } @@ -48886,54 +49155,61 @@ var ts; } } function visitJsxText(node) { - var text = ts.getTextOfNode(node, /*includeTrivia*/ true); - var parts; + var fixed = fixupWhitespaceAndDecodeEntities(ts.getTextOfNode(node, /*includeTrivia*/ true)); + return fixed === undefined ? undefined : ts.createLiteral(fixed); + } + /** + * JSX trims whitespace at the end and beginning of lines, except that the + * start/end of a tag is considered a start/end of a line only if that line is + * on the same line as the closing tag. See examples in + * tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + * See also https://www.w3.org/TR/html4/struct/text.html#h-9.1 and https://www.w3.org/TR/CSS2/text.html#white-space-model + * + * An equivalent algorithm would be: + * - If there is only one line, return it. + * - If there is only whitespace (but multiple lines), return `undefined`. + * - Split the text into lines. + * - 'trimRight' the first line, 'trimLeft' the last line, 'trim' middle lines. + * - Decode entities on each line (individually). + * - Remove empty lines and join the rest with " ". + */ + function fixupWhitespaceAndDecodeEntities(text) { + var acc; + // First non-whitespace character on this line. var firstNonWhitespace = 0; + // Last non-whitespace character on this line. var lastNonWhitespace = -1; - // JSX trims whitespace at the end and beginning of lines, except that the - // start/end of a tag is considered a start/end of a line only if that line is - // on the same line as the closing tag. See examples in - // tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + // These initial values are special because the first line is: + // firstNonWhitespace = 0 to indicate that we want leading whitsepace, + // but lastNonWhitespace = -1 as a special flag to indicate that we *don't* include the line if it's all whitespace. for (var i = 0; i < text.length; i++) { var c = text.charCodeAt(i); if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - if (!parts) { - parts = []; - } - // We do not escape the string here as that is handled by the printer - // when it emits the literal. We do, however, need to decode JSX entities. - parts.push(ts.createLiteral(decodeEntities(part))); + // If we've seen any non-whitespace characters on this line, add the 'trim' of the line. + // (lastNonWhitespace === -1 is a special flag to detect whether the first line is all whitespace.) + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); } + // Reset firstNonWhitespace for the next line. + // Don't bother to reset lastNonWhitespace because we ignore it if firstNonWhitespace = -1. firstNonWhitespace = -1; } - else if (!ts.isWhiteSpace(c)) { + else if (!ts.isWhiteSpaceSingleLine(c)) { lastNonWhitespace = i; if (firstNonWhitespace === -1) { firstNonWhitespace = i; } } } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - if (!parts) { - parts = []; - } - // We do not escape the string here as that is handled by the printer - // when it emits the literal. We do, however, need to decode JSX entities. - parts.push(ts.createLiteral(decodeEntities(part))); - } - if (parts) { - return ts.reduceLeft(parts, aggregateJsxTextParts); - } - return undefined; + return firstNonWhitespace !== -1 + ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) + : acc; } - /** - * Aggregates two expressions by interpolating them with a whitespace literal. - */ - function aggregateJsxTextParts(left, right) { - return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right); + function addLineOfJsxText(acc, trimmedLine) { + // We do not escape the string here as that is handled by the printer + // when it emits the literal. We do, however, need to decode JSX entities. + var decoded = decodeEntities(trimmedLine); + return acc === undefined ? decoded : acc + " " + decoded; } /** * Replace entities like " ", "{", and "�" with the characters they encode. @@ -48948,7 +49224,7 @@ var ts; return String.fromCharCode(parseInt(hex, 16)); } else { - var ch = entities[word]; + var ch = entities.get(word); // If this is not a valid entity, then just use `match` (replace it with itself, i.e. don't replace) return ch ? String.fromCharCode(ch) : match; } @@ -48960,16 +49236,16 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 247 /* JsxElement */) { + if (node.kind === 248 /* JsxElement */) { return getTagName(node.openingElement); } else { - var name_35 = node.tagName; - if (ts.isIdentifier(name_35) && ts.isIntrinsicJsxName(name_35.text)) { - return ts.createLiteral(name_35.text); + var name = node.tagName; + if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.text)) { + return ts.createLiteral(name.text); } else { - return ts.createExpressionFromEntityName(name_35); + return ts.createExpressionFromEntityName(name); } } } @@ -48992,7 +49268,7 @@ var ts; } } ts.transformJsx = transformJsx; - var entities = ts.createMap({ + var entities = ts.createMapFromTemplate({ "quot": 0x0022, "amp": 0x0026, "apos": 0x0027, @@ -49300,19 +49576,19 @@ var ts; case 119 /* AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: // ES2017 'await' expressions must be transformed for targets < ES2017. return visitAwaitExpression(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: // ES2017 method declarations may be 'async' return visitMethodDeclaration(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: // ES2017 function declarations may be 'async' return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: // ES2017 function expressions may be 'async' return visitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: // ES2017 arrow functions may be 'async' return visitArrowFunction(node); default: @@ -49402,7 +49678,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 185 /* ArrowFunction */; + var isArrowFunction = node.kind === 186 /* ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -49466,24 +49742,24 @@ var ts; enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(179 /* CallExpression */); - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(178 /* ElementAccessExpression */); + context.enableSubstitution(180 /* CallExpression */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(179 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(227 /* ClassDeclaration */); - context.enableEmitNotification(149 /* MethodDeclaration */); - context.enableEmitNotification(151 /* GetAccessor */); - context.enableEmitNotification(152 /* SetAccessor */); - context.enableEmitNotification(150 /* Constructor */); + context.enableEmitNotification(228 /* ClassDeclaration */); + context.enableEmitNotification(150 /* MethodDeclaration */); + context.enableEmitNotification(152 /* GetAccessor */); + context.enableEmitNotification(153 /* SetAccessor */); + context.enableEmitNotification(151 /* Constructor */); } } function substituteExpression(node) { switch (node.kind) { - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) { return substituteCallExpression(node); } @@ -49527,11 +49803,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 227 /* ClassDeclaration */ - || kind === 150 /* Constructor */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */; + return kind === 228 /* ClassDeclaration */ + || kind === 151 /* Constructor */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */; } /** * Hook for node emit. @@ -49636,7 +49912,7 @@ var ts; return node; } switch (node.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -49869,7 +50145,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ - && node.kind === 217 /* ReturnStatement */ + && node.kind === 218 /* ReturnStatement */ && !node.expression; } function shouldVisitNode(node) { @@ -49902,91 +50178,91 @@ var ts; switch (node.kind) { case 114 /* StaticKeyword */: return undefined; // elide static keyword - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return visitClassDeclaration(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return visitClassExpression(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return visitParameter(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return visitArrowFunction(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); case 70 /* Identifier */: return visitIdentifier(node); - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitSwitchStatement(node); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return visitCaseBlock(node); - case 205 /* Block */: + case 206 /* Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 216 /* BreakStatement */: - case 215 /* ContinueStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: return visitBreakOrContinueStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitLabeledStatement(node); - case 210 /* DoStatement */: - case 211 /* WhileStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return visitExpressionStatement(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return visitCatchClause(node); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node, /*needsDestructuringValue*/ true); case 12 /* NoSubstitutionTemplateLiteral */: case 13 /* TemplateHead */: case 14 /* TemplateMiddle */: case 15 /* TemplateTail */: return visitTemplateLiteral(node); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return visitTemplateExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitYieldExpression(node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return visitSpreadElement(node); case 96 /* SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 98 /* ThisKeyword */: return visitThisKeyword(node); - case 202 /* MetaProperty */: + case 203 /* MetaProperty */: return visitMetaProperty(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return visitAccessorDeclaration(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return visitVariableStatement(node); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context); @@ -50058,7 +50334,7 @@ var ts; if (ts.isGeneratedIdentifier(node)) { return node; } - if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) { + if (node.text !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { return node; } return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); @@ -50069,13 +50345,13 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 216 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + var jump = node.kind === 217 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 216 /* BreakStatement */) { + if (node.kind === 217 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } @@ -50086,7 +50362,7 @@ var ts; } } else { - if (node.kind === 216 /* BreakStatement */) { + if (node.kind === 217 /* BreakStatement */) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); } @@ -50382,17 +50658,17 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 217 /* ReturnStatement */) { + if (statement.kind === 218 /* ReturnStatement */) { return true; } - else if (statement.kind === 209 /* IfStatement */) { + else if (statement.kind === 210 /* IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 205 /* Block */) { + else if (statement.kind === 206 /* Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -50450,7 +50726,7 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { + if (firstStatement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } @@ -50460,8 +50736,8 @@ var ts; && statementOffset === ctorStatements.length - 1 && !(ctor.transformFlags & (16384 /* ContainsLexicalThis */ | 32768 /* ContainsCapturedLexicalThis */))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 192 /* BinaryExpression */ - || superCallExpression.left.kind !== 179 /* CallExpression */) { + if (superCallExpression.kind !== 193 /* BinaryExpression */ + || superCallExpression.left.kind !== 180 /* CallExpression */) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } // Shift comments from the original super call to the return statement. @@ -50544,17 +50820,17 @@ var ts; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - var name_36 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; // A rest parameter cannot have a binding pattern or an initializer, // so let's just ignore it. if (dotDotDotToken) { continue; } - if (ts.isBindingPattern(name_36)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_36, initializer); + if (ts.isBindingPattern(name)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer); } else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_36, initializer); + addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer); } } } @@ -50661,7 +50937,7 @@ var ts; * @param node A node. */ function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) { + if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 186 /* ArrowFunction */) { captureThisForNode(statements, node, ts.createThis()); } } @@ -50680,22 +50956,22 @@ var ts; if (hierarchyFacts & 16384 /* NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return statements; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = ts.createVoidZero(); break; - case 150 /* Constructor */: + case 151 /* Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"); break; - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 92 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero()); @@ -50727,20 +51003,20 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 204 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 150 /* Constructor */: + case 151 /* Constructor */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -50931,7 +51207,7 @@ var ts; : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */)) { + if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 227 /* FunctionDeclaration */ || node.kind === 185 /* FunctionExpression */)) { name = ts.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); @@ -50977,7 +51253,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 185 /* ArrowFunction */); + ts.Debug.assert(node.kind === 186 /* ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -51042,9 +51318,9 @@ var ts; function visitExpressionStatement(node) { // If we are here it is most likely because our expression is a destructuring assignment. switch (node.expression.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } return ts.visitEachChild(node, visitor, context); @@ -51060,9 +51336,9 @@ var ts; // If we are here it is most likely because our expression is a destructuring assignment. if (!needsDestructuringValue) { switch (node.expression.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } } @@ -51245,10 +51521,10 @@ var ts; return updated; } function recordLabel(node) { - convertedLoopState.labels[node.label.text] = node.label.text; + convertedLoopState.labels.set(node.label.text, node.label.text); } function resetLabel(node) { - convertedLoopState.labels[node.label.text] = undefined; + convertedLoopState.labels.set(node.label.text, undefined); } function visitLabeledStatement(node) { if (convertedLoopState && !convertedLoopState.labels) { @@ -51364,7 +51640,7 @@ var ts; ts.addRange(statements, convertedLoopBodyStatements); } else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); bodyLocation = statement; @@ -51393,14 +51669,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 210 /* DoStatement */: - case 211 /* WhileStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -51423,7 +51699,7 @@ var ts; && i < numInitialPropertiesWithoutYield) { numInitialPropertiesWithoutYield = i; } - if (property.name.kind === 142 /* ComputedPropertyName */) { + if (property.name.kind === 143 /* ComputedPropertyName */) { numInitialProperties = i; break; } @@ -51496,11 +51772,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 225 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 226 /* VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -51718,26 +51994,25 @@ var ts; if (!state.labeledNonLocalBreaks) { state.labeledNonLocalBreaks = ts.createMap(); } - state.labeledNonLocalBreaks[labelText] = labelMarker; + state.labeledNonLocalBreaks.set(labelText, labelMarker); } else { if (!state.labeledNonLocalContinues) { state.labeledNonLocalContinues = ts.createMap(); } - state.labeledNonLocalContinues[labelText] = labelMarker; + state.labeledNonLocalContinues.set(labelText, labelMarker); } } function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { if (!table) { return; } - for (var labelText in table) { - var labelMarker = table[labelText]; + table.forEach(function (labelMarker, labelText) { var statements = []; // if there are no outer converted loop or outer label in question is located inside outer converted loop // then emit labeled break\continue // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) { var label = ts.createIdentifier(labelText); statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)); } @@ -51746,7 +52021,7 @@ var ts; statements.push(ts.createReturn(loopResultName)); } caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)); - } + }); } function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { var name = decl.name; @@ -51781,20 +52056,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -52040,7 +52315,7 @@ var ts; })); if (segments.length === 1) { var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 /* ArrayLiteralExpression */ + return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 176 /* ArrayLiteralExpression */ ? ts.createArraySlice(segments[0]) : segments[0]; } @@ -52273,13 +52548,13 @@ var ts; if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) { enabledSubstitutions |= 1 /* CapturedThis */; context.enableSubstitution(98 /* ThisKeyword */); - context.enableEmitNotification(150 /* Constructor */); - context.enableEmitNotification(149 /* MethodDeclaration */); - context.enableEmitNotification(151 /* GetAccessor */); - context.enableEmitNotification(152 /* SetAccessor */); - context.enableEmitNotification(185 /* ArrowFunction */); - context.enableEmitNotification(184 /* FunctionExpression */); - context.enableEmitNotification(226 /* FunctionDeclaration */); + context.enableEmitNotification(151 /* Constructor */); + context.enableEmitNotification(150 /* MethodDeclaration */); + context.enableEmitNotification(152 /* GetAccessor */); + context.enableEmitNotification(153 /* SetAccessor */); + context.enableEmitNotification(186 /* ArrowFunction */); + context.enableEmitNotification(185 /* FunctionExpression */); + context.enableEmitNotification(227 /* FunctionDeclaration */); } } /** @@ -52321,10 +52596,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 174 /* BindingElement */: - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: - case 224 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 225 /* VariableDeclaration */: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -52382,11 +52657,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 208 /* ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 209 /* ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179 /* CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 180 /* CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -52394,7 +52669,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196 /* SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 197 /* SpreadElement */) { return false; } var expression = callArgument.expression; @@ -52589,13 +52864,15 @@ var ts; Instruction[Instruction["Catch"] = 6] = "Catch"; Instruction[Instruction["Endfinally"] = 7] = "Endfinally"; })(Instruction || (Instruction = {})); - var instructionNames = ts.createMap((_a = {}, - _a[2 /* Return */] = "return", - _a[3 /* Break */] = "break", - _a[4 /* Yield */] = "yield", - _a[5 /* YieldStar */] = "yield*", - _a[7 /* Endfinally */] = "endfinally", - _a)); + function getInstructionName(instruction) { + switch (instruction) { + case 2 /* Return */: return "return"; + case 3 /* Break */: return "break"; + case 4 /* Yield */: return "yield"; + case 5 /* YieldStar */: return "yield*"; + case 7 /* Endfinally */: return "endfinally"; + } + } function transformGenerators(context) { var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); @@ -52687,13 +52964,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 210 /* DoStatement */: + case 211 /* DoStatement */: return visitDoStatement(node); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return visitWhileStatement(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitSwitchStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -52706,24 +52983,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return visitAccessorDeclaration(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return visitVariableStatement(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return visitForInStatement(node); - case 216 /* BreakStatement */: + case 217 /* BreakStatement */: return visitBreakStatement(node); - case 215 /* ContinueStatement */: + case 216 /* ContinueStatement */: return visitContinueStatement(node); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 16777216 /* ContainsYield */) { @@ -52744,21 +53021,21 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return visitConditionalExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitYieldExpression(node); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -52771,9 +53048,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); default: ts.Debug.failBadSyntaxKind(node); @@ -53001,7 +53278,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: // [source] // a.b = yield; // @@ -53013,7 +53290,7 @@ var ts; // _a.b = %sent%; target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: // [source] // a[b] = yield; // @@ -53388,35 +53665,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 205 /* Block */: + case 206 /* Block */: return transformAndEmitBlock(node); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 209 /* IfStatement */: + case 210 /* IfStatement */: return transformAndEmitIfStatement(node); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return transformAndEmitDoStatement(node); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return transformAndEmitForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 215 /* ContinueStatement */: + case 216 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 216 /* BreakStatement */: + case 217 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return transformAndEmitWithStatement(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement, /*optional*/ true)); @@ -53436,9 +53713,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - var name_37 = ts.getSynthesizedClone(variable.name); - ts.setCommentRange(name_37, variable.name); - hoistVariableDeclaration(name_37); + var name = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -53838,7 +54115,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 255 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 256 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -53851,7 +54128,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 254 /* CaseClause */) { + if (clause.kind === 255 /* CaseClause */) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -54007,14 +54284,14 @@ var ts; return node; } function substituteExpressionIdentifier(node) { - if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) { + if (renamedCatchVariables && renamedCatchVariables.has(node.text)) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_38 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_38) { - var clone_7 = ts.getMutableClone(name_38); + var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)]; + if (name) { + var clone_7 = ts.getMutableClone(name); ts.setSourceMapRange(clone_7, node); ts.setCommentRange(clone_7, node); return clone_7; @@ -54158,10 +54435,10 @@ var ts; var name = declareLocal(text); if (!renamedCatchVariables) { renamedCatchVariables = ts.createMap(); - renamedCatchVariableDeclarations = ts.createMap(); + renamedCatchVariableDeclarations = []; context.enableSubstitution(70 /* Identifier */); } - renamedCatchVariables[text] = true; + renamedCatchVariables.set(text, true); renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; var exception = peekBlock(); ts.Debug.assert(exception.state < 1 /* Catch */); @@ -54432,7 +54709,7 @@ var ts; */ function createInstruction(instruction) { var literal = ts.createLiteral(instruction); - literal.trailingComment = instructionNames[instruction]; + literal.trailingComment = getInstructionName(instruction); return literal; } /** @@ -55051,7 +55328,6 @@ var ts; priority: 6, text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; - var _a; })(ts || (ts = {})); /// /// @@ -55065,21 +55341,21 @@ var ts; */ function transformES5(context) { var compilerOptions = context.getCompilerOptions(); - // enable emit notification only if using --jsx preserve + // enable emit notification only if using --jsx preserve or react-native var previousOnEmitNode; var noSubstitution; - if (compilerOptions.jsx === 1 /* Preserve */) { + if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(249 /* JsxOpeningElement */); - context.enableEmitNotification(250 /* JsxClosingElement */); - context.enableEmitNotification(248 /* JsxSelfClosingElement */); + context.enableEmitNotification(250 /* JsxOpeningElement */); + context.enableEmitNotification(251 /* JsxClosingElement */); + context.enableEmitNotification(249 /* JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(258 /* PropertyAssignment */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(259 /* PropertyAssignment */); return transformSourceFile; /** * Transforms an ES5 source file to ES3. @@ -55096,9 +55372,9 @@ var ts; */ function onEmitNode(emitContext, node, emitCallback) { switch (node.kind) { - case 249 /* JsxOpeningElement */: - case 250 /* JsxClosingElement */: - case 248 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: + case 251 /* JsxClosingElement */: + case 249 /* JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -55174,7 +55450,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(262 /* SourceFile */); + context.enableEmitNotification(263 /* SourceFile */); context.enableSubstitution(70 /* Identifier */); var currentSourceFile; return transformSourceFile; @@ -55201,10 +55477,10 @@ var ts; } function visitor(node) { switch (node.kind) { - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // Elide `import=` as it is not legal with --module ES6 return undefined; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitExportAssignment(node); } return node; @@ -55276,14 +55552,14 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(262 /* SourceFile */); // Restore state when substituting nodes in a file. - var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. - var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. - var exportFunctionsMap = ts.createMap(); // The export function associated with a source file. - var noSubstitutionMap = ts.createMap(); // Set of nodes for which substitution rules should be ignored for each file. + context.enableSubstitution(193 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(191 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(192 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableEmitNotification(263 /* SourceFile */); // Restore state when substituting nodes in a file. + var moduleInfoMap = []; // The ExternalModuleInfo for each file. + var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. + var exportFunctionsMap = []; // The export function associated with a source file. + var noSubstitutionMap = []; // Set of nodes for which substitution rules should be ignored for each file. var currentSourceFile; // The current file. var moduleInfo; // ExternalModuleInfo for the current file. var exportFunction; // The export function for the current file. @@ -55322,7 +55598,8 @@ var ts; moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); // Make sure that the name of the 'exports' function does not conflict with // existing identifiers. - exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); + exportFunction = ts.createUniqueName("exports"); + exportFunctionsMap[id] = exportFunction; contextObject = ts.createUniqueName("context"); // Add the body of the module. var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); @@ -55374,13 +55651,13 @@ var ts; var externalImport = externalImports[i]; var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); var text = externalModuleName.text; - if (ts.hasProperty(groupIndices, text)) { + var groupIndex = groupIndices.get(text); + if (groupIndex !== undefined) { // deduplicate/group entries in dependency list by the dependency name - var groupIndex = groupIndices[text]; dependencyGroups[groupIndex].externalImports.push(externalImport); } else { - groupIndices[text] = dependencyGroups.length; + groupIndices.set(text, dependencyGroups.length); dependencyGroups.push({ name: externalModuleName, externalImports: [externalImport] @@ -55493,13 +55770,13 @@ var ts; // to support this we store names of local/indirect exported entries in a set. // this set is used to filter names brought by star expors. // local names set should only be added if we have anything exported - if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) { + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { // no exported declarations (export var ...) or export specifiers (export {x}) // check if we have any non star export declarations. var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 242 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 243 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -55524,7 +55801,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 242 /* ExportDeclaration */) { + if (externalImport.kind !== 243 /* ExportDeclaration */) { continue; } var exportDecl = externalImport; @@ -55605,19 +55882,19 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // fall-through - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -55667,15 +55944,15 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitImportDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: // ExportDeclarations are elided as they are handled via // `appendExportsOfDeclaration`. return undefined; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -55853,7 +56130,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 262 /* SourceFile */ + && (enclosingBlockScopedContainer.kind === 263 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } /** @@ -55917,7 +56194,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -55973,10 +56250,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 239 /* NamedImports */: + case 240 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -56094,7 +56371,7 @@ var ts; return statements; } var name = ts.getDeclarationName(decl); - var exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; @@ -56155,43 +56432,43 @@ var ts; */ function nestedElementVisitor(node) { switch (node.kind) { - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return visitVariableStatement(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return visitClassDeclaration(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return visitForInStatement(node); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return visitForOfStatement(node); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return visitDoStatement(node); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return visitWhileStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitLabeledStatement(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return visitWithStatement(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitSwitchStatement(node); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return visitCaseBlock(node); - case 254 /* CaseClause */: + case 255 /* CaseClause */: return visitCaseClause(node); - case 255 /* DefaultClause */: + case 256 /* DefaultClause */: return visitDefaultClause(node); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return visitTryStatement(node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return visitCatchClause(node); - case 205 /* Block */: + case 206 /* Block */: return visitBlock(node); - case 296 /* MergeDeclarationMarker */: + case 297 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 297 /* EndOfDeclarationMarker */: + case 298 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -56371,7 +56648,7 @@ var ts; */ function destructuringVisitor(node) { if (node.transformFlags & 1024 /* DestructuringAssignment */ - && node.kind === 192 /* BinaryExpression */) { + && node.kind === 193 /* BinaryExpression */) { return visitDestructuringAssignment(node); } else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) { @@ -56419,7 +56696,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 262 /* SourceFile */; + return container !== undefined && container.kind === 263 /* SourceFile */; } else { return false; @@ -56452,7 +56729,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 262 /* SourceFile */) { + if (node.kind === 263 /* SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -56499,10 +56776,10 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return substituteBinaryExpression(node); - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -56595,7 +56872,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 /* PostfixUnaryExpression */ + var expression = node.kind === 192 /* PostfixUnaryExpression */ ? ts.createPrefix(node.operator, node.operand, /*location*/ node) : node; @@ -56603,7 +56880,7 @@ var ts; var exportName = exportedNames_2[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 191 /* PostfixUnaryExpression */) { + if (node.kind === 192 /* PostfixUnaryExpression */) { expression = node.operator === 42 /* PlusPlusToken */ ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -56625,7 +56902,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 262 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 263 /* SourceFile */) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -56640,7 +56917,7 @@ var ts; */ function preventSubstitution(node) { if (noSubstitution === undefined) - noSubstitution = ts.createMap(); + noSubstitution = []; noSubstitution[ts.getNodeId(node)] = true; return node; } @@ -56661,12 +56938,13 @@ var ts; var ts; (function (ts) { function transformModule(context) { - var transformModuleDelegates = ts.createMap((_a = {}, - _a[ts.ModuleKind.None] = transformCommonJSModule, - _a[ts.ModuleKind.CommonJS] = transformCommonJSModule, - _a[ts.ModuleKind.AMD] = transformAMDModule, - _a[ts.ModuleKind.UMD] = transformUMDModule, - _a)); + function getTransformModuleDelegate(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.AMD: return transformAMDModule; + case ts.ModuleKind.UMD: return transformUMDModule; + default: return transformCommonJSModule; + } + } var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); @@ -56678,13 +56956,13 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(259 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(262 /* SourceFile */); // Restore state when substituting nodes in a file. - var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. - var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. + context.enableSubstitution(193 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(191 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(192 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(260 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(263 /* SourceFile */); // Restore state when substituting nodes in a file. + var moduleInfoMap = []; // The ExternalModuleInfo for each file. + var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. var currentModuleInfo; // The ExternalModuleInfo for the current file. var noSubstitution; // Set of nodes for which substitution rules should be ignored. @@ -56701,9 +56979,10 @@ var ts; return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + currentModuleInfo = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; // Perform the transformation. - var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; + var transformModule = getTransformModuleDelegate(moduleKind); var updated = transformModule(node); currentSourceFile = undefined; currentModuleInfo = undefined; @@ -56957,23 +57236,23 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitImportDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return visitExportDeclaration(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitExportAssignment(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return visitVariableStatement(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return visitClassDeclaration(node); - case 296 /* MergeDeclarationMarker */: + case 297 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 297 /* EndOfDeclarationMarker */: + case 298 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: // This visitor does not descend into the tree, as export/import statements @@ -57285,7 +57564,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -57340,10 +57619,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 239 /* NamedImports */: + case 240 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -57445,7 +57724,7 @@ var ts; */ function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl); - var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; @@ -57469,7 +57748,7 @@ var ts; function appendExportStatement(statements, exportName, expression, location, allowComments) { if (exportName.text === "default") { var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile); - if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { + if (sourceFile && !sourceFile.symbol.exports.get("___esModule")) { if (languageVersion === 0 /* ES3 */) { statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true)))); } @@ -57542,10 +57821,10 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 262 /* SourceFile */) { + if (node.kind === 263 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; - noSubstitution = ts.createMap(); + noSubstitution = []; previousOnEmitNode(emitContext, node, emitCallback); currentSourceFile = undefined; currentModuleInfo = undefined; @@ -57606,10 +57885,10 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return substituteBinaryExpression(node); - case 191 /* PostfixUnaryExpression */: - case 190 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -57630,7 +57909,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 262 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 263 /* SourceFile */) { return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), /*location*/ node); } @@ -57641,8 +57920,8 @@ var ts; /*location*/ node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_39 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_39), + var name = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name), /*location*/ node); } } @@ -57705,7 +57984,7 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 /* PostfixUnaryExpression */ + var expression = node.kind === 192 /* PostfixUnaryExpression */ ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 /* PlusPlusToken */ ? 58 /* PlusEqualsToken */ : 59 /* MinusEqualsToken */), ts.createLiteral(1), /*location*/ node) : node; @@ -57735,7 +58014,6 @@ var ts; } } } - var _a; } ts.transformModule = transformModule; // emit output for the __export helper function @@ -57760,14 +58038,16 @@ var ts; /* @internal */ var ts; (function (ts) { - var moduleTransformerMap = ts.createMap((_a = {}, - _a[ts.ModuleKind.ES2015] = ts.transformES2015Module, - _a[ts.ModuleKind.System] = ts.transformSystemModule, - _a[ts.ModuleKind.AMD] = ts.transformModule, - _a[ts.ModuleKind.CommonJS] = ts.transformModule, - _a[ts.ModuleKind.UMD] = ts.transformModule, - _a[ts.ModuleKind.None] = ts.transformModule, - _a)); + function getModuleTransformer(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.ES2015: + return ts.transformES2015Module; + case ts.ModuleKind.System: + return ts.transformSystemModule; + default: + return ts.transformModule; + } + } var SyntaxKindFeatureFlags; (function (SyntaxKindFeatureFlags) { SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution"; @@ -57795,7 +58075,7 @@ var ts; transformers.push(ts.transformES2015); transformers.push(ts.transformGenerators); } - transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]); + transformers.push(getModuleTransformer(moduleKind)); // The ES5 transformer is last so that it can substitute expressions like `exports.default` // for ES3. if (languageVersion < 1 /* ES5 */) { @@ -57813,7 +58093,7 @@ var ts; * @param transforms An array of Transformers. */ function transformFiles(resolver, host, sourceFiles, transformers) { - var enabledSyntaxKindFeatures = new Array(298 /* Count */); + var enabledSyntaxKindFeatures = new Array(299 /* Count */); var lexicalEnvironmentDisabled = false; var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; @@ -58028,7 +58308,6 @@ var ts; } } ts.transformFiles = transformFiles; - var _a; })(ts || (ts = {})); /// /* @internal */ @@ -58250,7 +58529,7 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 294 /* NotEmittedStatement */ + if (node.kind !== 295 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); @@ -58263,7 +58542,7 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 294 /* NotEmittedStatement */ + if (node.kind !== 295 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -58442,7 +58721,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 294 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 295 /* NotEmittedStatement */; var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0; // Emit leading comments if the position is not synthesized and the node @@ -58461,7 +58740,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 225 /* VariableDeclarationList */) { + if (node.kind === 226 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -58692,7 +58971,7 @@ var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); - ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + ts.forEachEmittedFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { var declarationFilePath = _a.declarationFilePath; @@ -58774,7 +59053,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 236 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 237 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -58800,9 +59079,9 @@ var ts; } }); if (usedTypeDirectiveReferences) { - for (var directive in usedTypeDirectiveReferences) { + ts.forEachKey(usedTypeDirectiveReferences, function (directive) { referencesOutput += "/// " + newLine; - } + }); } return { reportedDeclarationError: reportedDeclarationError, @@ -58849,10 +59128,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 224 /* VariableDeclaration */) { + if (declaration.kind === 225 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 239 /* NamedImports */ || declaration.kind === 240 /* ImportSpecifier */ || declaration.kind === 237 /* ImportClause */) { + else if (declaration.kind === 240 /* NamedImports */ || declaration.kind === 241 /* ImportSpecifier */ || declaration.kind === 238 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -58870,7 +59149,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 === 236 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 237 /* 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; @@ -58880,12 +59159,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 231 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 232 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 231 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 232 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -58904,8 +59183,8 @@ var ts; } for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { var directive = typeReferenceDirectives_1[_i]; - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + if (!usedTypeDirectiveReferences.has(directive)) { + usedTypeDirectiveReferences.set(directive, directive); } } } @@ -59003,49 +59282,50 @@ var ts; function emitType(type) { switch (type.kind) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 133 /* ObjectKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 129 /* NeverKeyword */: - case 167 /* ThisType */: - case 171 /* LiteralType */: + case 168 /* ThisType */: + case 172 /* LiteralType */: return writeTextOfNode(currentText, type); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return emitTypeReference(type); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return emitTypeQuery(type); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return emitArrayType(type); - case 163 /* TupleType */: + case 164 /* TupleType */: return emitTupleType(type); - case 164 /* UnionType */: + case 165 /* UnionType */: return emitUnionType(type); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return emitIntersectionType(type); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return emitParenType(type); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return emitTypeOperator(type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return emitIndexedAccessType(type); - case 170 /* MappedType */: + case 171 /* MappedType */: return emitMappedType(type); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return emitTypeLiteral(type); case 70 /* Identifier */: return emitEntityName(type); - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return emitEntityName(type); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -59053,8 +59333,8 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 141 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 141 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 142 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 142 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); @@ -59063,14 +59343,14 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 235 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 236 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isEntityNameExpression(node.expression)) { - ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 177 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 178 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -59179,15 +59459,15 @@ var ts; // do not need to keep track of created temp names. function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!(baseName in currentIdentifiers)) { + if (!currentIdentifiers.has(baseName)) { return baseName; } var count = 0; while (true) { count++; - var name_40 = baseName + "_" + count; - if (!(name_40 in currentIdentifiers)) { - return name_40; + var name = baseName + "_" + count; + if (!currentIdentifiers.has(name)) { + return name; } } } @@ -59234,10 +59514,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 235 /* ImportEqualsDeclaration */ || - (node.parent.kind === 262 /* SourceFile */ && isCurrentFileExternalModule)) { + else if (node.kind === 236 /* ImportEqualsDeclaration */ || + (node.parent.kind === 263 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 262 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 263 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -59247,7 +59527,7 @@ var ts; }); } else { - if (node.kind === 236 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -59265,23 +59545,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return writeVariableStatement(node); - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return writeClassDeclaration(node); - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -59289,7 +59569,7 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 262 /* SourceFile */) { + if (node.parent.kind === 263 /* SourceFile */) { var modifiers = ts.getModifierFlags(node); // If the node is exported if (modifiers & 1 /* Export */) { @@ -59298,7 +59578,7 @@ var ts; if (modifiers & 512 /* Default */) { write("default "); } - else if (node.kind !== 228 /* InterfaceDeclaration */ && !noDeclare) { + else if (node.kind !== 229 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } @@ -59350,7 +59630,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 238 /* NamespaceImport */) { + if (namedBindings.kind === 239 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -59374,7 +59654,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 238 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 239 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -59395,13 +59675,13 @@ var ts; // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' // so compiler will treat them as external modules. - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 231 /* ModuleDeclaration */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 232 /* ModuleDeclaration */; var moduleSpecifier; - if (parent.kind === 235 /* ImportEqualsDeclaration */) { + if (parent.kind === 236 /* ImportEqualsDeclaration */) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 231 /* ModuleDeclaration */) { + else if (parent.kind === 232 /* ModuleDeclaration */) { moduleSpecifier = parent.name; } else { @@ -59471,7 +59751,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 232 /* ModuleBlock */) { + while (node.body && node.body.kind !== 233 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -59541,7 +59821,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 149 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */); + return node.parent.kind === 150 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -59552,15 +59832,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 === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 161 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 149 /* MethodDeclaration */ || - node.parent.kind === 148 /* MethodSignature */ || - node.parent.kind === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - node.parent.kind === 153 /* CallSignature */ || - node.parent.kind === 154 /* ConstructSignature */); + if (node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 162 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 150 /* MethodDeclaration */ || + node.parent.kind === 149 /* MethodSignature */ || + node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + node.parent.kind === 154 /* CallSignature */ || + node.parent.kind === 155 /* ConstructSignature */); emitType(node.constraint); } else { @@ -59571,34 +59851,34 @@ 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 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 153 /* CallSignature */: + case 154 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* 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 === 227 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 228 /* 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 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -59636,7 +59916,7 @@ var ts; function getHeritageClauseVisibilityError() { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 227 /* ClassDeclaration */) { + if (node.parent.parent.kind === 228 /* 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 : @@ -59723,7 +60003,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 !== 224 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 225 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -59734,11 +60014,11 @@ var ts; writeTextOfNode(currentText, node.name); // If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor // we don't want to emit property declaration with "?" - if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */ || - (node.kind === 144 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { + if ((node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */ || + (node.kind === 145 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) && node.parent.kind === 161 /* TypeLiteral */) { + if ((node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */) && node.parent.kind === 162 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (resolver.isLiteralConstDeclaration(node)) { @@ -59751,14 +60031,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 224 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) { + else if (node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.hasModifier(node, 32 /* Static */)) { return symbolAccessibilityResult.errorModuleName ? @@ -59767,7 +60047,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 === 227 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -59799,7 +60079,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198 /* OmittedExpression */) { + if (element.kind !== 199 /* OmittedExpression */) { elements.push(element); } } @@ -59869,7 +60149,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 === 151 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 152 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -59882,7 +60162,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 151 /* GetAccessor */ + return accessor.kind === 152 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -59891,7 +60171,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 152 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 153 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32 /* Static */)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? @@ -59941,17 +60221,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 226 /* FunctionDeclaration */) { + if (node.kind === 227 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 149 /* MethodDeclaration */ || node.kind === 150 /* Constructor */) { + else if (node.kind === 150 /* MethodDeclaration */ || node.kind === 151 /* Constructor */) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 226 /* FunctionDeclaration */) { + if (node.kind === 227 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 150 /* Constructor */) { + else if (node.kind === 151 /* Constructor */) { write("constructor"); } else { @@ -59971,17 +60251,17 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; var closeParenthesizedFunctionType = false; - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { // Index signature can have readonly modifier emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); write("["); } else { // Construct signature or constructor type write new Signature - if (node.kind === 154 /* ConstructSignature */ || node.kind === 159 /* ConstructorType */) { + if (node.kind === 155 /* ConstructSignature */ || node.kind === 160 /* ConstructorType */) { write("new "); } - else if (node.kind === 158 /* FunctionType */) { + else if (node.kind === 159 /* FunctionType */) { var currentOutput = writer.getText(); // Do not generate incorrect type when function type with type parameters is type argument // This could happen if user used space between two '<' making it error free @@ -59996,22 +60276,22 @@ var ts; } // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 158 /* FunctionType */ || node.kind === 159 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 161 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 159 /* FunctionType */ || node.kind === 160 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 162 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 150 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) { + else if (node.kind !== 151 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -60025,26 +60305,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.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 153 /* CallSignature */: + case 154 /* CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.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 155 /* IndexSignature */: + case 156 /* IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.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 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node, 32 /* Static */)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -60052,7 +60332,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 === 227 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -60066,7 +60346,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -60101,9 +60381,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - node.parent.parent.kind === 161 /* TypeLiteral */) { + if (node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + node.parent.parent.kind === 162 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!ts.hasModifier(node.parent, 8 /* Private */)) { @@ -60119,29 +60399,29 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.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 153 /* CallSignature */: + case 154 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.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 155 /* IndexSignature */: + case 156 /* IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* Static */)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -60149,7 +60429,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 === 227 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 228 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -60162,7 +60442,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 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -60174,12 +60454,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 === 172 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 173 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 174 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -60190,7 +60470,7 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 198 /* OmittedExpression */) { + if (bindingElement.kind === 199 /* 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) @@ -60199,7 +60479,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 174 /* BindingElement */) { + else if (bindingElement.kind === 175 /* 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" @@ -60238,40 +60518,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: - case 231 /* ModuleDeclaration */: - case 235 /* ImportEqualsDeclaration */: - case 228 /* InterfaceDeclaration */: - case 227 /* ClassDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 230 /* EnumDeclaration */: + case 227 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 229 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return emitExportDeclaration(node); - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return writeFunctionDeclaration(node); - case 154 /* ConstructSignature */: - case 153 /* CallSignature */: - case 155 /* IndexSignature */: + case 155 /* ConstructSignature */: + case 154 /* CallSignature */: + case 156 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return emitAccessorDeclaration(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return emitPropertyDeclaration(node); - case 261 /* EnumMember */: + case 262 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return emitExportAssignment(node); - case 262 /* SourceFile */: + case 263 /* SourceFile */: return emitSourceFile(node); } } @@ -60289,7 +60569,7 @@ var ts; } else { // Get the declaration file path - ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, @@ -60387,11 +60667,11 @@ var ts; ts.performance.measure("transformTime", "beforeTransform"); // Emit each output file ts.performance.mark("beforePrint"); - ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, emitFile, transformed, emitOnlyDtsFiles); ts.performance.measure("printTime", "beforePrint"); // Clean up emit nodes on parse tree - for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) { - var sourceFile = sourceFiles_4[_b]; + for (var _b = 0, sourceFiles_3 = sourceFiles; _b < sourceFiles_3.length; _b++) { + var sourceFile = sourceFiles_3[_b]; ts.disposeEmitNodes(sourceFile); } return { @@ -60400,7 +60680,8 @@ var ts; emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; - function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) { + function emitFile(_a, sourceFiles, isBundledEmit) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; // Make sure not to write js file and source map file if any of them cannot be written if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { if (!emitOnlyDtsFiles) { @@ -60434,8 +60715,8 @@ var ts; isOwnFileEmit = !isBundledEmit; // Emit helpers from all the files if (isBundledEmit && moduleKind) { - for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { - var sourceFile = sourceFiles_5[_a]; + for (var _a = 0, sourceFiles_4 = sourceFiles; _a < sourceFiles_4.length; _a++) { + var sourceFile = sourceFiles_4[_a]; emitHelpers(sourceFile, /*isBundle*/ true); } } @@ -60564,7 +60845,7 @@ var ts; var kind = node.kind; switch (kind) { // Top-level nodes - case 262 /* SourceFile */: + case 263 /* SourceFile */: return emitSourceFile(node); } } @@ -60626,212 +60907,212 @@ var ts; case 130 /* ReadonlyKeyword */: case 131 /* RequireKeyword */: case 132 /* NumberKeyword */: - case 133 /* SetKeyword */: - case 134 /* StringKeyword */: - case 135 /* SymbolKeyword */: - case 136 /* TypeKeyword */: - case 137 /* UndefinedKeyword */: - case 138 /* FromKeyword */: - case 139 /* GlobalKeyword */: - case 140 /* OfKeyword */: + case 134 /* SetKeyword */: + case 135 /* StringKeyword */: + case 136 /* SymbolKeyword */: + case 137 /* TypeKeyword */: + case 138 /* UndefinedKeyword */: + case 139 /* FromKeyword */: + case 140 /* GlobalKeyword */: + case 141 /* OfKeyword */: writeTokenText(kind); return; // Parse tree nodes // Names - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return emitQualifiedName(node); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return emitTypeParameter(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return emitParameter(node); - case 145 /* Decorator */: + case 146 /* Decorator */: return emitDecorator(node); // Type members - case 146 /* PropertySignature */: + case 147 /* PropertySignature */: return emitPropertySignature(node); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return emitPropertyDeclaration(node); - case 148 /* MethodSignature */: + case 149 /* MethodSignature */: return emitMethodSignature(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return emitMethodDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return emitConstructor(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return emitAccessorDeclaration(node); - case 153 /* CallSignature */: + case 154 /* CallSignature */: return emitCallSignature(node); - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: return emitConstructSignature(node); - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return emitIndexSignature(node); // Types - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return emitTypePredicate(node); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return emitTypeReference(node); - case 158 /* FunctionType */: + case 159 /* FunctionType */: return emitFunctionType(node); - case 159 /* ConstructorType */: + case 160 /* ConstructorType */: return emitConstructorType(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return emitTypeQuery(node); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return emitTypeLiteral(node); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return emitArrayType(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return emitTupleType(node); - case 164 /* UnionType */: + case 165 /* UnionType */: return emitUnionType(node); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return emitIntersectionType(node); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return emitParenthesizedType(node); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 167 /* ThisType */: + case 168 /* ThisType */: return emitThisType(); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return emitTypeOperator(node); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return emitIndexedAccessType(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return emitMappedType(node); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return emitLiteralType(node); // Binding patterns - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return emitBindingElement(node); // Misc - case 203 /* TemplateSpan */: + case 204 /* TemplateSpan */: return emitTemplateSpan(node); - case 204 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 205 /* Block */: + case 206 /* Block */: return emitBlock(node); - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: return emitVariableStatement(node); - case 207 /* EmptyStatement */: + case 208 /* EmptyStatement */: return emitEmptyStatement(); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return emitExpressionStatement(node); - case 209 /* IfStatement */: + case 210 /* IfStatement */: return emitIfStatement(node); - case 210 /* DoStatement */: + case 211 /* DoStatement */: return emitDoStatement(node); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: return emitWhileStatement(node); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return emitForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: return emitForInStatement(node); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: return emitForOfStatement(node); - case 215 /* ContinueStatement */: + case 216 /* ContinueStatement */: return emitContinueStatement(node); - case 216 /* BreakStatement */: + case 217 /* BreakStatement */: return emitBreakStatement(node); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: return emitReturnStatement(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: return emitWithStatement(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: return emitSwitchStatement(node); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: return emitLabeledStatement(node); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: return emitThrowStatement(node); - case 222 /* TryStatement */: + case 223 /* TryStatement */: return emitTryStatement(node); - case 223 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 225 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 226 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return emitClassDeclaration(node); - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: return emitModuleBlock(node); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return emitCaseBlock(node); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return emitImportDeclaration(node); - case 237 /* ImportClause */: + case 238 /* ImportClause */: return emitImportClause(node); - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: return emitNamespaceImport(node); - case 239 /* NamedImports */: + case 240 /* NamedImports */: return emitNamedImports(node); - case 240 /* ImportSpecifier */: + case 241 /* ImportSpecifier */: return emitImportSpecifier(node); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: return emitExportAssignment(node); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return emitExportDeclaration(node); - case 243 /* NamedExports */: + case 244 /* NamedExports */: return emitNamedExports(node); - case 244 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: return emitExportSpecifier(node); - case 245 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return; // Module references - case 246 /* ExternalModuleReference */: + case 247 /* ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 10 /* JsxText */: return emitJsxText(node); - case 249 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: return emitJsxOpeningElement(node); - case 250 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: return emitJsxClosingElement(node); - case 251 /* JsxAttribute */: + case 252 /* JsxAttribute */: return emitJsxAttribute(node); - case 252 /* JsxSpreadAttribute */: + case 253 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 253 /* JsxExpression */: + case 254 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 254 /* CaseClause */: + case 255 /* CaseClause */: return emitCaseClause(node); - case 255 /* DefaultClause */: + case 256 /* DefaultClause */: return emitDefaultClause(node); - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: return emitHeritageClause(node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 258 /* PropertyAssignment */: + case 259 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 259 /* ShorthandPropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 260 /* SpreadAssignment */: + case 261 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 261 /* EnumMember */: + case 262 /* EnumMember */: return emitEnumMember(node); } // If the node is an expression, try to emit it as an expression with @@ -60868,67 +61149,67 @@ var ts; writeTokenText(kind); return; // Expressions - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return emitElementAccessExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return emitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return emitNewExpression(node); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return emitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return emitArrowFunction(node); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return emitDeleteExpression(node); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return emitVoidExpression(node); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return emitAwaitExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return emitBinaryExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return emitConditionalExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return emitTemplateExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return emitYieldExpression(node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return emitSpreadExpression(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return emitClassExpression(node); - case 198 /* OmittedExpression */: + case 199 /* OmittedExpression */: return; - case 200 /* AsExpression */: + case 201 /* AsExpression */: return emitAsExpression(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return emitNonNullExpression(node); - case 202 /* MetaProperty */: + case 203 /* MetaProperty */: return emitMetaProperty(node); // JSX - case 247 /* JsxElement */: + case 248 /* JsxElement */: return emitJsxElement(node); - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); // Transformation nodes - case 295 /* PartiallyEmittedExpression */: + case 296 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); } } @@ -61049,7 +61330,7 @@ var ts; function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - write(node.kind === 151 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 152 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -61257,9 +61538,11 @@ var ts; // Also emit a dot if expression is a integer const enum value - it will appear in generated code as numeric literal function needsDotDotForPropertyAccess(expression) { if (expression.kind === 8 /* NumericLiteral */) { - // check if numeric literal was originally written with a dot + // check if numeric literal is a decimal literal that was originally written with a dot var text = getLiteralTextOfNode(expression); - return text.indexOf(ts.tokenToString(22 /* DotToken */)) < 0; + return ts.getNumericLiteralFlags(text, /*hint*/ 15 /* All */) === 0 /* None */ + && !expression.isOctalLiteral + && text.indexOf(ts.tokenToString(22 /* DotToken */)) < 0; } else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { // check if constant enum value is integer @@ -61356,7 +61639,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 190 /* PrefixUnaryExpression */ + return operand.kind === 191 /* PrefixUnaryExpression */ && ((node.operator === 36 /* PlusToken */ && (operand.operator === 36 /* PlusToken */ || operand.operator === 42 /* PlusPlusToken */)) || (node.operator === 37 /* MinusToken */ && (operand.operator === 37 /* MinusToken */ || operand.operator === 43 /* MinusMinusToken */))); } @@ -61479,7 +61762,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node); writeToken(81 /* ElseKeyword */, node.thenStatement.end, node); - if (node.elseStatement.kind === 209 /* IfStatement */) { + if (node.elseStatement.kind === 210 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -61541,7 +61824,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 225 /* VariableDeclarationList */) { + if (node.kind === 226 /* VariableDeclarationList */) { emit(node); } else { @@ -61783,7 +62066,7 @@ var ts; write(node.flags & 16 /* Namespace */ ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 231 /* ModuleDeclaration */) { + while (body.kind === 232 /* ModuleDeclaration */) { write("."); emit(body.name); body = body.body; @@ -61990,7 +62273,6 @@ var ts; emitList(node, node.types, 272 /* HeritageClauseTypes */); } function emitCatchClause(node) { - writeLine(); var openParenPos = writeToken(73 /* CatchKeyword */, node.pos); write(" "); writeToken(18 /* OpenParenToken */, openParenPos); @@ -62097,10 +62379,10 @@ var ts; // Skip the helper if it can be bundled but hasn't already been emitted and we // are emitting a bundled module. if (shouldBundle) { - if (bundledHelpers[helper.name]) { + if (bundledHelpers.get(helper.name)) { continue; } - bundledHelpers[helper.name] = true; + bundledHelpers.set(helper.name, true); } } else if (isBundle) { @@ -62456,7 +62738,7 @@ var ts; && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); } function skipSynthesizedParentheses(node) { - while (node.kind === 183 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 184 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -62498,14 +62780,15 @@ var ts; } function isUniqueName(name) { return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentFileIdentifiers, name) && - !ts.hasProperty(generatedNameSet, name); + !currentFileIdentifiers.has(name) && + !generatedNameSet.has(name); } function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { + if (node.locals) { + var local = node.locals.get(name); // We conservatively include alias symbols to cover cases where they're emitted as locals - if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { + if (local && local.flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { return false; } } @@ -62519,10 +62802,10 @@ var ts; */ function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_41 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_41)) { + var name = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name)) { tempFlags |= flags; - return name_41; + return name; } } while (true) { @@ -62530,11 +62813,11 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_42 = count < 26 + var name = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_42)) { - return name_42; + if (isUniqueName(name)) { + return name; } } } @@ -62552,7 +62835,8 @@ var ts; while (true) { var generatedName = baseName + i; if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; + generatedNameSet.set(generatedName, generatedName); + return generatedName; } i++; } @@ -62589,21 +62873,21 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return makeUniqueName(getTextOfNode(node)); - case 231 /* ModuleDeclaration */: - case 230 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 236 /* ImportDeclaration */: - case 242 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: + case 243 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 226 /* FunctionDeclaration */: - case 227 /* ClassDeclaration */: - case 241 /* ExportAssignment */: + case 227 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 242 /* ExportAssignment */: return generateNameForExportDefault(); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return generateNameForClassExpression(); - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0 /* Auto */); @@ -62862,11 +63146,11 @@ var ts; return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; } function directoryExists(directoryPath) { - if (directoryPath in existingDirectories) { + if (existingDirectories.has(directoryPath)) { return true; } if (ts.sys.directoryExists(directoryPath)) { - existingDirectories[directoryPath] = true; + existingDirectories.set(directoryPath, true); return true; } return false; @@ -62885,10 +63169,11 @@ var ts; } var hash = ts.sys.createHash(data); var mtimeBefore = ts.sys.getModifiedTime(fileName); - if (mtimeBefore && fileName in outputFingerprints) { - var fingerprint = outputFingerprints[fileName]; + if (mtimeBefore) { + var fingerprint = outputFingerprints.get(fileName); // If output has not been changed, and the file has no external modification - if (fingerprint.byteOrderMark === writeByteOrderMark && + if (fingerprint && + fingerprint.byteOrderMark === writeByteOrderMark && fingerprint.hash === hash && fingerprint.mtime.getTime() === mtimeBefore.getTime()) { return; @@ -62896,11 +63181,11 @@ var ts; } ts.sys.writeFile(fileName, data, writeByteOrderMark); var mtimeAfter = ts.sys.getModifiedTime(fileName); - outputFingerprints[fileName] = { + outputFingerprints.set(fileName, { hash: hash, byteOrderMark: writeByteOrderMark, mtime: mtimeAfter - }; + }); } function writeFile(fileName, data, writeByteOrderMark, onError) { try { @@ -62999,10 +63284,14 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_43 = names_1[_i]; - var result = name_43 in cache - ? cache[name_43] - : cache[name_43] = loader(name_43, containingFile); + var name = names_1[_i]; + var result = void 0; + if (cache.has(name)) { + result = cache.get(name); + } + else { + cache.set(name, result = loader(name, containingFile)); + } resolutions.push(result); } return resolutions; @@ -63135,7 +63424,7 @@ var ts; return program; function getCommonSourceDirectory() { if (commonSourceDirectory === undefined) { - var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary); + var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary); }); if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { // If a rootDir is specified and is valid use it as the commonSourceDirectory commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); @@ -63159,7 +63448,7 @@ var ts; classifiableNames = ts.createMap(); for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var sourceFile = files_2[_i]; - ts.copyProperties(sourceFile.classifiableNames, classifiableNames); + ts.copyEntries(sourceFile.classifiableNames, classifiableNames); } } return classifiableNames; @@ -63395,7 +63684,7 @@ var ts; }; } function isSourceFileFromExternalLibrary(file) { - return sourceFilesFoundSearchingNodeModules[file.path]; + return sourceFilesFoundSearchingNodeModules.get(file.path); } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true)); @@ -63540,23 +63829,23 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); return; } // Pass through - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 224 /* VariableDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 225 /* VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); @@ -63564,35 +63853,35 @@ var ts; } } switch (node.kind) { - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 256 /* HeritageClause */: + case 257 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 107 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: var typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; @@ -63607,29 +63896,29 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 227 /* ClassDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } // pass through - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 206 /* VariableStatement */); + return checkModifiers(nodes, parent.kind === 207 /* VariableStatement */); } break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { @@ -63641,16 +63930,16 @@ var ts; return; } break; - case 144 /* Parameter */: + case 145 /* Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); return; } break; - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 199 /* ExpressionWithTypeArguments */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 200 /* ExpressionWithTypeArguments */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); @@ -63749,7 +64038,7 @@ var ts; // synthesize 'import "tslib"' declaration var externalHelpersModuleReference = ts.createSynthesizedNode(9 /* StringLiteral */); externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(236 /* ImportDeclaration */); + var importDecl = ts.createSynthesizedNode(237 /* ImportDeclaration */); importDecl.parent = file; externalHelpersModuleReference.parent = importDecl; imports = [externalHelpersModuleReference]; @@ -63767,9 +64056,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 236 /* ImportDeclaration */: - case 235 /* ImportEqualsDeclaration */: - case 242 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; @@ -63784,7 +64073,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2 /* Ambient */) || ts.isDeclarationFile(file))) { var moduleName = node.name; // Ambient module declarations can be interpreted as augmentations for some existing external modules. @@ -63884,18 +64173,18 @@ var ts; } // If the file was previously found via a node_modules search, but is now being processed as a root file, // then everything it sucks in may also be marked incorrectly, and needs to be checked again. - if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) { - sourceFilesFoundSearchingNodeModules[file_1.path] = false; + if (file_1 && sourceFilesFoundSearchingNodeModules.get(file_1.path) && currentNodeModulesDepth == 0) { + sourceFilesFoundSearchingNodeModules.set(file_1.path, false); if (!options.noResolve) { processReferencedFiles(file_1, isDefaultLib); processTypeReferenceDirectives(file_1); } - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } - else if (file_1 && modulesWithElidedImports[file_1.path]) { + else if (file_1 && modulesWithElidedImports.get(file_1.path)) { if (currentNodeModulesDepth < maxNodeModuleJsDepth) { - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } } @@ -63912,7 +64201,7 @@ var ts; }); filesByName.set(path, file); if (file) { - sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0); + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); file.path = path; if (host.useCaseSensitiveFileNames()) { // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case @@ -63961,7 +64250,7 @@ var ts; } function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { // If we already found this library as a primary reference - nothing to do - var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); if (previousResolution && previousResolution.primary) { return; } @@ -63995,7 +64284,7 @@ var ts; fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); } if (saveResolution) { - resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective); } } function createDiagnostic(refFile, refPos, refEnd, message) { @@ -64044,7 +64333,7 @@ var ts; // This may still end up being an untyped module -- the file won't be included but imports will be allowed. var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; if (elideImport) { - modulesWithElidedImports[file.path] = true; + modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); @@ -64063,8 +64352,8 @@ var ts; } function computeCommonSourceDirectory(sourceFiles) { var fileNames = []; - for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { - var file = sourceFiles_6[_i]; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var file = sourceFiles_5[_i]; if (!file.isDeclarationFile) { fileNames.push(file.fileName); } @@ -64075,8 +64364,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { - var sourceFile = sourceFiles_7[_i]; + for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { + var sourceFile = sourceFiles_6[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -64235,7 +64524,7 @@ var ts; if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); - ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) { + ts.forEachEmittedFile(emitHost, function (emitFileNames) { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); }); @@ -64367,12 +64656,13 @@ var ts; }, { name: "jsx", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "preserve": 1 /* Preserve */, + "react-native": 3 /* ReactNative */, "react": 2 /* React */ }), paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, }, { name: "reactNamespace", @@ -64402,7 +64692,7 @@ var ts; { name: "module", shortName: "m", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "none": ts.ModuleKind.None, "commonjs": ts.ModuleKind.CommonJS, "amd": ts.ModuleKind.AMD, @@ -64416,7 +64706,7 @@ var ts; }, { name: "newLine", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "crlf": 0 /* CarriageReturnLineFeed */, "lf": 1 /* LineFeed */ }), @@ -64514,8 +64804,8 @@ var ts; shortName: "p", type: "string", isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY }, { name: "removeComments", @@ -64565,7 +64855,7 @@ var ts; { name: "target", shortName: "t", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es3": 0 /* ES3 */, "es5": 1 /* ES5 */, "es6": 2 /* ES2015 */, @@ -64602,7 +64892,7 @@ var ts; }, { name: "moduleResolution", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "node": ts.ModuleResolutionKind.NodeJs, "classic": ts.ModuleResolutionKind.Classic, }), @@ -64711,7 +65001,7 @@ var ts; type: "list", element: { name: "lib", - type: ts.createMap({ + type: ts.createMapFromTemplate({ // JavaScript only "es5": "lib.es5.d.ts", "es6": "lib.es2015.d.ts", @@ -64822,9 +65112,9 @@ var ts; var optionNameMap = ts.createMap(); var shortOptionNames = ts.createMap(); ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; @@ -64833,7 +65123,7 @@ var ts; ts.getOptionNameMap = getOptionNameMap; /* @internal */ function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; @@ -64885,11 +65175,12 @@ var ts; else if (s.charCodeAt(0) === 45 /* minus */) { s = s.slice(s.charCodeAt(1) === 45 /* minus */ ? 2 : 1).toLowerCase(); // Try to translate short option names to their full equivalents. - if (s in shortOptionNames) { - s = shortOptionNames[s]; + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - var opt = optionNameMap[s]; + var opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -65037,21 +65328,20 @@ var ts; } function getNameOfCompilerOptionValue(value, customTypeMap) { // There is a typeMap associated with this command-line option so use it to map value back to its name - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { return key; } - } - return undefined; + }); } function serializeCompilerOptions(options) { - var result = ts.createMap(); + var result = {}; var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_44 in options) { - if (ts.hasProperty(options, name_44)) { + for (var name in options) { + if (ts.hasProperty(options, name)) { // tsconfig only options cannot be specified via command line, // so we can assume that only types that can appear here string | number | boolean - switch (name_44) { + switch (name) { case "init": case "watch": case "version": @@ -65059,14 +65349,14 @@ var ts; case "project": break; default: - var value = options[name_44]; - var optionDefinition = optionsNameMap[name_44.toLowerCase()]; + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { // There is no map associated with this compiler option then use the value as-is // This is the case if the value is expect to be string, number, boolean or list of string - result[name_44] = value; + result[name] = value; } else { if (optionDefinition.type === "list") { @@ -65075,11 +65365,11 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_44] = convertedValue; + result[name] = convertedValue; } else { // There is a typeMap associated with this command-line option so use it to map value back to its name - result[name_44] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -65305,8 +65595,8 @@ var ts; } var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; + var opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -65340,8 +65630,9 @@ var ts; } function convertJsonOptionOfCustomType(opt, value, errors) { var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + var val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -65465,7 +65756,7 @@ var ts; for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } if (include && include.length > 0) { @@ -65486,14 +65777,13 @@ var ts; // same directory, we should remove it. removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); return { fileNames: literalFiles.concat(wildcardFiles), wildcardDirectories: wildcardDirectories @@ -65501,8 +65791,8 @@ var ts; } function validateSpecs(specs, errors, allowTrailingRecursion) { var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } @@ -65536,7 +65826,7 @@ var ts; // /a/b/a?z - Watch /a/b directly to catch any new file matching a?z var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); + var wildcardDirectories = {}; if (include !== undefined) { var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { @@ -65558,14 +65848,16 @@ var ts; } } // Remove any subpaths under an existing recursively watched directory. - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } } } - } + ; } return wildcardDirectories; } @@ -65596,7 +65888,7 @@ var ts; for (var i = 0 /* Highest */; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i]; var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -65616,19 +65908,9 @@ var ts; for (var i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i]; var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - /** - * Adds a file to an array of files. - * - * @param output The output array. - * @param file The file path. - */ - function addFileToOutput(output, file) { - output.push(file); - return output; - } /** * Gets a case sensitive key. * @@ -65896,33 +66178,33 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 144 /* Parameter */: - case 224 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 258 /* PropertyAssignment */: - case 259 /* ShorthandPropertyAssignment */: - case 261 /* EnumMember */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 257 /* CatchClause */: + case 145 /* Parameter */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 259 /* PropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: + case 262 /* EnumMember */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 258 /* CatchClause */: return 1 /* Value */; - case 143 /* TypeParameter */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 161 /* TypeLiteral */: + case 144 /* TypeParameter */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 162 /* TypeLiteral */: return 2 /* Type */; - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -65932,22 +66214,25 @@ var ts; else { return 4 /* Namespace */; } - case 239 /* NamedImports */: - case 240 /* ImportSpecifier */: - case 235 /* ImportEqualsDeclaration */: - case 236 /* ImportDeclaration */: - case 241 /* ExportAssignment */: - case 242 /* ExportDeclaration */: + case 240 /* NamedImports */: + case 241 /* ImportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 237 /* ImportDeclaration */: + case 242 /* ExportAssignment */: + case 243 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 262 /* SourceFile */: + case 263 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 241 /* ExportAssignment */) { + if (node.kind === 263 /* SourceFile */) { + return 1 /* Value */; + } + else if (node.parent.kind === 242 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -65972,15 +66257,15 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 141 /* QualifiedName */ && + if (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 235 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 236 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function isInRightSideOfImport(node) { - while (node.parent.kind === 141 /* QualifiedName */) { + while (node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -65991,27 +66276,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 141 /* QualifiedName */) { - while (root.parent && root.parent.kind === 141 /* QualifiedName */) { + if (root.parent.kind === 142 /* QualifiedName */) { + while (root.parent && root.parent.kind === 142 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 157 /* TypeReference */ && !isLastClause; + return root.parent.kind === 158 /* TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 177 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 177 /* PropertyAccessExpression */) { + if (root.parent.kind === 178 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 178 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 256 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 200 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 257 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 227 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || - (decl.kind === 228 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); + return (decl.kind === 228 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || + (decl.kind === 229 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); } return false; } @@ -66019,17 +66304,17 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 157 /* TypeReference */ || - (node.parent.kind === 199 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + return node.parent.kind === 158 /* TypeReference */ || + (node.parent.kind === 200 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || (node.kind === 98 /* ThisKeyword */ && !ts.isPartOfExpression(node)) || - node.kind === 167 /* ThisType */; + node.kind === 168 /* ThisType */; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 179 /* CallExpression */); + return isCallOrNewExpressionTarget(node, 180 /* CallExpression */); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 180 /* NewExpression */); + return isCallOrNewExpressionTarget(node, 181 /* NewExpression */); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -66042,7 +66327,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 220 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 221 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -66052,13 +66337,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 /* Identifier */ && - (node.parent.kind === 216 /* BreakStatement */ || node.parent.kind === 215 /* ContinueStatement */) && + (node.parent.kind === 217 /* BreakStatement */ || node.parent.kind === 216 /* ContinueStatement */) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 /* Identifier */ && - node.parent.kind === 220 /* LabeledStatement */ && + node.parent.kind === 221 /* LabeledStatement */ && node.parent.label === node; } function isLabelName(node) { @@ -66066,15 +66351,15 @@ var ts; } ts.isLabelName = isLabelName; function isRightSideOfQualifiedName(node) { - return node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 231 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 232 /* ModuleDeclaration */ && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -66085,19 +66370,19 @@ var ts; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 258 /* PropertyAssignment */: - case 261 /* EnumMember */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 231 /* ModuleDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 259 /* PropertyAssignment */: + case 262 /* EnumMember */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 232 /* ModuleDeclaration */: return node.parent.name === node; - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return node.parent.argumentExpression === node; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return true; } } @@ -66146,17 +66431,17 @@ var ts; return undefined; } switch (node.kind) { - case 262 /* SourceFile */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 231 /* ModuleDeclaration */: + case 263 /* SourceFile */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: return node; } } @@ -66164,46 +66449,46 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 262 /* SourceFile */: + case 263 /* SourceFile */: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return ts.ScriptElementKind.moduleElement; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return ts.ScriptElementKind.classElement; - case 228 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; - case 229 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; - case 230 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; - case 224 /* VariableDeclaration */: + case 229 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; + case 230 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; + case 231 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; + case 225 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return ts.ScriptElementKind.functionElement; - case 151 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement; - case 152 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 152 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement; + case 153 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement; + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return ts.ScriptElementKind.memberFunctionElement; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return ts.ScriptElementKind.memberVariableElement; - case 155 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement; - case 154 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement; - case 153 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement; - case 150 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement; - case 143 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement; - case 261 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; - case 144 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 235 /* ImportEqualsDeclaration */: - case 240 /* ImportSpecifier */: - case 237 /* ImportClause */: - case 244 /* ExportSpecifier */: - case 238 /* NamespaceImport */: + case 156 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement; + case 155 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement; + case 154 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement; + case 151 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement; + case 144 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement; + case 262 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; + case 145 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; + case 236 /* ImportEqualsDeclaration */: + case 241 /* ImportSpecifier */: + case 238 /* ImportClause */: + case 245 /* ExportSpecifier */: + case 239 /* NamespaceImport */: return ts.ScriptElementKind.alias; - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -66218,7 +66503,7 @@ var ts; } ts.getNodeKind = getNodeKind; function getStringLiteralTypeForNode(node, typeChecker) { - var searchNode = node.parent.kind === 171 /* LiteralType */ ? node.parent : node; + var searchNode = node.parent.kind === 172 /* LiteralType */ ? node.parent : node; var type = typeChecker.getTypeAtLocation(searchNode); if (type && type.flags & 32 /* StringLiteral */) { return type; @@ -66233,7 +66518,7 @@ var ts; return true; case 70 /* Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 144 /* Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 145 /* Parameter */; default: return false; } @@ -66278,42 +66563,42 @@ var ts; return false; } switch (n.kind) { - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 176 /* ObjectLiteralExpression */: - case 172 /* ObjectBindingPattern */: - case 161 /* TypeLiteral */: - case 205 /* Block */: - case 232 /* ModuleBlock */: - case 233 /* CaseBlock */: - case 239 /* NamedImports */: - case 243 /* NamedExports */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 177 /* ObjectLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 162 /* TypeLiteral */: + case 206 /* Block */: + case 233 /* ModuleBlock */: + case 234 /* CaseBlock */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: return nodeEndsWith(n, 17 /* CloseBraceToken */, sourceFile); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 180 /* NewExpression */: + case 181 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 179 /* CallExpression */: - case 183 /* ParenthesizedExpression */: - case 166 /* ParenthesizedType */: + case 180 /* CallExpression */: + case 184 /* ParenthesizedExpression */: + case 167 /* ParenthesizedType */: return nodeEndsWith(n, 19 /* CloseParenToken */, sourceFile); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 154 /* ConstructSignature */: - case 153 /* CallSignature */: - case 185 /* ArrowFunction */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 155 /* ConstructSignature */: + case 154 /* CallSignature */: + case 186 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -66323,67 +66608,67 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 19 /* CloseParenToken */, sourceFile); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 209 /* IfStatement */: + case 210 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 24 /* SemicolonToken */); - case 175 /* ArrayLiteralExpression */: - case 173 /* ArrayBindingPattern */: - case 178 /* ElementAccessExpression */: - case 142 /* ComputedPropertyName */: - case 163 /* TupleType */: + case 176 /* ArrayLiteralExpression */: + case 174 /* ArrayBindingPattern */: + case 179 /* ElementAccessExpression */: + case 143 /* ComputedPropertyName */: + case 164 /* TupleType */: return nodeEndsWith(n, 21 /* CloseBracketToken */, sourceFile); - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 21 /* CloseBracketToken */, sourceFile); - case 254 /* CaseClause */: - case 255 /* DefaultClause */: + case 255 /* CaseClause */: + case 256 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 211 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 212 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 210 /* DoStatement */: + case 211 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; var hasWhileKeyword = findChildOfKind(n, 105 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 19 /* CloseParenToken */, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 187 /* TypeOfExpression */: - case 186 /* DeleteExpression */: - case 188 /* VoidExpression */: - case 195 /* YieldExpression */: - case 196 /* SpreadElement */: + case 188 /* TypeOfExpression */: + case 187 /* DeleteExpression */: + case 189 /* VoidExpression */: + case 196 /* YieldExpression */: + case 197 /* SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 203 /* TemplateSpan */: + case 204 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 242 /* ExportDeclaration */: - case 236 /* ImportDeclaration */: + case 243 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -66439,7 +66724,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 === 293 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 294 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -66611,7 +66896,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 262 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 263 /* 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. @@ -66670,17 +66955,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 253 /* JsxExpression */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 254 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 253 /* JsxExpression */) { + if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 254 /* JsxExpression */) { return true; } //
|
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 250 /* JsxClosingElement */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 251 /* JsxClosingElement */) { return true; } return false; @@ -66792,17 +67077,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 157 /* TypeReference */ || node.kind === 179 /* CallExpression */) { + if (node.kind === 158 /* TypeReference */ || node.kind === 180 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 227 /* ClassDeclaration */ || node.kind === 228 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 228 /* ClassDeclaration */ || node.kind === 229 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 140 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 141 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { @@ -66861,18 +67146,18 @@ var ts; } ts.compareDataObjects = compareDataObjects; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 175 /* ArrayLiteralExpression */ || - node.kind === 176 /* ObjectLiteralExpression */) { + if (node.kind === 176 /* ArrayLiteralExpression */ || + node.kind === 177 /* ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 192 /* BinaryExpression */ && + if (node.parent.kind === 193 /* BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 57 /* EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 214 /* ForOfStatement */ && + if (node.parent.kind === 215 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -66880,7 +67165,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 258 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 259 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -66908,12 +67193,32 @@ var ts; } } ts.isInNonReferenceComment = isInNonReferenceComment; + function createTextSpanFromNode(node, sourceFile) { + return ts.createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); + } + ts.createTextSpanFromNode = createTextSpanFromNode; + function isTypeKeyword(kind) { + switch (kind) { + case 118 /* AnyKeyword */: + case 121 /* BooleanKeyword */: + case 129 /* NeverKeyword */: + case 132 /* NumberKeyword */: + case 133 /* ObjectKeyword */: + case 135 /* StringKeyword */: + case 136 /* SymbolKeyword */: + case 104 /* VoidKeyword */: + return true; + default: + return false; + } + } + ts.isTypeKeyword = isTypeKeyword; })(ts || (ts = {})); // Display-part writer helpers /* @internal */ (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 145 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -67094,7 +67399,7 @@ var ts; return location.getText(); } else if (ts.isStringOrNumericLiteral(location) && - location.parent.kind === 142 /* ComputedPropertyName */) { + location.parent.kind === 143 /* ComputedPropertyName */) { return location.text; } // Try to get the local symbol if we're dealing with an 'export default' @@ -67106,7 +67411,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 240 /* ImportSpecifier */ || location.parent.kind === 244 /* ExportSpecifier */) && + (location.parent.kind === 241 /* ImportSpecifier */ || location.parent.kind === 245 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -67226,7 +67531,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 124 /* GetKeyword */ || - keyword2 === 133 /* SetKeyword */ || + keyword2 === 134 /* SetKeyword */ || keyword2 === 122 /* ConstructorKeyword */ || keyword2 === 114 /* StaticKeyword */) { // Allow things like "public get", "public constructor" and "public static". @@ -67385,10 +67690,10 @@ var ts; angleBracketStack--; } else if (token === 118 /* AnyKeyword */ || - token === 134 /* StringKeyword */ || + token === 135 /* StringKeyword */ || token === 132 /* NumberKeyword */ || token === 121 /* BooleanKeyword */ || - token === 135 /* SymbolKeyword */) { + token === 136 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -67560,7 +67865,7 @@ var ts; } } function isKeyword(token) { - return token >= 71 /* FirstKeyword */ && token <= 140 /* LastKeyword */; + return token >= 71 /* FirstKeyword */ && token <= 141 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -67617,10 +67922,10 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 231 /* ModuleDeclaration */: - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 226 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -67671,7 +67976,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 231 /* ModuleDeclaration */ && + return declaration.kind === 232 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -67686,7 +67991,7 @@ var ts; // Only bother calling into the typechecker if this is an identifier that // could possibly resolve to a type name. This makes classification run // in a third of the time it would normally take. - if (classifiableNames[identifier.text]) { + if (classifiableNames.get(identifier.text)) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var type = classifySymbol(symbol, ts.getMeaningFromLocation(node)); @@ -67835,16 +68140,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 282 /* JSDocParameterTag */: + case 283 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 285 /* JSDocTemplateTag */: + case 286 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 284 /* JSDocTypeTag */: + case 285 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 283 /* JSDocReturnTag */: + case 284 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -67931,22 +68236,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 249 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 250 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 248 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 251 /* JsxAttribute */: + case 252 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -67974,17 +68279,17 @@ var ts; if (token) { if (tokenKind === 57 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 224 /* VariableDeclaration */ || - token.parent.kind === 147 /* PropertyDeclaration */ || - token.parent.kind === 144 /* Parameter */ || - token.parent.kind === 251 /* JsxAttribute */) { + if (token.parent.kind === 225 /* VariableDeclaration */ || + token.parent.kind === 148 /* PropertyDeclaration */ || + token.parent.kind === 145 /* Parameter */ || + token.parent.kind === 252 /* JsxAttribute */) { return 5 /* operator */; } } - if (token.parent.kind === 192 /* BinaryExpression */ || - token.parent.kind === 190 /* PrefixUnaryExpression */ || - token.parent.kind === 191 /* PostfixUnaryExpression */ || - token.parent.kind === 193 /* ConditionalExpression */) { + if (token.parent.kind === 193 /* BinaryExpression */ || + token.parent.kind === 191 /* PrefixUnaryExpression */ || + token.parent.kind === 192 /* PostfixUnaryExpression */ || + token.parent.kind === 194 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -67994,7 +68299,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 251 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 252 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 11 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -68010,32 +68315,32 @@ var ts; else if (tokenKind === 70 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 144 /* Parameter */: + case 145 /* Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */; } @@ -68064,7 +68369,6 @@ var ts; } ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications; })(ts || (ts = {})); -/// /* @internal */ var ts; (function (ts) { @@ -68072,10 +68376,10 @@ var ts; (function (Completions) { function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { if (ts.isInReferenceComment(sourceFile, position)) { - return getTripleSlashReferenceCompletion(sourceFile, position); + return getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); } if (ts.isInString(sourceFile, position)) { - return getStringLiteralCompletionEntries(sourceFile, position); + return getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log); } var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (!completionData) { @@ -68088,13 +68392,13 @@ var ts; } var entries = []; if (ts.isSourceFileJavaScript(sourceFile)) { - var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true, typeChecker, compilerOptions.target, log); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target)); } else { if (!symbols || symbols.length === 0) { if (sourceFile.languageVariant === 1 /* JSX */ && - location.parent && location.parent.kind === 250 /* JsxClosingElement */) { + location.parent && location.parent.kind === 251 /* JsxClosingElement */) { // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. // For example: @@ -68111,632 +68415,642 @@ var ts; return undefined; } } - getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); + getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true, typeChecker, compilerOptions.target, log); } // Add keywords if this is not a member completion list if (!isMemberCompletion && !isJsDocTagName) { ts.addRange(entries, keywordCompletions); } return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { - var entries = []; - var nameTable = ts.getNameTable(sourceFile); - for (var name_45 in nameTable) { - // Skip identifiers produced only from the current location - if (nameTable[name_45] === position) { - continue; + } + Completions.getCompletionsAtPosition = getCompletionsAtPosition; + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames, target) { + var entries = []; + var nameTable = ts.getNameTable(sourceFile); + nameTable.forEach(function (pos, name) { + // Skip identifiers produced only from the current location + if (pos === position) { + return; + } + if (!uniqueNames.get(name)) { + uniqueNames.set(name, name); + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name), target, /*performCharacterChecks*/ true); + if (displayName) { + var entry = { + name: displayName, + kind: ts.ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } - if (!uniqueNames[name_45]) { - uniqueNames[name_45] = name_45; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, /*performCharacterChecks*/ true); - if (displayName) { - var entry = { - name: displayName, - kind: ts.ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; + } + }); + return entries; + } + function createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target) { + // 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(typeChecker, symbol, target, performCharacterChecks, 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 + // 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 + // '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). + return { + name: displayName, + kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), + kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), + sortText: "0", + }; + } + function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks, typeChecker, target, log) { + var start = ts.timestamp(); + var uniqueNames = ts.createMap(); + if (symbols) { + for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { + var symbol = symbols_4[_i]; + var entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!uniqueNames.get(id)) { entries.push(entry); + uniqueNames.set(id, id); } } } - return entries; } - function createCompletionEntry(symbol, location, performCharacterChecks) { - // 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(typeChecker, symbol, compilerOptions.target, performCharacterChecks, 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 - // 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 - // '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). - return { - name: displayName, - kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - sortText: "0", - }; + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); + return uniqueNames; + } + function getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log) { + var node = ts.findPrecedingToken(position, sourceFile); + if (!node || node.kind !== 9 /* StringLiteral */) { + return undefined; } - function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) { - var start = ts.timestamp(); - var uniqueNames = ts.createMap(); - if (symbols) { - for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { - var symbol = symbols_4[_i]; - var entry = createCompletionEntry(symbol, location, performCharacterChecks); - if (entry) { - var id = ts.escapeIdentifier(entry.name); - if (!uniqueNames[id]) { - entries.push(entry); - uniqueNames[id] = id; - } - } - } - } - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); - return uniqueNames; + if (node.parent.kind === 259 /* PropertyAssignment */ && + node.parent.parent.kind === 177 /* ObjectLiteralExpression */ && + node.parent.name === node) { + // Get quoted name of properties of the object literal expression + // i.e. interface ConfigFiles { + // 'jspm:dev': string + // } + // let files: ConfigFiles = { + // '/*completion position*/' + // } + // + // function foo(c: ConfigFiles) {} + // foo({ + // '/*completion position*/' + // }); + return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent, typeChecker, compilerOptions.target, log); + } + else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { + // Get all names of properties on the expression + // i.e. interface A { + // 'prop1': string + // } + // let a: A; + // a['/*completion position*/'] + return getStringLiteralCompletionEntriesFromElementAccess(node.parent, typeChecker, compilerOptions.target, log); + } + else if (node.parent.kind === 237 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { + // Get all known external module names or complete a path to a module + // i.e. import * as ns from "/*completion position*/"; + // import x = require("/*completion position*/"); + // var y = require("/*completion position*/"); + return getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker); + } + else if (isEqualityExpression(node.parent)) { + // Get completions from the type of the other operand + // i.e. switch (a) { + // case '/*completion position*/' + // } + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.left === node ? node.parent.right : node.parent.left), typeChecker); } - function getStringLiteralCompletionEntries(sourceFile, position) { - var node = ts.findPrecedingToken(position, sourceFile); - if (!node || node.kind !== 9 /* StringLiteral */) { - return undefined; - } - if (node.parent.kind === 258 /* PropertyAssignment */ && - node.parent.parent.kind === 176 /* ObjectLiteralExpression */ && - node.parent.name === node) { - // Get quoted name of properties of the object literal expression - // i.e. interface ConfigFiles { - // 'jspm:dev': string - // } - // let files: ConfigFiles = { - // '/*completion position*/' - // } - // - // function foo(c: ConfigFiles) {} - // foo({ - // '/*completion position*/' - // }); - return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); - } - else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { - // Get all names of properties on the expression - // i.e. interface A { - // 'prop1': string - // } - // let a: A; - // a['/*completion position*/'] - return getStringLiteralCompletionEntriesFromElementAccess(node.parent); - } - else if (node.parent.kind === 236 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { - // Get all known external module names or complete a path to a module - // i.e. import * as ns from "/*completion position*/"; - // import x = require("/*completion position*/"); - // var y = require("/*completion position*/"); - return getStringLiteralCompletionEntriesFromModuleNames(node); - } - else { - var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo) { - // Get string literal completions from specialized signatures of the target - // i.e. declare function f(a: 'A'); - // f("/*completion position*/") - return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo); - } - // Get completion for string literal from string literal type - // i.e. var x: "hi" | "hello" = "/*completion position*/" - return getStringLiteralCompletionEntriesFromContextualType(node); - } + else if (ts.isCaseOrDefaultClause(node.parent)) { + // Get completions from the type of the switch expression + // i.e. x === '/*completion position' + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.parent.parent.expression), typeChecker); } - function getStringLiteralCompletionEntriesFromPropertyAssignment(element) { - var type = typeChecker.getContextualType(element.parent); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/ false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } + else { + var argumentInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); + if (argumentInfo) { + // Get string literal completions from specialized signatures of the target + // i.e. declare function f(a: 'A'); + // f("/*completion position*/") + return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker); } + // Get completion for string literal from string literal type + // i.e. var x: "hi" | "hello" = "/*completion position*/" + return getStringLiteralCompletionEntriesFromType(typeChecker.getContextualType(node), typeChecker); } - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) { - var candidates = []; - var entries = []; - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); - for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { - var candidate = candidates_3[_i]; - if (candidate.parameters.length > argumentInfo.argumentIndex) { - var parameter = candidate.parameters[argumentInfo.argumentIndex]; - addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries); - } + } + function getStringLiteralCompletionEntriesFromPropertyAssignment(element, typeChecker, target, log) { + var type = typeChecker.getContextualType(element.parent); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/ false, typeChecker, target, log); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; } + } + } + function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker) { + var candidates = []; + var entries = []; + typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); + for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { + var candidate = candidates_3[_i]; + addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries, typeChecker); + } + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; + } + return undefined; + } + function getStringLiteralCompletionEntriesFromElementAccess(node, typeChecker, target, log) { + var type = typeChecker.getTypeAtLocation(node.expression); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/ false, typeChecker, target, log); if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; } - return undefined; } - function getStringLiteralCompletionEntriesFromElementAccess(node) { - var type = typeChecker.getTypeAtLocation(node.expression); + return undefined; + } + function getStringLiteralCompletionEntriesFromType(type, typeChecker) { + if (type) { var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/ false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } + addStringLiteralCompletionsFromType(type, entries, typeChecker); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; } - return undefined; } - function getStringLiteralCompletionEntriesFromContextualType(node) { - var type = typeChecker.getContextualType(node); - if (type) { - var entries_2 = []; - addStringLiteralCompletionsFromType(type, entries_2); - if (entries_2.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 }; - } - } - return undefined; + return undefined; + } + function addStringLiteralCompletionsFromType(type, result, typeChecker) { + if (type && type.flags & 16384 /* TypeParameter */) { + type = typeChecker.getApparentType(type); } - function addStringLiteralCompletionsFromType(type, result) { - if (type && type.flags & 16384 /* TypeParameter */) { - type = typeChecker.getApparentType(type); - } - if (!type) { - return; - } - if (type.flags & 65536 /* Union */) { - ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); }); - } - else { - if (type.flags & 32 /* StringLiteral */) { - result.push({ - name: type.text, - kindModifiers: ts.ScriptElementKindModifier.none, - kind: ts.ScriptElementKind.variableElement, - sortText: "0" - }); - } + if (!type) { + return; + } + if (type.flags & 65536 /* Union */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + addStringLiteralCompletionsFromType(t, result, typeChecker); } } - function getStringLiteralCompletionEntriesFromModuleNames(node) { - var literalValue = ts.normalizeSlashes(node.text); - var scriptPath = node.getSourceFile().path; - var scriptDirectory = ts.getDirectoryPath(scriptPath); - var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); - var entries; - if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { - if (compilerOptions.rootDirs) { - entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath); - } - else { - entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath); - } + else if (type.flags & 32 /* StringLiteral */) { + result.push({ + name: type.text, + kindModifiers: ts.ScriptElementKindModifier.none, + kind: ts.ScriptElementKind.variableElement, + sortText: "0" + }); + } + } + function getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker) { + var literalValue = ts.normalizeSlashes(node.text); + var scriptPath = node.getSourceFile().path; + var scriptDirectory = ts.getDirectoryPath(scriptPath); + var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); + var entries; + if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { + var extensions = ts.getSupportedExtensions(compilerOptions); + if (compilerOptions.rootDirs) { + entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, extensions, /*includeExtensions*/ false, span, compilerOptions, host, scriptPath); } else { - // Check for node modules - entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span); + entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensions, /*includeExtensions*/ false, span, host, scriptPath); } - return { - isGlobalCompletion: false, - isMemberCompletion: false, - isNewIdentifierLocation: true, - entries: entries - }; } - /** - * Takes a script path and returns paths for all potential folders that could be merged with its - * containing folder via the "rootDirs" compiler option - */ - function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { - // Make all paths absolute/normalized if they are not already - rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); - // Determine the path to the directory containing the script relative to the root directory it is contained within - var relativeDirectory; - for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) { - var rootDirectory = rootDirs_1[_i]; - if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { - relativeDirectory = scriptPath.substr(rootDirectory.length); - break; - } - } - // Now find a path for each potential directory that is to be merged with the one containing the script - return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); + else { + // Check for node modules + entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span, compilerOptions, host, typeChecker); } - function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) { - var basePath = compilerOptions.project || host.getCurrentDirectory(); - var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); - var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); - var result = []; - for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { - var baseDirectory = baseDirectories_1[_i]; - getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result); + return { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: true, + entries: entries + }; + } + /** + * Takes a script path and returns paths for all potential folders that could be merged with its + * containing folder via the "rootDirs" compiler option + */ + function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { + // Make all paths absolute/normalized if they are not already + rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); + // Determine the path to the directory containing the script relative to the root directory it is contained within + var relativeDirectory; + for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) { + var rootDirectory = rootDirs_1[_i]; + if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { + relativeDirectory = scriptPath.substr(rootDirectory.length); + break; } - return result; } + // Now find a path for each potential directory that is to be merged with the one containing the script + return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); + } + function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, compilerOptions, host, exclude) { + var basePath = compilerOptions.project || host.getCurrentDirectory(); + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); + var result = []; + for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { + var baseDirectory = baseDirectories_1[_i]; + getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, host, exclude, result); + } + return result; + } + /** + * Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename. + */ + function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, host, exclude, result) { + if (result === void 0) { result = []; } + if (fragment === undefined) { + fragment = ""; + } + fragment = ts.normalizeSlashes(fragment); /** - * Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename. + * Remove the basename from the path. Note that we don't use the basename to filter completions; + * the client is responsible for refining completions. */ - function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) { - if (result === void 0) { result = []; } - if (fragment === undefined) { - fragment = ""; - } - fragment = ts.normalizeSlashes(fragment); - /** - * Remove the basename from the path. Note that we don't use the basename to filter completions; - * the client is responsible for refining completions. - */ - fragment = ts.getDirectoryPath(fragment); - if (fragment === "") { - fragment = "." + ts.directorySeparator; - } - fragment = ts.ensureTrailingDirectorySeparator(fragment); - var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment)); - var baseDirectory = ts.getDirectoryPath(absolutePath); - var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); - if (tryDirectoryExists(host, baseDirectory)) { - // Enumerate the available files if possible - var files = tryReadDirectory(host, baseDirectory, extensions, /*exclude*/ undefined, /*include*/ ["./*"]); - if (files) { - /** - * Multiple file entries might map to the same truncated name once we remove extensions - * (happens iff includeExtensions === false)so we use a set-like data structure. Eg: - * - * both foo.ts and foo.tsx become foo - */ - var foundFiles = ts.createMap(); - for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { - var filePath = files_3[_i]; - filePath = ts.normalizePath(filePath); - if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0 /* EqualTo */) { - continue; - } - var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); - if (!foundFiles[foundFileName]) { - foundFiles[foundFileName] = true; - } + fragment = ts.getDirectoryPath(fragment); + if (fragment === "") { + fragment = "." + ts.directorySeparator; + } + fragment = ts.ensureTrailingDirectorySeparator(fragment); + var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment)); + var baseDirectory = ts.getDirectoryPath(absolutePath); + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + if (tryDirectoryExists(host, baseDirectory)) { + // Enumerate the available files if possible + var files = tryReadDirectory(host, baseDirectory, extensions, /*exclude*/ undefined, /*include*/ ["./*"]); + if (files) { + /** + * Multiple file entries might map to the same truncated name once we remove extensions + * (happens iff includeExtensions === false)so we use a set-like data structure. Eg: + * + * both foo.ts and foo.tsx become foo + */ + var foundFiles = ts.createMap(); + for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { + var filePath = files_3[_i]; + filePath = ts.normalizePath(filePath); + if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0 /* EqualTo */) { + continue; } - for (var foundFile in foundFiles) { - result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); + var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); + if (!foundFiles.get(foundFileName)) { + foundFiles.set(foundFileName, true); } } - // If possible, get folder completion as well - var directories = tryGetDirectories(host, baseDirectory); - if (directories) { - for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) { - var directory = directories_2[_a]; - var directoryName = ts.getBaseFileName(ts.normalizePath(directory)); - result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span)); - } + ts.forEachKey(foundFiles, function (foundFile) { + result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); + }); + } + // If possible, get folder completion as well + var directories = tryGetDirectories(host, baseDirectory); + if (directories) { + for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) { + var directory = directories_2[_a]; + var directoryName = ts.getBaseFileName(ts.normalizePath(directory)); + result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span)); } } - return result; } - /** - * Check all of the declared modules and those in node modules. Possible sources of modules: - * Modules that are found by the type checker - * Modules found relative to "baseUrl" compliler options (including patterns from "paths" compiler option) - * Modules from node_modules (i.e. those listed in package.json) - * This includes all files that are found in node_modules/moduleName/ with acceptable file extensions - */ - function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) { - var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; - var result; - if (baseUrl) { - var fileExtensions = ts.getSupportedExtensions(compilerOptions); - var projectDir = compilerOptions.project || host.getCurrentDirectory(); - var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); - result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, /*includeExtensions*/ false, span); - if (paths) { - for (var path in paths) { - if (paths.hasOwnProperty(path)) { - if (path === "*") { - if (paths[path]) { - for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { - var pattern = _a[_i]; - for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) { - var match = _c[_b]; - result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); - } + return result; + } + /** + * Check all of the declared modules and those in node modules. Possible sources of modules: + * Modules that are found by the type checker + * Modules found relative to "baseUrl" compliler options (including patterns from "paths" compiler option) + * Modules from node_modules (i.e. those listed in package.json) + * This includes all files that are found in node_modules/moduleName/ with acceptable file extensions + */ + function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span, compilerOptions, host, typeChecker) { + var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; + var result; + if (baseUrl) { + var fileExtensions = ts.getSupportedExtensions(compilerOptions); + var projectDir = compilerOptions.project || host.getCurrentDirectory(); + var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); + result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, /*includeExtensions*/ false, span, host); + if (paths) { + for (var path in paths) { + if (paths.hasOwnProperty(path)) { + if (path === "*") { + if (paths[path]) { + for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { + var pattern = _a[_i]; + for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host); _b < _c.length; _b++) { + var match = _c[_b]; + result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); } } } - else if (ts.startsWith(path, fragment)) { - var entry = paths[path] && paths[path].length === 1 && paths[path][0]; - if (entry) { - result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span)); - } + } + else if (ts.startsWith(path, fragment)) { + var entry = paths[path] && paths[path].length === 1 && paths[path][0]; + if (entry) { + result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span)); } } } } } - else { - result = []; - } - getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); - for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) { - var moduleName = _e[_d]; - result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); - } - return result; } - function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) { - if (host.readDirectory) { - var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; - if (parsed) { - // The prefix has two effective parts: the directory path and the base component after the filepath that is not a - // full directory component. For example: directory/path/of/prefix/base* - var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix); - var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix); - var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix); - var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1; - // Try and expand the prefix to include any path from the fragment so that we can limit the readDirectory call - var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory; - var normalizedSuffix = ts.normalizePath(parsed.suffix); - var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory); - var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; - // If we have a suffix, then we need to read the directory all the way down. We could create a glob - // that encodes the suffix, but we would have to escape the character "?" which readDirectory - // doesn't support. For now, this is safer but slower - var includeGlob = normalizedSuffix ? "**/*" : "./*"; - var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); - if (matches) { - var result = []; - // Trim away prefix and suffix - for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { - var match = matches_1[_i]; - var normalizedMatch = ts.normalizePath(match); - if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) { - continue; - } - var start = completePrefix.length; - var length_5 = normalizedMatch.length - start - normalizedSuffix.length; - result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); + else { + result = []; + } + getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); + for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host); _d < _e.length; _d++) { + var moduleName = _e[_d]; + result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); + } + return result; + } + function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) { + if (host.readDirectory) { + var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; + if (parsed) { + // The prefix has two effective parts: the directory path and the base component after the filepath that is not a + // full directory component. For example: directory/path/of/prefix/base* + var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix); + var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix); + var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix); + var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1; + // Try and expand the prefix to include any path from the fragment so that we can limit the readDirectory call + var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory; + var normalizedSuffix = ts.normalizePath(parsed.suffix); + var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory); + var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; + // If we have a suffix, then we need to read the directory all the way down. We could create a glob + // that encodes the suffix, but we would have to escape the character "?" which readDirectory + // doesn't support. For now, this is safer but slower + var includeGlob = normalizedSuffix ? "**/*" : "./*"; + var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); + if (matches) { + var result = []; + // Trim away prefix and suffix + for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { + var match = matches_1[_i]; + var normalizedMatch = ts.normalizePath(match); + if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) { + continue; } - return result; + var start = completePrefix.length; + var length_5 = normalizedMatch.length - start - normalizedSuffix.length; + result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); } + return result; } } - return undefined; } - function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) { - // Check If this is a nested module - var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; - var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; - // Get modules that the type checker picked up - var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); }); - var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); }); - // Nested modules of the form "module-name/sub" need to be adjusted to only return the string - // after the last '/' that appears in the fragment because that's where the replacement span - // starts - if (isNestedModule) { - var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment); - nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) { - if (ts.startsWith(fragment, moduleNameWithSeperator_1)) { - return moduleName.substr(moduleNameWithSeperator_1.length); - } - return moduleName; - }); - } - if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) { - for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) { - var visibleModule = _a[_i]; - if (!isNestedModule) { - nonRelativeModules.push(visibleModule.moduleName); - } - else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) { - var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, /*exclude*/ undefined, /*include*/ ["./*"]); - if (nestedFiles) { - for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) { - var f = nestedFiles_1[_b]; - f = ts.normalizePath(f); - var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f)); - nonRelativeModules.push(nestedModule); - } + return undefined; + } + function enumeratePotentialNonRelativeModules(fragment, scriptPath, options, typeChecker, host) { + // Check If this is a nested module + var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; + var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; + // Get modules that the type checker picked up + var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); }); + var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); }); + // Nested modules of the form "module-name/sub" need to be adjusted to only return the string + // after the last '/' that appears in the fragment because that's where the replacement span + // starts + if (isNestedModule) { + var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment); + nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) { + if (ts.startsWith(fragment, moduleNameWithSeperator_1)) { + return moduleName.substr(moduleNameWithSeperator_1.length); + } + return moduleName; + }); + } + if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) { + for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) { + var visibleModule = _a[_i]; + if (!isNestedModule) { + nonRelativeModules.push(visibleModule.moduleName); + } + else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) { + var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, /*exclude*/ undefined, /*include*/ ["./*"]); + if (nestedFiles) { + for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) { + var f = nestedFiles_1[_b]; + f = ts.normalizePath(f); + var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f)); + nonRelativeModules.push(nestedModule); } } } } - return ts.deduplicate(nonRelativeModules); } - function getTripleSlashReferenceCompletion(sourceFile, position) { - var token = ts.getTokenAtPosition(sourceFile, position); - if (!token) { - return undefined; - } - var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); - if (!commentRanges || !commentRanges.length) { - return undefined; + return ts.deduplicate(nonRelativeModules); + } + function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) { + var token = ts.getTokenAtPosition(sourceFile, position); + if (!token) { + return undefined; + } + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + if (!commentRanges || !commentRanges.length) { + return undefined; + } + var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; }); + if (!range) { + return undefined; + } + var completionInfo = { + /** + * We don't want the editor to offer any other completions, such as snippets, inside a comment. + */ + isGlobalCompletion: false, + isMemberCompletion: false, + /** + * The user may type in a path that doesn't yet exist, creating a "new identifier" + * with respect to the collection of identifiers the server is aware of. + */ + isNewIdentifierLocation: true, + entries: [] + }; + var text = sourceFile.text.substr(range.pos, position - range.pos); + var match = tripleSlashDirectiveFragmentRegex.exec(text); + if (match) { + var prefix = match[1]; + var kind = match[2]; + var toComplete = match[3]; + var scriptPath = ts.getDirectoryPath(sourceFile.path); + if (kind === "path") { + // Give completions for a relative path + var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); + completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ true, span_10, host, sourceFile.path); } - var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; }); - if (!range) { - return undefined; + else { + // Give completions based on the typings available + var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; + completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11); } - var completionInfo = { - /** - * We don't want the editor to offer any other completions, such as snippets, inside a comment. - */ - isGlobalCompletion: false, - isMemberCompletion: false, - /** - * The user may type in a path that doesn't yet exist, creating a "new identifier" - * with respect to the collection of identifiers the server is aware of. - */ - isNewIdentifierLocation: true, - entries: [] - }; - var text = sourceFile.text.substr(range.pos, position - range.pos); - var match = tripleSlashDirectiveFragmentRegex.exec(text); - if (match) { - var prefix = match[1]; - var kind = match[2]; - var toComplete = match[3]; - var scriptPath = ts.getDirectoryPath(sourceFile.path); - if (kind === "path") { - // Give completions for a relative path - var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); - completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ true, span_10, sourceFile.path); - } - else { - // Give completions based on the typings available - var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; - completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11); - } + } + return completionInfo; + } + function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { + if (result === void 0) { result = []; } + // Check for typings specified in compiler options + if (options.types) { + for (var _i = 0, _a = options.types; _i < _a.length; _i++) { + var moduleName = _a[_i]; + result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); } - return completionInfo; } - function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { - if (result === void 0) { result = []; } - // Check for typings specified in compiler options - if (options.types) { - for (var _i = 0, _a = options.types; _i < _a.length; _i++) { - var moduleName = _a[_i]; - result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); - } + else if (host.getDirectories) { + var typeRoots = void 0; + try { + // Wrap in try catch because getEffectiveTypeRoots touches the filesystem + typeRoots = ts.getEffectiveTypeRoots(options, host); } - else if (host.getDirectories) { - var typeRoots = void 0; - try { - // Wrap in try catch because getEffectiveTypeRoots touches the filesystem - typeRoots = ts.getEffectiveTypeRoots(options, host); - } - catch (e) { } - if (typeRoots) { - for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) { - var root = typeRoots_2[_b]; - getCompletionEntriesFromDirectories(host, root, span, result); - } + catch (e) { } + if (typeRoots) { + for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) { + var root = typeRoots_2[_b]; + getCompletionEntriesFromDirectories(host, root, span, result); } } - if (host.getDirectories) { - // Also get all @types typings installed in visible node_modules directories - for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) { - var packageJson = _d[_c]; - var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); - getCompletionEntriesFromDirectories(host, typesDir, span, result); - } + } + if (host.getDirectories) { + // Also get all @types typings installed in visible node_modules directories + for (var _c = 0, _d = findPackageJsons(scriptPath, host); _c < _d.length; _c++) { + var packageJson = _d[_c]; + var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); + getCompletionEntriesFromDirectories(host, typesDir, span, result); } - return result; } - function getCompletionEntriesFromDirectories(host, directory, span, result) { - if (host.getDirectories && tryDirectoryExists(host, directory)) { - var directories = tryGetDirectories(host, directory); - if (directories) { - for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) { - var typeDirectory = directories_3[_i]; - typeDirectory = ts.normalizePath(typeDirectory); - result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span)); - } + return result; + } + function getCompletionEntriesFromDirectories(host, directory, span, result) { + if (host.getDirectories && tryDirectoryExists(host, directory)) { + var directories = tryGetDirectories(host, directory); + if (directories) { + for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) { + var typeDirectory = directories_3[_i]; + typeDirectory = ts.normalizePath(typeDirectory); + result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span)); } } } - function findPackageJsons(currentDir) { - var paths = []; - var currentConfigPath; - while (true) { - currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, "package.json"); - if (currentConfigPath) { - paths.push(currentConfigPath); - currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_14 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_14) { - break; - } - currentDir = parent_14; - } - else { + } + function findPackageJsons(currentDir, host) { + var paths = []; + var currentConfigPath; + while (true) { + currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, "package.json"); + if (currentConfigPath) { + paths.push(currentConfigPath); + currentDir = ts.getDirectoryPath(currentConfigPath); + var parent = ts.getDirectoryPath(currentDir); + if (currentDir === parent) { break; } + currentDir = parent; } - return paths; - } - function enumerateNodeModulesVisibleToScript(host, scriptPath) { - var result = []; - if (host.readFile && host.fileExists) { - for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) { - var packageJson = _a[_i]; - var contents = tryReadingPackageJson(packageJson); - if (!contents) { - return; - } - var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules"); - var foundModuleNames = []; - // Provide completions for all non @types dependencies - for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) { - var key = nodeModulesDependencyKeys_1[_b]; - addPotentialPackageNames(contents[key], foundModuleNames); - } - for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) { - var moduleName = foundModuleNames_1[_c]; - var moduleDir = ts.combinePaths(nodeModulesDir, moduleName); - result.push({ - moduleName: moduleName, - moduleDir: moduleDir - }); - } - } + else { + break; } - return result; - function tryReadingPackageJson(filePath) { - try { - var fileText = tryReadFile(host, filePath); - return fileText ? JSON.parse(fileText) : undefined; + } + return paths; + } + function enumerateNodeModulesVisibleToScript(host, scriptPath) { + var result = []; + if (host.readFile && host.fileExists) { + for (var _i = 0, _a = findPackageJsons(scriptPath, host); _i < _a.length; _i++) { + var packageJson = _a[_i]; + var contents = tryReadingPackageJson(packageJson); + if (!contents) { + return; } - catch (e) { - return undefined; + var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules"); + var foundModuleNames = []; + // Provide completions for all non @types dependencies + for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) { + var key = nodeModulesDependencyKeys_1[_b]; + addPotentialPackageNames(contents[key], foundModuleNames); } - } - function addPotentialPackageNames(dependencies, result) { - if (dependencies) { - for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { - result.push(dep); - } - } + for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) { + var moduleName = foundModuleNames_1[_c]; + var moduleDir = ts.combinePaths(nodeModulesDir, moduleName); + result.push({ + moduleName: moduleName, + moduleDir: moduleDir + }); } } } - function createCompletionEntryForModule(name, kind, replacementSpan) { - return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan }; - } - // Replace everything after the last directory seperator that appears - function getDirectoryFragmentTextSpan(text, textStart) { - var index = text.lastIndexOf(ts.directorySeparator); - var offset = index !== -1 ? index + 1 : 0; - return { start: textStart + offset, length: text.length - offset }; + return result; + function tryReadingPackageJson(filePath) { + try { + var fileText = tryReadFile(host, filePath); + return fileText ? JSON.parse(fileText) : undefined; + } + catch (e) { + return undefined; + } } - // Returns true if the path is explicitly relative to the script (i.e. relative to . or ..) - function isPathRelativeToScript(path) { - if (path && path.length >= 2 && path.charCodeAt(0) === 46 /* dot */) { - var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 /* dot */ ? 2 : 1; - var slashCharCode = path.charCodeAt(slashIndex); - return slashCharCode === 47 /* slash */ || slashCharCode === 92 /* backslash */; + function addPotentialPackageNames(dependencies, result) { + if (dependencies) { + for (var dep in dependencies) { + if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + result.push(dep); + } + } } - return false; } - function normalizeAndPreserveTrailingSlash(path) { - return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); + } + function createCompletionEntryForModule(name, kind, replacementSpan) { + return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan }; + } + // Replace everything after the last directory seperator that appears + function getDirectoryFragmentTextSpan(text, textStart) { + var index = text.lastIndexOf(ts.directorySeparator); + var offset = index !== -1 ? index + 1 : 0; + return { start: textStart + offset, length: text.length - offset }; + } + // Returns true if the path is explicitly relative to the script (i.e. relative to . or ..) + function isPathRelativeToScript(path) { + if (path && path.length >= 2 && path.charCodeAt(0) === 46 /* dot */) { + var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 /* dot */ ? 2 : 1; + var slashCharCode = path.charCodeAt(slashIndex); + return slashCharCode === 47 /* slash */ || slashCharCode === 92 /* backslash */; } + return false; + } + function normalizeAndPreserveTrailingSlash(path) { + return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); } - Completions.getCompletionsAtPosition = getCompletionsAtPosition; function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) { // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_3 = completionData.location; + var symbols = completionData.symbols, location_1 = completionData.location; // Find the symbol with the matching entry name. // 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(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; }); + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_1) === entryName ? s : undefined; }); if (symbol) { - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_1, location_1, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { name: entryName, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), @@ -68764,12 +69078,12 @@ var ts; // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_4 = completionData.location; + var symbols = completionData.symbols, location_2 = completionData.location; // Find the symbol with the matching entry name. // 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. - return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_4) === entryName ? s : undefined; }); + return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_2) === entryName ? s : undefined; }); } return undefined; } @@ -68800,9 +69114,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 284 /* JSDocTypeTag */: - case 282 /* JSDocParameterTag */: - case 283 /* JSDocReturnTag */: + case 285 /* JSDocTypeTag */: + case 283 /* JSDocParameterTag */: + case 284 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -68847,13 +69161,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_15 = contextToken.parent, kind = contextToken.kind; + var parent = contextToken.parent, kind = contextToken.kind; if (kind === 22 /* DotToken */) { - if (parent_15.kind === 177 /* PropertyAccessExpression */) { + if (parent.kind === 178 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_15.kind === 141 /* QualifiedName */) { + else if (parent.kind === 142 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -68868,7 +69182,7 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 250 /* JsxClosingElement */) { + else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 251 /* JsxClosingElement */) { isStartingCloseTag = true; location = contextToken; } @@ -68917,7 +69231,7 @@ var ts; isGlobalCompletion = false; isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */) { + if (node.kind === 70 /* Identifier */ || node.kind === 142 /* QualifiedName */ || node.kind === 178 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -68973,7 +69287,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 248 /* JsxSelfClosingElement */) || (jsxContainer.kind === 249 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 249 /* JsxSelfClosingElement */) || (jsxContainer.kind === 250 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -69021,9 +69335,9 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 262 /* SourceFile */ || - scopeNode.kind === 194 /* TemplateExpression */ || - scopeNode.kind === 253 /* JsxExpression */ || + scopeNode.kind === 263 /* SourceFile */ || + scopeNode.kind === 195 /* TemplateExpression */ || + scopeNode.kind === 254 /* JsxExpression */ || ts.isStatement(scopeNode); } /// TODO filter meaning based on the current context @@ -69056,11 +69370,11 @@ var ts; return true; } if (contextToken.kind === 28 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 249 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 250 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 250 /* JsxClosingElement */ || contextToken.parent.kind === 248 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 247 /* JsxElement */; + if (contextToken.parent.kind === 251 /* JsxClosingElement */ || contextToken.parent.kind === 249 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 248 /* JsxElement */; } } return false; @@ -69070,40 +69384,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 25 /* CommaToken */: - return containingNodeKind === 179 /* CallExpression */ // func( a, | - || containingNodeKind === 150 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 180 /* NewExpression */ // new C(a, | - || containingNodeKind === 175 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 192 /* BinaryExpression */ // const x = (a, | - || containingNodeKind === 158 /* FunctionType */; // var x: (s: string, list| + return containingNodeKind === 180 /* CallExpression */ // func( a, | + || containingNodeKind === 151 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 181 /* NewExpression */ // new C(a, | + || containingNodeKind === 176 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 193 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 159 /* FunctionType */; // var x: (s: string, list| case 18 /* OpenParenToken */: - return containingNodeKind === 179 /* CallExpression */ // func( | - || containingNodeKind === 150 /* Constructor */ // constructor( | - || containingNodeKind === 180 /* NewExpression */ // new C(a| - || containingNodeKind === 183 /* ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 166 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 180 /* CallExpression */ // func( | + || containingNodeKind === 151 /* Constructor */ // constructor( | + || containingNodeKind === 181 /* NewExpression */ // new C(a| + || containingNodeKind === 184 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 167 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 20 /* OpenBracketToken */: - return containingNodeKind === 175 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 155 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 142 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + return containingNodeKind === 176 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 156 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 143 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 127 /* ModuleKeyword */: // module | case 128 /* NamespaceKeyword */: return true; case 22 /* DotToken */: - return containingNodeKind === 231 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 232 /* ModuleDeclaration */; // module A.| case 16 /* OpenBraceToken */: - return containingNodeKind === 227 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 228 /* ClassDeclaration */; // class A{ | case 57 /* EqualsToken */: - return containingNodeKind === 224 /* VariableDeclaration */ // const x = a| - || containingNodeKind === 192 /* BinaryExpression */; // x = a| + return containingNodeKind === 225 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 193 /* BinaryExpression */; // x = a| case 13 /* TemplateHead */: - return containingNodeKind === 194 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 195 /* TemplateExpression */; // `aa ${| case 14 /* TemplateMiddle */: - return containingNodeKind === 203 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 204 /* TemplateSpan */; // `aa ${10} dd ${| case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: - return containingNodeKind === 147 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 148 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -69146,7 +69460,7 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 176 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 177 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; @@ -69156,7 +69470,7 @@ var ts; typeForObject = typeForObject && typeForObject.getNonNullableType(); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 172 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 173 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -69167,11 +69481,11 @@ var ts; // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); - if (!canGetType && rootDeclaration.kind === 144 /* Parameter */) { + if (!canGetType && rootDeclaration.kind === 145 /* Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 149 /* MethodDeclaration */ || rootDeclaration.parent.kind === 152 /* SetAccessor */) { + else if (rootDeclaration.parent.kind === 150 /* MethodDeclaration */ || rootDeclaration.parent.kind === 153 /* SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -69213,9 +69527,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 239 /* NamedImports */ ? - 236 /* ImportDeclaration */ : - 242 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 240 /* NamedImports */ ? + 237 /* ImportDeclaration */ : + 243 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -69223,12 +69537,13 @@ var ts; } isMemberCompletion = true; isNewIdentifierLocation = false; - var exports; - var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier); - if (moduleSpecifierSymbol) { - exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol); + var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); + if (!moduleSpecifierSymbol) { + symbols = ts.emptyArray; + return true; } - symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : ts.emptyArray; + var exports = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol); + symbols = filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements); return true; } /** @@ -69240,9 +69555,9 @@ var ts; switch (contextToken.kind) { case 16 /* OpenBraceToken */: // const x = { | case 25 /* CommaToken */: - var parent_16 = contextToken.parent; - if (parent_16 && (parent_16.kind === 176 /* ObjectLiteralExpression */ || parent_16.kind === 172 /* ObjectBindingPattern */)) { - return parent_16; + var parent = contextToken.parent; + if (parent && (parent.kind === 177 /* ObjectLiteralExpression */ || parent.kind === 173 /* ObjectBindingPattern */)) { + return parent; } break; } @@ -69259,8 +69574,8 @@ var ts; case 16 /* OpenBraceToken */: // import { | case 25 /* CommaToken */: switch (contextToken.parent.kind) { - case 239 /* NamedImports */: - case 243 /* NamedExports */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: return contextToken.parent; } } @@ -69269,37 +69584,37 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_17 = contextToken.parent; + var parent = contextToken.parent; switch (contextToken.kind) { case 27 /* LessThanSlashToken */: case 40 /* SlashToken */: case 70 /* Identifier */: - case 251 /* JsxAttribute */: - case 252 /* JsxSpreadAttribute */: - if (parent_17 && (parent_17.kind === 248 /* JsxSelfClosingElement */ || parent_17.kind === 249 /* JsxOpeningElement */)) { - return parent_17; + case 252 /* JsxAttribute */: + case 253 /* JsxSpreadAttribute */: + if (parent && (parent.kind === 249 /* JsxSelfClosingElement */ || parent.kind === 250 /* JsxOpeningElement */)) { + return parent; } - else if (parent_17.kind === 251 /* JsxAttribute */) { - return parent_17.parent; + else if (parent.kind === 252 /* JsxAttribute */) { + return parent.parent; } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_17 && ((parent_17.kind === 251 /* JsxAttribute */) || (parent_17.kind === 252 /* JsxSpreadAttribute */))) { - return parent_17.parent; + if (parent && ((parent.kind === 252 /* JsxAttribute */) || (parent.kind === 253 /* JsxSpreadAttribute */))) { + return parent.parent; } break; case 17 /* CloseBraceToken */: - if (parent_17 && - parent_17.kind === 253 /* JsxExpression */ && - parent_17.parent && - (parent_17.parent.kind === 251 /* JsxAttribute */)) { - return parent_17.parent.parent; + if (parent && + parent.kind === 254 /* JsxExpression */ && + parent.parent && + (parent.parent.kind === 252 /* JsxAttribute */)) { + return parent.parent.parent; } - if (parent_17 && parent_17.kind === 252 /* JsxSpreadAttribute */) { - return parent_17.parent; + if (parent && parent.kind === 253 /* JsxSpreadAttribute */) { + return parent.parent; } break; } @@ -69308,16 +69623,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: return true; } return false; @@ -69329,66 +69644,66 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 25 /* CommaToken */: - return containingNodeKind === 224 /* VariableDeclaration */ || - containingNodeKind === 225 /* VariableDeclarationList */ || - containingNodeKind === 206 /* VariableStatement */ || - containingNodeKind === 230 /* EnumDeclaration */ || + return containingNodeKind === 225 /* VariableDeclaration */ || + containingNodeKind === 226 /* VariableDeclarationList */ || + containingNodeKind === 207 /* VariableStatement */ || + containingNodeKind === 231 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 227 /* ClassDeclaration */ || - containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 228 /* InterfaceDeclaration */ || - containingNodeKind === 173 /* ArrayBindingPattern */ || - containingNodeKind === 229 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 228 /* ClassDeclaration */ || + containingNodeKind === 198 /* ClassExpression */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 174 /* ArrayBindingPattern */ || + containingNodeKind === 230 /* TypeAliasDeclaration */; // type Map, K, | case 22 /* DotToken */: - return containingNodeKind === 173 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 174 /* ArrayBindingPattern */; // var [.| case 55 /* ColonToken */: - return containingNodeKind === 174 /* BindingElement */; // var {x :html| + return containingNodeKind === 175 /* BindingElement */; // var {x :html| case 20 /* OpenBracketToken */: - return containingNodeKind === 173 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 174 /* ArrayBindingPattern */; // var [x| case 18 /* OpenParenToken */: - return containingNodeKind === 257 /* CatchClause */ || + return containingNodeKind === 258 /* CatchClause */ || isFunction(containingNodeKind); case 16 /* OpenBraceToken */: - return containingNodeKind === 230 /* EnumDeclaration */ || - containingNodeKind === 228 /* InterfaceDeclaration */ || - containingNodeKind === 161 /* TypeLiteral */; // const x : { | + return containingNodeKind === 231 /* EnumDeclaration */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 162 /* TypeLiteral */; // const x : { | case 24 /* SemicolonToken */: - return containingNodeKind === 146 /* PropertySignature */ && + return containingNodeKind === 147 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 228 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 161 /* TypeLiteral */); // const x : { a; | + (contextToken.parent.parent.kind === 229 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 162 /* TypeLiteral */); // const x : { a; | case 26 /* LessThanToken */: - return containingNodeKind === 227 /* ClassDeclaration */ || - containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 228 /* InterfaceDeclaration */ || - containingNodeKind === 229 /* TypeAliasDeclaration */ || + return containingNodeKind === 228 /* ClassDeclaration */ || + containingNodeKind === 198 /* ClassExpression */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 230 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); case 114 /* StaticKeyword */: - return containingNodeKind === 147 /* PropertyDeclaration */; + return containingNodeKind === 148 /* PropertyDeclaration */; case 23 /* DotDotDotToken */: - return containingNodeKind === 144 /* Parameter */ || + return containingNodeKind === 145 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 173 /* ArrayBindingPattern */); // var [...z| + contextToken.parent.parent.kind === 174 /* ArrayBindingPattern */); // var [...z| case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: - return containingNodeKind === 144 /* Parameter */; + return containingNodeKind === 145 /* Parameter */; case 117 /* AsKeyword */: - return containingNodeKind === 240 /* ImportSpecifier */ || - containingNodeKind === 244 /* ExportSpecifier */ || - containingNodeKind === 238 /* NamespaceImport */; + return containingNodeKind === 241 /* ImportSpecifier */ || + containingNodeKind === 245 /* ExportSpecifier */ || + containingNodeKind === 239 /* NamespaceImport */; case 74 /* ClassKeyword */: case 82 /* EnumKeyword */: case 108 /* InterfaceKeyword */: case 88 /* FunctionKeyword */: case 103 /* VarKeyword */: case 124 /* GetKeyword */: - case 133 /* SetKeyword */: + case 134 /* SetKeyword */: case 90 /* ImportKeyword */: case 109 /* LetKeyword */: case 75 /* ConstKeyword */: case 115 /* YieldKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -69436,13 +69751,13 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_46 = element.propertyName || element.name; - existingImportsOrExports[name_46.text] = true; + var name = element.propertyName || element.name; + existingImportsOrExports.set(name.text, true); } - if (!ts.someProperties(existingImportsOrExports)) { + if (existingImportsOrExports.size === 0) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); } - return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports[e.name]; }); + return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports.get(e.name); }); } /** * Filters out completion suggestions for named imports or exports. @@ -69458,12 +69773,12 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 258 /* PropertyAssignment */ && - m.kind !== 259 /* ShorthandPropertyAssignment */ && - m.kind !== 174 /* BindingElement */ && - m.kind !== 149 /* MethodDeclaration */ && - m.kind !== 151 /* GetAccessor */ && - m.kind !== 152 /* SetAccessor */) { + if (m.kind !== 259 /* PropertyAssignment */ && + m.kind !== 260 /* ShorthandPropertyAssignment */ && + m.kind !== 175 /* BindingElement */ && + m.kind !== 150 /* MethodDeclaration */ && + m.kind !== 152 /* GetAccessor */ && + m.kind !== 153 /* SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -69471,7 +69786,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 174 /* BindingElement */ && m.propertyName) { + if (m.kind === 175 /* BindingElement */ && m.propertyName) { // include only identifiers in completion list if (m.propertyName.kind === 70 /* Identifier */) { existingName = m.propertyName.text; @@ -69483,9 +69798,9 @@ var ts; // things like '__proto__' are not filtered out. existingName = m.name.text; } - existingMemberNames[existingName] = true; + existingMemberNames.set(existingName, true); } - return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; }); + return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames.get(m.name); }); } /** * Filters out completion suggestions from 'symbols' according to existing JSX attributes. @@ -69501,11 +69816,11 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 251 /* JsxAttribute */) { - seenNames[attr.name.text] = true; + if (attr.kind === 252 /* JsxAttribute */) { + seenNames.set(attr.name.text, true); } } - return ts.filter(symbols, function (a) { return !seenNames[a.name]; }); + return ts.filter(symbols, function (a) { return !seenNames.get(a.name); }); } } /** @@ -69551,7 +69866,7 @@ var ts; } // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 71 /* FirstKeyword */; i <= 140 /* LastKeyword */; i++) { + for (var i = 71 /* FirstKeyword */; i <= 141 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ts.ScriptElementKind.keyword, @@ -69603,6 +69918,15 @@ var ts; catch (e) { } return undefined; } + function isEqualityExpression(node) { + return ts.isBinaryExpression(node) && isEqualityOperatorKind(node.operatorToken.kind); + } + function isEqualityOperatorKind(kind) { + return kind == 31 /* EqualsEqualsToken */ || + kind === 32 /* ExclamationEqualsToken */ || + kind === 33 /* EqualsEqualsEqualsToken */ || + kind === 34 /* ExclamationEqualsEqualsToken */; + } })(Completions = ts.Completions || (ts.Completions = {})); })(ts || (ts = {})); /* @internal */ @@ -69612,534 +69936,519 @@ var ts; (function (DocumentHighlights) { function getDocumentHighlights(typeChecker, cancellationToken, sourceFile, position, sourceFilesToSearch) { var node = ts.getTouchingWord(sourceFile, position); + return node && (getSemanticDocumentHighlights(node, typeChecker, cancellationToken, sourceFilesToSearch) || getSyntacticDocumentHighlights(node, sourceFile)); + } + DocumentHighlights.getDocumentHighlights = getDocumentHighlights; + function getHighlightSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var end = node.getEnd(); + return { + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + kind: ts.HighlightSpanKind.none + }; + } + function getSemanticDocumentHighlights(node, typeChecker, cancellationToken, sourceFilesToSearch) { + var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFilesToSearch); + return referencedSymbols && convertReferencedSymbols(referencedSymbols); + } + function convertReferencedSymbols(referencedSymbols) { + var fileNameToDocumentHighlights = ts.createMap(); + var result = []; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var referencedSymbol = referencedSymbols_1[_i]; + for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { + var referenceEntry = _b[_a]; + var fileName = referenceEntry.fileName; + var documentHighlights = fileNameToDocumentHighlights.get(fileName); + if (!documentHighlights) { + documentHighlights = { fileName: fileName, highlightSpans: [] }; + fileNameToDocumentHighlights.set(fileName, documentHighlights); + result.push(documentHighlights); + } + documentHighlights.highlightSpans.push({ + textSpan: referenceEntry.textSpan, + kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference + }); + } + } + return result; + } + function getSyntacticDocumentHighlights(node, sourceFile) { + var highlightSpans = getHighlightSpans(node, sourceFile); + if (!highlightSpans || highlightSpans.length === 0) { + return undefined; + } + return [{ fileName: sourceFile.fileName, highlightSpans: highlightSpans }]; + } + // returns true if 'node' is defined and has a matching 'kind'. + function hasKind(node, kind) { + return node !== undefined && node.kind === kind; + } + // Null-propagating 'parent' function. + function parent(node) { + return node && node.parent; + } + function getHighlightSpans(node, sourceFile) { if (!node) { return undefined; } - return getSemanticDocumentHighlights(node) || getSyntacticDocumentHighlights(node); - function getHighlightSpanForNode(node) { - var start = node.getStart(); - var end = node.getEnd(); - return { - fileName: sourceFile.fileName, - textSpan: ts.createTextSpanFromBounds(start, end), - kind: ts.HighlightSpanKind.none - }; + switch (node.kind) { + case 89 /* IfKeyword */: + case 81 /* ElseKeyword */: + if (hasKind(node.parent, 210 /* IfStatement */)) { + return getIfElseOccurrences(node.parent, sourceFile); + } + break; + case 95 /* ReturnKeyword */: + if (hasKind(node.parent, 218 /* ReturnStatement */)) { + return highlightSpans(getReturnOccurrences(node.parent)); + } + break; + case 99 /* ThrowKeyword */: + if (hasKind(node.parent, 222 /* ThrowStatement */)) { + return highlightSpans(getThrowOccurrences(node.parent)); + } + break; + case 101 /* TryKeyword */: + case 73 /* CatchKeyword */: + case 86 /* FinallyKeyword */: + var tryStatement = node.kind === 73 /* CatchKeyword */ ? parent(parent(node)) : parent(node); + if (hasKind(tryStatement, 223 /* TryStatement */)) { + return highlightSpans(getTryCatchFinallyOccurrences(tryStatement, sourceFile)); + } + break; + case 97 /* SwitchKeyword */: + if (hasKind(node.parent, 220 /* SwitchStatement */)) { + return highlightSpans(getSwitchCaseDefaultOccurrences(node.parent)); + } + break; + case 72 /* CaseKeyword */: + case 78 /* DefaultKeyword */: + if (hasKind(parent(parent(parent(node))), 220 /* SwitchStatement */)) { + return highlightSpans(getSwitchCaseDefaultOccurrences(node.parent.parent.parent)); + } + break; + case 71 /* BreakKeyword */: + case 76 /* ContinueKeyword */: + if (hasKind(node.parent, 217 /* BreakStatement */) || hasKind(node.parent, 216 /* ContinueStatement */)) { + return highlightSpans(getBreakOrContinueStatementOccurrences(node.parent)); + } + break; + case 87 /* ForKeyword */: + if (hasKind(node.parent, 213 /* ForStatement */) || + hasKind(node.parent, 214 /* ForInStatement */) || + hasKind(node.parent, 215 /* ForOfStatement */)) { + return highlightSpans(getLoopBreakContinueOccurrences(node.parent)); + } + break; + case 105 /* WhileKeyword */: + case 80 /* DoKeyword */: + if (hasKind(node.parent, 212 /* WhileStatement */) || hasKind(node.parent, 211 /* DoStatement */)) { + return highlightSpans(getLoopBreakContinueOccurrences(node.parent)); + } + break; + case 122 /* ConstructorKeyword */: + if (hasKind(node.parent, 151 /* Constructor */)) { + return highlightSpans(getConstructorOccurrences(node.parent)); + } + break; + case 124 /* GetKeyword */: + case 134 /* SetKeyword */: + if (hasKind(node.parent, 152 /* GetAccessor */) || hasKind(node.parent, 153 /* SetAccessor */)) { + return highlightSpans(getGetAndSetOccurrences(node.parent)); + } + break; + default: + if (ts.isModifierKind(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 207 /* VariableStatement */)) { + return highlightSpans(getModifierOccurrences(node.kind, node.parent)); + } } - function getSemanticDocumentHighlights(node) { - if (node.kind === 70 /* Identifier */ || - node.kind === 98 /* ThisKeyword */ || - node.kind === 167 /* ThisType */ || - node.kind === 96 /* SuperKeyword */ || - node.kind === 9 /* StringLiteral */ || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFilesToSearch, /*findInStrings*/ false, /*findInComments*/ false, /*implementations*/ false); - return convertReferencedSymbols(referencedSymbols); + function highlightSpans(nodes) { + return nodes && nodes.map(function (node) { return getHighlightSpanForNode(node, sourceFile); }); + } + } + /** + * Aggregates all throw-statements within this node *without* crossing + * into function boundaries and try-blocks with catch-clauses. + */ + function aggregateOwnedThrowStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 222 /* ThrowStatement */) { + statementAccumulator.push(node); } - return undefined; - function convertReferencedSymbols(referencedSymbols) { - if (!referencedSymbols) { - return undefined; + else if (node.kind === 223 /* TryStatement */) { + var tryStatement = node; + if (tryStatement.catchClause) { + aggregate(tryStatement.catchClause); } - var fileNameToDocumentHighlights = ts.createMap(); - var result = []; - for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { - var referencedSymbol = referencedSymbols_1[_i]; - for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { - var referenceEntry = _b[_a]; - var fileName = referenceEntry.fileName; - var documentHighlights = fileNameToDocumentHighlights[fileName]; - if (!documentHighlights) { - documentHighlights = { fileName: fileName, highlightSpans: [] }; - fileNameToDocumentHighlights[fileName] = documentHighlights; - result.push(documentHighlights); - } - documentHighlights.highlightSpans.push({ - textSpan: referenceEntry.textSpan, - kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference - }); - } + else { + // Exceptions thrown within a try block lacking a catch clause + // are "owned" in the current context. + aggregate(tryStatement.tryBlock); } - return result; + if (tryStatement.finallyBlock) { + aggregate(tryStatement.finallyBlock); + } + } + else if (!ts.isFunctionLike(node)) { + ts.forEachChild(node, aggregate); } } - function getSyntacticDocumentHighlights(node) { - var fileName = sourceFile.fileName; - var highlightSpans = getHighlightSpans(node); - if (!highlightSpans || highlightSpans.length === 0) { - return undefined; + } + /** + * For lack of a better name, this function takes a throw statement and returns the + * nearest ancestor that is a try-block (whose try statement has a catch clause), + * function-block, or source file. + */ + function getThrowStatementOwner(throwStatement) { + var child = throwStatement; + while (child.parent) { + var parent_2 = child.parent; + if (ts.isFunctionBlock(parent_2) || parent_2.kind === 263 /* SourceFile */) { + return parent_2; } - return [{ fileName: fileName, highlightSpans: highlightSpans }]; - // returns true if 'node' is defined and has a matching 'kind'. - function hasKind(node, kind) { - return node !== undefined && node.kind === kind; + // 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_2.kind === 223 /* TryStatement */) { + var tryStatement = parent_2; + if (tryStatement.tryBlock === child && tryStatement.catchClause) { + return child; + } } - // Null-propagating 'parent' function. - function parent(node) { - return node && node.parent; + child = parent_2; + } + return undefined; + } + function aggregateAllBreakAndContinueStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 217 /* BreakStatement */ || node.kind === 216 /* ContinueStatement */) { + statementAccumulator.push(node); } - function getHighlightSpans(node) { - if (node) { - switch (node.kind) { - case 89 /* IfKeyword */: - case 81 /* ElseKeyword */: - if (hasKind(node.parent, 209 /* IfStatement */)) { - return getIfElseOccurrences(node.parent); - } - break; - case 95 /* ReturnKeyword */: - if (hasKind(node.parent, 217 /* ReturnStatement */)) { - return getReturnOccurrences(node.parent); - } - break; - case 99 /* ThrowKeyword */: - if (hasKind(node.parent, 221 /* ThrowStatement */)) { - return getThrowOccurrences(node.parent); - } - break; - case 73 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 222 /* TryStatement */)) { - return getTryCatchFinallyOccurrences(node.parent.parent); - } - break; - case 101 /* TryKeyword */: - case 86 /* FinallyKeyword */: - if (hasKind(parent(node), 222 /* TryStatement */)) { - return getTryCatchFinallyOccurrences(node.parent); - } - break; - case 97 /* SwitchKeyword */: - if (hasKind(node.parent, 219 /* SwitchStatement */)) { - return getSwitchCaseDefaultOccurrences(node.parent); - } - break; - case 72 /* CaseKeyword */: - case 78 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 219 /* SwitchStatement */)) { - return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); - } - break; - case 71 /* BreakKeyword */: - case 76 /* ContinueKeyword */: - if (hasKind(node.parent, 216 /* BreakStatement */) || hasKind(node.parent, 215 /* ContinueStatement */)) { - return getBreakOrContinueStatementOccurrences(node.parent); - } - break; - case 87 /* ForKeyword */: - if (hasKind(node.parent, 212 /* ForStatement */) || - hasKind(node.parent, 213 /* ForInStatement */) || - hasKind(node.parent, 214 /* ForOfStatement */)) { - return getLoopBreakContinueOccurrences(node.parent); - } - break; - case 105 /* WhileKeyword */: - case 80 /* DoKeyword */: - if (hasKind(node.parent, 211 /* WhileStatement */) || hasKind(node.parent, 210 /* DoStatement */)) { - return getLoopBreakContinueOccurrences(node.parent); - } - break; - case 122 /* ConstructorKeyword */: - if (hasKind(node.parent, 150 /* Constructor */)) { - return getConstructorOccurrences(node.parent); - } - break; - case 124 /* GetKeyword */: - case 133 /* SetKeyword */: - if (hasKind(node.parent, 151 /* GetAccessor */) || hasKind(node.parent, 152 /* SetAccessor */)) { - return getGetAndSetOccurrences(node.parent); - } - break; - default: - if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 206 /* VariableStatement */)) { - return getModifierOccurrences(node.kind, node.parent); - } - } - } - return undefined; + else if (!ts.isFunctionLike(node)) { + ts.forEachChild(node, aggregate); } - /** - * Aggregates all throw-statements within this node *without* crossing - * into function boundaries and try-blocks with catch-clauses. - */ - function aggregateOwnedThrowStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 221 /* ThrowStatement */) { - statementAccumulator.push(node); - } - else if (node.kind === 222 /* TryStatement */) { - var tryStatement = node; - if (tryStatement.catchClause) { - aggregate(tryStatement.catchClause); - } - else { - // Exceptions thrown within a try block lacking a catch clause - // are "owned" in the current context. - aggregate(tryStatement.tryBlock); - } - if (tryStatement.finallyBlock) { - aggregate(tryStatement.finallyBlock); - } + } + } + function ownsBreakOrContinueStatement(owner, statement) { + var actualOwner = getBreakOrContinueOwner(statement); + return actualOwner && actualOwner === owner; + } + function getBreakOrContinueOwner(statement) { + for (var node = statement.parent; node; node = node.parent) { + switch (node.kind) { + case 220 /* SwitchStatement */: + if (statement.kind === 216 /* ContinueStatement */) { + continue; } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); + // Fall through. + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 212 /* WhileStatement */: + case 211 /* DoStatement */: + if (!statement.label || isLabeledBy(node, statement.label.text)) { + return node; } - } - } - /** - * For lack of a better name, this function takes a throw statement and returns the - * nearest ancestor that is a try-block (whose try statement has a catch clause), - * function-block, or source file. - */ - function getThrowStatementOwner(throwStatement) { - var child = throwStatement; - while (child.parent) { - var parent_18 = child.parent; - if (ts.isFunctionBlock(parent_18) || parent_18.kind === 262 /* SourceFile */) { - return parent_18; - } - // 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_18.kind === 222 /* TryStatement */) { - var tryStatement = parent_18; - if (tryStatement.tryBlock === child && tryStatement.catchClause) { - return child; - } + break; + default: + // Don't cross function boundaries. + if (ts.isFunctionLike(node)) { + return undefined; } - child = parent_18; - } + break; + } + } + return undefined; + } + function getModifierOccurrences(modifier, declaration) { + 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 === 228 /* ClassDeclaration */ || + container.kind === 198 /* ClassExpression */ || + (declaration.kind === 145 /* Parameter */ && hasKind(container, 151 /* Constructor */)))) { return undefined; } - function aggregateAllBreakAndContinueStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 216 /* BreakStatement */ || node.kind === 215 /* ContinueStatement */) { - statementAccumulator.push(node); - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); - } - } + } + else if (modifier === 114 /* StaticKeyword */) { + if (!(container.kind === 228 /* ClassDeclaration */ || container.kind === 198 /* ClassExpression */)) { + return undefined; } - function ownsBreakOrContinueStatement(owner, statement) { - var actualOwner = getBreakOrContinueOwner(statement); - return actualOwner && actualOwner === owner; + } + else if (modifier === 83 /* ExportKeyword */ || modifier === 123 /* DeclareKeyword */) { + if (!(container.kind === 233 /* ModuleBlock */ || container.kind === 263 /* SourceFile */)) { + return undefined; } - function getBreakOrContinueOwner(statement) { - for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { - switch (node_2.kind) { - case 219 /* SwitchStatement */: - if (statement.kind === 215 /* ContinueStatement */) { - continue; - } - // Fall through. - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 211 /* WhileStatement */: - case 210 /* DoStatement */: - if (!statement.label || isLabeledBy(node_2, statement.label.text)) { - return node_2; - } - break; - default: - // Don't cross function boundaries. - if (ts.isFunctionLike(node_2)) { - return undefined; - } - break; - } - } + } + else if (modifier === 116 /* AbstractKeyword */) { + if (!(container.kind === 228 /* ClassDeclaration */ || declaration.kind === 228 /* ClassDeclaration */)) { return undefined; } - function getModifierOccurrences(modifier, declaration) { - 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 === 227 /* ClassDeclaration */ || - container.kind === 197 /* ClassExpression */ || - (declaration.kind === 144 /* Parameter */ && hasKind(container, 150 /* Constructor */)))) { - return undefined; - } - } - else if (modifier === 114 /* StaticKeyword */) { - if (!(container.kind === 227 /* ClassDeclaration */ || container.kind === 197 /* ClassExpression */)) { - return undefined; - } - } - else if (modifier === 83 /* ExportKeyword */ || modifier === 123 /* DeclareKeyword */) { - if (!(container.kind === 232 /* ModuleBlock */ || container.kind === 262 /* SourceFile */)) { - return undefined; - } - } - else if (modifier === 116 /* AbstractKeyword */) { - if (!(container.kind === 227 /* ClassDeclaration */ || declaration.kind === 227 /* ClassDeclaration */)) { - return undefined; - } + } + else { + // unsupported modifier + return undefined; + } + var keywords = []; + var modifierFlag = getFlagFromModifier(modifier); + var nodes; + switch (container.kind) { + case 233 /* ModuleBlock */: + case 263 /* SourceFile */: + // Container is either a class declaration or the declaration is a classDeclaration + if (modifierFlag & 128 /* Abstract */) { + nodes = declaration.members.concat(declaration); } else { - // unsupported modifier - return undefined; - } - var keywords = []; - var modifierFlag = getFlagFromModifier(modifier); - var nodes; - switch (container.kind) { - case 232 /* ModuleBlock */: - case 262 /* SourceFile */: - // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* Abstract */) { - nodes = declaration.members.concat(declaration); - } - else { - nodes = container.statements; - } - break; - case 150 /* Constructor */: - nodes = container.parameters.concat(container.parent.members); - break; - case 227 /* ClassDeclaration */: - case 197 /* 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 & 28 /* AccessibilityModifier */) { - var constructor = ts.forEach(container.members, function (member) { - return member.kind === 150 /* Constructor */ && member; - }); - if (constructor) { - nodes = nodes.concat(constructor.parameters); - } - } - else if (modifierFlag & 128 /* Abstract */) { - nodes = nodes.concat(container); - } - break; - default: - ts.Debug.fail("Invalid container kind."); + nodes = container.statements; } - ts.forEach(nodes, function (node) { - if (ts.getModifierFlags(node) & modifierFlag) { - ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); - } - }); - return ts.map(keywords, getHighlightSpanForNode); - function getFlagFromModifier(modifier) { - switch (modifier) { - case 113 /* PublicKeyword */: - return 4 /* Public */; - case 111 /* PrivateKeyword */: - return 8 /* Private */; - case 112 /* ProtectedKeyword */: - return 16 /* Protected */; - case 114 /* StaticKeyword */: - return 32 /* Static */; - case 83 /* ExportKeyword */: - return 1 /* Export */; - case 123 /* DeclareKeyword */: - return 2 /* Ambient */; - case 116 /* AbstractKeyword */: - return 128 /* Abstract */; - default: - ts.Debug.fail(); + break; + case 151 /* Constructor */: + nodes = container.parameters.concat(container.parent.members); + break; + case 228 /* ClassDeclaration */: + case 198 /* 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 & 28 /* AccessibilityModifier */) { + var constructor = ts.forEach(container.members, function (member) { + return member.kind === 151 /* Constructor */ && member; + }); + if (constructor) { + nodes = nodes.concat(constructor.parameters); } } - } - function pushKeywordIf(keywordList, token) { - var expected = []; - for (var _i = 2; _i < arguments.length; _i++) { - expected[_i - 2] = arguments[_i]; - } - if (token && ts.contains(expected, token.kind)) { - keywordList.push(token); - return true; + else if (modifierFlag & 128 /* Abstract */) { + nodes = nodes.concat(container); } - return false; + break; + default: + ts.Debug.fail("Invalid container kind."); + } + ts.forEach(nodes, function (node) { + if (ts.getModifierFlags(node) & modifierFlag) { + ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); } - function getGetAndSetOccurrences(accessorDeclaration) { - var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 151 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 152 /* 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, 124 /* GetKeyword */, 133 /* SetKeyword */); }); - } - } + }); + return keywords; + function getFlagFromModifier(modifier) { + switch (modifier) { + case 113 /* PublicKeyword */: + return 4 /* Public */; + case 111 /* PrivateKeyword */: + return 8 /* Private */; + case 112 /* ProtectedKeyword */: + return 16 /* Protected */; + case 114 /* StaticKeyword */: + return 32 /* Static */; + case 83 /* ExportKeyword */: + return 1 /* Export */; + case 123 /* DeclareKeyword */: + return 2 /* Ambient */; + case 116 /* AbstractKeyword */: + return 128 /* Abstract */; + default: + ts.Debug.fail(); } - function getConstructorOccurrences(constructorDeclaration) { - var declarations = constructorDeclaration.symbol.getDeclarations(); - var keywords = []; - ts.forEach(declarations, function (declaration) { - ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 122 /* ConstructorKeyword */); - }); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getLoopBreakContinueOccurrences(loopNode) { - var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87 /* ForKeyword */, 105 /* WhileKeyword */, 80 /* DoKeyword */)) { - // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 210 /* DoStatement */) { - var loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) { - break; - } - } - } - } - var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */, 76 /* ContinueKeyword */); - } - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { - var owner = getBreakOrContinueOwner(breakOrContinueStatement); - if (owner) { - switch (owner.kind) { - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - return getLoopBreakContinueOccurrences(owner); - case 219 /* SwitchStatement */: - return getSwitchCaseDefaultOccurrences(owner); + } + } + function pushKeywordIf(keywordList, token) { + var expected = []; + for (var _i = 2; _i < arguments.length; _i++) { + expected[_i - 2] = arguments[_i]; + } + if (token && ts.contains(expected, token.kind)) { + keywordList.push(token); + return true; + } + return false; + } + function getGetAndSetOccurrences(accessorDeclaration) { + var keywords = []; + tryPushAccessorKeyword(accessorDeclaration.symbol, 152 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 153 /* SetAccessor */); + return keywords; + function tryPushAccessorKeyword(accessorSymbol, accessorKind) { + var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); + if (accessor) { + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124 /* GetKeyword */, 134 /* SetKeyword */); }); + } + } + } + function getConstructorOccurrences(constructorDeclaration) { + var declarations = constructorDeclaration.symbol.getDeclarations(); + var keywords = []; + ts.forEach(declarations, function (declaration) { + ts.forEach(declaration.getChildren(), function (token) { + return pushKeywordIf(keywords, token, 122 /* ConstructorKeyword */); + }); + }); + return keywords; + } + function getLoopBreakContinueOccurrences(loopNode) { + var keywords = []; + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87 /* ForKeyword */, 105 /* WhileKeyword */, 80 /* DoKeyword */)) { + // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. + if (loopNode.kind === 211 /* DoStatement */) { + var loopTokens = loopNode.getChildren(); + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) { + break; } } - return undefined; } - function getSwitchCaseDefaultOccurrences(switchStatement) { - var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 97 /* 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(), 72 /* CaseKeyword */, 78 /* DefaultKeyword */); - var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */); - } - }); - }); - return ts.map(keywords, getHighlightSpanForNode); + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */, 76 /* ContinueKeyword */); } - function getTryCatchFinallyOccurrences(tryStatement) { - var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 101 /* TryKeyword */); - if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73 /* CatchKeyword */); - } - if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 86 /* FinallyKeyword */); - } - return ts.map(keywords, getHighlightSpanForNode); + }); + return keywords; + } + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + return getLoopBreakContinueOccurrences(owner); + case 220 /* SwitchStatement */: + return getSwitchCaseDefaultOccurrences(owner); } - function getThrowOccurrences(throwStatement) { - var owner = getThrowStatementOwner(throwStatement); - if (!owner) { - return undefined; + } + return undefined; + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 97 /* 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(), 72 /* CaseKeyword */, 78 /* DefaultKeyword */); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */); } - var keywords = []; - ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* 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(), 95 /* ReturnKeyword */); - }); + }); + }); + return keywords; + } + function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 101 /* TryKeyword */); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73 /* CatchKeyword */); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 86 /* FinallyKeyword */); + } + return keywords; + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* 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(), 95 /* ReturnKeyword */); + }); + } + return keywords; + } + 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, 206 /* Block */))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); + }); + // Include 'throw' statements that do not occur within a try block. + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); + }); + return keywords; + } + function getIfElseOccurrences(ifStatement, sourceFile) { + var keywords = []; + // Traverse upwards through all parent if-statements linked by their else-branches. + while (hasKind(ifStatement.parent, 210 /* 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], 89 /* 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], 81 /* ElseKeyword */)) { + break; } - return ts.map(keywords, getHighlightSpanForNode); } - 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, 205 /* Block */))) { - return undefined; - } - var keywords = []; - ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); - }); - // Include 'throw' statements that do not occur within a try block. - ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* 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, 209 /* 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], 89 /* 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], 81 /* ElseKeyword */)) { - break; - } - } - if (!hasKind(ifStatement.elseStatement, 209 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 210 /* IfStatement */)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + // 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 === 81 /* ElseKeyword */ && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. + var shouldCombindElseAndIf = true; + // Avoid recalculating getStart() by iterating backwards. + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { + shouldCombindElseAndIf = false; break; } - ifStatement = ifStatement.elseStatement; } - var result = []; - // 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 === 81 /* ElseKeyword */ && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. - var shouldCombindElseAndIf = true; - // Avoid recalculating getStart() by iterating backwards. - for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { - if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { - shouldCombindElseAndIf = false; - break; - } - } - if (shouldCombindElseAndIf) { - result.push({ - fileName: fileName, - textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), - kind: ts.HighlightSpanKind.reference - }); - i++; // skip the next keyword - continue; - } - } - // Ordinary case: just highlight the keyword. - result.push(getHighlightSpanForNode(keywords[i])); + if (shouldCombindElseAndIf) { + result.push({ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + kind: ts.HighlightSpanKind.reference + }); + i++; // skip the next keyword + continue; } - return result; } + // Ordinary case: just highlight the keyword. + result.push(getHighlightSpanForNode(keywords[i], sourceFile)); } + return result; } - DocumentHighlights.getDocumentHighlights = getDocumentHighlights; /** * Whether or not a 'node' is preceded by a label of the given string. * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 220 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 221 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -70160,15 +70469,15 @@ var ts; return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); } function getBucketForCompilationSettings(key, createIfMissing) { - var bucket = buckets[key]; + var bucket = buckets.get(key); if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(); + buckets.set(key, bucket = ts.createFileMap()); } return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { - var entries = buckets[name]; + var bucketInfoArray = ts.arrayFrom(buckets.keys()).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { + var entries = buckets.get(name); var sourceFiles = []; entries.forEachValue(function (key, entry) { sourceFiles.push({ @@ -70266,57 +70575,26 @@ var ts; (function (ts) { var FindAllReferences; (function (FindAllReferences) { - function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) { + function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments, isForRename) { var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); - if (node === sourceFile) { - return undefined; - } - switch (node.kind) { - case 8 /* NumericLiteral */: - if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - break; - } - // Fallthrough - case 70 /* Identifier */: - case 98 /* ThisKeyword */: - // case SyntaxKind.SuperKeyword: TODO:GH#9268 - case 122 /* ConstructorKeyword */: - case 9 /* StringLiteral */: - return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, /*implementations*/ false); - } - return undefined; + return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, isForRename); } FindAllReferences.findReferencedSymbols = findReferencedSymbols; - function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) { + function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, isForRename, implementations) { if (!implementations) { - // Labels - if (ts.isLabelName(node)) { - if (ts.isJumpStatementTarget(node)) { - var labelDefinition = ts.getTargetLabel(node.parent, node.text); - // if we have a label definition, look within its statement for references, if not, then - // the label is undefined and we have no results.. - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; - } - else { - // it is a label definition and not a target, search within the parent labeledStatement - return getLabelReferencesInNode(node.parent, node); - } - } - if (ts.isThis(node)) { - return getReferencesForThisKeyword(node, sourceFiles); - } - if (node.kind === 96 /* SuperKeyword */) { - return getReferencesForSuperKeyword(node); + var special = getReferencedSymbolsSpecial(node, sourceFiles, typeChecker, cancellationToken); + if (special) { + return special; } } // `getSymbolAtLocation` normally returns the symbol of the class when given the constructor keyword, // so we have to specify that we want the constructor symbol. var symbol = typeChecker.getSymbolAtLocation(node); - if (!implementations && !symbol && node.kind === 9 /* StringLiteral */) { - return getReferencesForStringLiteral(node, sourceFiles); - } // Could not find a symbol e.g. unknown identifier if (!symbol) { + if (!implementations && node.kind === 9 /* StringLiteral */) { + return getReferencesForStringLiteral(node, sourceFiles, typeChecker, cancellationToken); + } // Can't have references to something that we have no symbol for. return undefined; } @@ -70325,1028 +70603,1118 @@ var ts; if (!declarations || !declarations.length) { return undefined; } - var result; + var _a = followAliases(symbol, node, typeChecker, isForRename), aliasedSymbol = _a.symbol, shorthandModuleSymbol = _a.shorthandModuleSymbol; + symbol = aliasedSymbol; + // Build the set of symbols to search for, initially it has only the current symbol + var searchSymbols = populateSearchSymbolSet(symbol, node, typeChecker, implementations); + if (shorthandModuleSymbol) { + searchSymbols.push(shorthandModuleSymbol); + } // Compute the meaning from the location and the symbol it references var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations); + var result = []; + // Maps from a symbol ID to the ReferencedSymbol entry in 'result'. + var symbolToIndex = []; + var inheritsFromCache = ts.createMap(); // Get the text to search for. // Note: if this is an external module symbol, the name doesn't include quotes. var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); // Try to get the smallest valid scope that we can limit our search to; // otherwise we'll need to search globally (i.e. include each file). var scope = getSymbolScope(symbol); - // Maps from a symbol ID to the ReferencedSymbol entry in 'result'. - var symbolToIndex = []; if (scope) { - result = []; - getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + getRefs(scope, declaredName); } else { - var internedName = getInternedName(symbol, node); - for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { - var sourceFile = sourceFiles_8[_i]; + var isDefault = ts.isExportDefaultSymbol(symbol); + var internedName = isDefault ? symbol.valueDeclaration.localSymbol.name : getInternedName(symbol, node); + for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { + var sourceFile = sourceFiles_7[_i]; cancellationToken.throwIfCancellationRequested(); - var nameTable = ts.getNameTable(sourceFile); - if (nameTable[internedName] !== undefined) { - result = result || []; - getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + var searchName = (isDefault ? getDefaultImportName(symbol, sourceFile, typeChecker) : undefined) || + (sourceFileHasName(sourceFile, internedName) ? declaredName : undefined); + if (searchName !== undefined) { + getRefs(sourceFile, searchName); } } } return result; - function getDefinition(symbol) { - var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node); - var name = ts.map(info.displayParts, function (p) { return p.text; }).join(""); - var declarations = symbol.declarations; - if (!declarations || declarations.length === 0) { - return undefined; + function getRefs(scope, searchName) { + getReferencesInNode(scope, symbol, searchName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex, implementations, typeChecker, cancellationToken, searchSymbols, inheritsFromCache); + } + } + FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; + /** getReferencedSymbols for special node kinds. */ + function getReferencedSymbolsSpecial(node, sourceFiles, typeChecker, cancellationToken) { + if (ts.isTypeKeyword(node.kind)) { + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken); + } + // Labels + if (ts.isLabelName(node)) { + if (ts.isJumpStatementTarget(node)) { + var labelDefinition = ts.getTargetLabel(node.parent, node.text); + // if we have a label definition, look within its statement for references, if not, then + // the label is undefined and we have no results.. + return labelDefinition && getLabelReferencesInNode(labelDefinition.parent, labelDefinition, cancellationToken); + } + else { + // it is a label definition and not a target, search within the parent labeledStatement + return getLabelReferencesInNode(node.parent, node, cancellationToken); } - return { - containerKind: "", - containerName: "", - name: name, - kind: info.symbolKind, - fileName: declarations[0].getSourceFile().fileName, - textSpan: ts.createTextSpan(declarations[0].getStart(), 0), - displayParts: info.displayParts - }; } - function getAliasSymbolForPropertyNameSymbol(symbol, location) { - if (symbol.flags & 8388608 /* Alias */) { - // Default import get alias - var defaultImport = ts.getDeclarationOfKind(symbol, 237 /* ImportClause */); - if (defaultImport) { - return typeChecker.getAliasedSymbol(symbol); - } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 240 /* ImportSpecifier */ || - declaration.kind === 244 /* ExportSpecifier */) ? declaration : undefined; }); - if (importOrExportSpecifier && - // export { a } - (!importOrExportSpecifier.propertyName || - // export {a as class } where a is location - importOrExportSpecifier.propertyName === location)) { - // If Import specifier -> get alias - // else Export specifier -> get local target - return importOrExportSpecifier.kind === 240 /* ImportSpecifier */ ? - typeChecker.getAliasedSymbol(symbol) : - typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); - } + if (ts.isThis(node)) { + return getReferencesForThisKeyword(node, sourceFiles, typeChecker, cancellationToken); + } + if (node.kind === 96 /* SuperKeyword */) { + return getReferencesForSuperKeyword(node, typeChecker, cancellationToken); + } + return undefined; + } + /** + * Follows aliases to get to the original declaration of a symbol. + * For a shorthand ambient module, we don't follow the alias to it, but we will need to add it to the set of search symbols. + */ + function followAliases(symbol, node, typeChecker, isForRename) { + while (true) { + // When renaming a default import, only rename in the current file + if (isForRename && isImportDefaultSymbol(symbol)) { + return { symbol: symbol }; + } + var aliasedSymbol = getAliasSymbolForPropertyNameSymbol(symbol, node, typeChecker); + // Don't follow alias if it goes to unknown symbol. This can happen if it points to an untyped module. + if (!aliasedSymbol || !aliasedSymbol.declarations) { + return { symbol: symbol }; } + if (ts.isShorthandAmbientModuleSymbol(aliasedSymbol)) { + return { symbol: symbol, shorthandModuleSymbol: aliasedSymbol }; + } + symbol = aliasedSymbol; + } + } + function sourceFileHasName(sourceFile, name) { + return ts.getNameTable(sourceFile).get(name) !== undefined; + } + /** + * Given a symbol, see if any of the imports in a source file reference it. + * Only call this if `symbol` is a default export. + */ + function getDefaultImportName(symbol, sourceFile, checker) { + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var importSpecifier = _a[_i]; + var importDecl = importSpecifier.parent; + ts.Debug.assert(importDecl.moduleSpecifier === importSpecifier); + var defaultName = importDecl.importClause.name; + var defaultReferencedSymbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(defaultName)); + if (symbol === defaultReferencedSymbol) { + return defaultName.text; + } + } + return undefined; + } + function getDefinition(symbol, node, typeChecker) { + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node), displayParts = _a.displayParts, symbolKind = _a.symbolKind; + var name = displayParts.map(function (p) { return p.text; }).join(""); + var declarations = symbol.declarations; + if (!declarations || declarations.length === 0) { + return undefined; + } + return { + containerKind: "", + containerName: "", + name: name, + kind: symbolKind, + fileName: declarations[0].getSourceFile().fileName, + textSpan: ts.createTextSpan(declarations[0].getStart(), 0), + displayParts: displayParts + }; + } + function getAliasSymbolForPropertyNameSymbol(symbol, location, typeChecker) { + if (!(symbol.flags & 8388608 /* Alias */)) { return undefined; } - function followAliasIfNecessary(symbol, location) { - return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol; + // Default import get alias + var defaultImport = ts.getDeclarationOfKind(symbol, 238 /* ImportClause */); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); + } + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 241 /* ImportSpecifier */ || + declaration.kind === 245 /* ExportSpecifier */) ? declaration : undefined; }); + if (importOrExportSpecifier && + // export { a } + (!importOrExportSpecifier.propertyName || + // export {a as class } where a is location + importOrExportSpecifier.propertyName === location)) { + // If Import specifier -> get alias + // else Export specifier -> get local target + return importOrExportSpecifier.kind === 241 /* ImportSpecifier */ ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + } + } + function followAliasIfNecessary(symbol, location, typeChecker) { + return getAliasSymbolForPropertyNameSymbol(symbol, location, typeChecker) || symbol; + } + function getPropertySymbolOfDestructuringAssignment(location, typeChecker) { + return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + function isObjectBindingPatternElementWithoutPropertyName(symbol) { + var bindingElement = ts.getDeclarationOfKind(symbol, 175 /* BindingElement */); + return bindingElement && + bindingElement.parent.kind === 173 /* ObjectBindingPattern */ && + !bindingElement.propertyName; + } + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, typeChecker) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + var bindingElement = ts.getDeclarationOfKind(symbol, 175 /* BindingElement */); + var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); } - function getPropertySymbolOfDestructuringAssignment(location) { - return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && - typeChecker.getPropertySymbolOfDestructuringAssignment(location); + return undefined; + } + function getInternedName(symbol, location) { + // If this is an export or import specifier it could have been renamed using the 'as' syntax. + // If so we want to search for whatever under the cursor. + if (ts.isImportOrExportSpecifierName(location)) { + return location.text; } - function isObjectBindingPatternElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */); - return bindingElement && - bindingElement.parent.kind === 172 /* ObjectBindingPattern */ && - !bindingElement.propertyName; + return ts.stripQuotes(symbol.name); + } + /** + * Determines the smallest scope in which a symbol may have named references. + * Note that not every construct has been accounted for. This function can + * probably be improved. + * + * @returns undefined if the scope cannot be determined, implying that + * a reference to a symbol can occur anywhere. + */ + function getSymbolScope(symbol) { + // 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 === 185 /* FunctionExpression */ || valueDeclaration.kind === 198 /* ClassExpression */)) { + return valueDeclaration; } - function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */); - var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); - return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + // 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 (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; }); + if (privateDeclaration) { + return ts.getAncestor(privateDeclaration, 228 /* ClassDeclaration */); } + } + // If the symbol is an import we would like to find it if we are looking for what it imports. + // So consider it visible outside its declaration scope. + if (symbol.flags & 8388608 /* Alias */) { return undefined; } - function getInternedName(symbol, location) { - // If this is an export or import specifier it could have been renamed using the 'as' syntax. - // If so we want to search for whatever under the cursor. - if (ts.isImportOrExportSpecifierName(location)) { - return location.getText(); - } - // Try to get the local symbol if we're dealing with an 'export default' - // since that symbol has the "true" name. - var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - symbol = localExportDefaultSymbol || symbol; - return ts.stripQuotes(symbol.name); + // If symbol is of object binding pattern element without property name we would want to + // look for property too and that could be anywhere + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + return undefined; } - /** - * Determines the smallest scope in which a symbol may have named references. - * Note that not every construct has been accounted for. This function can - * probably be improved. - * - * @returns undefined if the scope cannot be determined, implying that - * a reference to a symbol can occur anywhere. - */ - function getSymbolScope(symbol) { - // 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 === 184 /* FunctionExpression */ || valueDeclaration.kind === 197 /* 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 (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; }); - if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 227 /* ClassDeclaration */); + // if this symbol is visible from its parent container, e.g. exported, then bail out + // if symbol correspond to the union property - bail out + if (symbol.parent || (symbol.flags & 268435456 /* SyntheticProperty */)) { + return undefined; + } + var scope; + var declarations = symbol.getDeclarations(); + if (declarations) { + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + var container = ts.getContainerNode(declaration); + if (!container) { + return undefined; } + if (scope && scope !== container) { + // Different declarations have different containers, bail out + return undefined; + } + if (container.kind === 263 /* 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; + } + // The search scope is the container node + scope = container; } - // If the symbol is an import we would like to find it if we are looking for what it imports. - // So consider it visible outside its declaration scope. - if (symbol.flags & 8388608 /* Alias */) { - return undefined; - } - // If symbol is of object binding pattern element without property name we would want to - // look for property too and that could be anywhere - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - return undefined; + } + return scope; + } + function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end, cancellationToken) { + var positions = []; + /// TODO: Cache symbol existence for files to save text search + // Also, need to make this work for unicode escapes. + // Be resilient in the face of a symbol with no name or zero length name + if (!symbolName || !symbolName.length) { + return positions; + } + var text = sourceFile.text; + var sourceLength = text.length; + var symbolNameLength = symbolName.length; + var position = text.indexOf(symbolName, start); + while (position >= 0) { + cancellationToken.throwIfCancellationRequested(); + // If 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 + // before and after it have to be a non-identifier char). + var endPosition = position + symbolNameLength; + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5 /* Latest */)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5 /* Latest */))) { + // Found a real match. Keep searching. + positions.push(position); + } + position = text.indexOf(symbolName, position + symbolNameLength + 1); + } + return positions; + } + function getLabelReferencesInNode(container, targetLabel, cancellationToken) { + var references = []; + var sourceFile = container.getSourceFile(); + var labelName = targetLabel.text; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd(), cancellationToken); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.getWidth() !== labelName.length) { + return; } - // if this symbol is visible from its parent container, e.g. exported, then bail out - // if symbol correspond to the union property - bail out - if (symbol.parent || (symbol.flags & 268435456 /* SyntheticProperty */)) { - return undefined; + // Only pick labels that are either the target label, or have a target that is the target label + if (node === targetLabel || + (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { + references.push(getReferenceEntryFromNode(node)); } - var scope; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; - var container = ts.getContainerNode(declaration); - if (!container) { - return undefined; - } - if (scope && scope !== container) { - // Different declarations have different containers, bail out - return undefined; - } - if (container.kind === 262 /* 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; - } - // The search scope is the container node - scope = container; - } + }); + var definition = { + containerKind: "", + containerName: "", + fileName: targetLabel.getSourceFile().fileName, + kind: ts.ScriptElementKind.label, + name: labelName, + textSpan: ts.createTextSpanFromNode(targetLabel, sourceFile), + displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] + }; + return [{ definition: definition, references: references }]; + } + function isValidReferencePosition(node, searchSymbolName) { + // Compare the length so we filter out strict superstrings of the symbol we are looking for + switch (node && node.kind) { + case 70 /* Identifier */: + return node.getWidth() === searchSymbolName.length; + case 9 /* StringLiteral */: + return (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) && + // For string literals we have two additional chars for the quotes + node.getWidth() === searchSymbolName.length + 2; + case 8 /* NumericLiteral */: + return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.getWidth() === searchSymbolName.length; + default: + return false; + } + } + function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) { + var name = ts.tokenToString(keywordKind); + var definition = { + containerKind: "", + containerName: "", + fileName: "", + kind: ts.ScriptElementKind.keyword, + name: name, + textSpan: ts.createTextSpan(0, 1), + displayParts: [{ text: name, kind: ts.ScriptElementKind.keyword }] + }; + var references = []; + for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { + var sourceFile = sourceFiles_8[_i]; + cancellationToken.throwIfCancellationRequested(); + addReferencesForKeywordInFile(sourceFile, keywordKind, name, cancellationToken, references); + } + return [{ definition: definition, references: references }]; + } + function addReferencesForKeywordInFile(sourceFile, kind, searchText, cancellationToken, references) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; + cancellationToken.throwIfCancellationRequested(); + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (referenceLocation.kind === kind) { + references.push({ + textSpan: ts.createTextSpanFromNode(referenceLocation), + fileName: sourceFile.fileName, + isWriteAccess: false, + isDefinition: false, + }); } - return scope; } - function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { - var positions = []; - /// TODO: Cache symbol existence for files to save text search - // Also, need to make this work for unicode escapes. - // Be resilient in the face of a symbol with no name or zero length name - if (!symbolName || !symbolName.length) { - return positions; - } - var text = sourceFile.text; - var sourceLength = text.length; - var symbolNameLength = symbolName.length; - var position = text.indexOf(symbolName, start); - while (position >= 0) { - cancellationToken.throwIfCancellationRequested(); - // If 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 - // before and after it have to be a non-identifier char). - var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5 /* Latest */)) && - (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5 /* Latest */))) { - // Found a real match. Keep searching. - positions.push(position); + } + /** 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 + */ + function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex, implementations, typeChecker, cancellationToken, searchSymbols, inheritsFromCache) { + var sourceFile = container.getSourceFile(); + var start = findInComments ? container.getFullStart() : container.getStart(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd(), cancellationToken); + var parents = getParentSymbolsOfPropertyAccess(); + for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) { + var position = possiblePositions_2[_i]; + 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 + // match in a comment or string if that's what the caller is asking + // for. + if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || + (findInComments && ts.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 + // 'FindReferences' will just filter out these results. + result.push({ + definition: undefined, + references: [{ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpan(position, searchText.length), + isWriteAccess: false, + isDefinition: false + }] + }); } - position = text.indexOf(symbolName, position + symbolNameLength + 1); + continue; } - return positions; - } - function getLabelReferencesInNode(container, targetLabel) { - var references = []; - var sourceFile = container.getSourceFile(); - var labelName = targetLabel.text; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.getWidth() !== labelName.length) { - return; + if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { + continue; + } + var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); + if (referenceSymbol) { + var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; + var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); + var relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, + /*searchLocationIsConstructor*/ searchLocation.kind === 122 /* ConstructorKeyword */, parents, inheritsFromCache, typeChecker); + if (relatedSymbol) { + addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); } - // Only pick labels that are either the target label, or have a target that is the target label - if (node === targetLabel || - (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { - references.push(getReferenceEntryFromNode(node)); + else if (!(referenceSymbol.flags & 67108864 /* Transient */) && ts.contains(searchSymbols, shorthandValueSymbol)) { + addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); } - }); - var definition = { - containerKind: "", - containerName: "", - fileName: targetLabel.getSourceFile().fileName, - kind: ts.ScriptElementKind.label, - name: labelName, - textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()), - displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] - }; - return [{ definition: definition, references: references }]; - } - function isValidReferencePosition(node, searchSymbolName) { - if (node) { - // Compare the length so we filter out strict superstrings of the symbol we are looking for - switch (node.kind) { - case 70 /* Identifier */: - return node.getWidth() === searchSymbolName.length; - case 9 /* StringLiteral */: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - // For string literals we have two additional chars for the quotes - return node.getWidth() === searchSymbolName.length + 2; - } - break; - case 8 /* NumericLiteral */: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - return node.getWidth() === searchSymbolName.length; - } - break; + else if (searchLocation.kind === 122 /* ConstructorKeyword */) { + findAdditionalConstructorReferences(referenceSymbol, referenceLocation); } } - return false; } - /** 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 - */ - function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) { - var sourceFile = container.getSourceFile(); - var start = findInComments ? container.getFullStart() : container.getStart(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd()); - var parents = getParentSymbolsOfPropertyAccess(); - var inheritsFromCache = ts.createMap(); - if (possiblePositions.length) { - // Build the set of symbols to search for, initially it has only the current symbol - var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation); - ts.forEach(possiblePositions, function (position) { - 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 - // match in a comment or string if that's what the caller is asking - // for. - if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || - (findInComments && ts.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 - // 'FindReferences' will just filter out these results. - result.push({ - definition: undefined, - references: [{ - fileName: sourceFile.fileName, - textSpan: ts.createTextSpan(position, searchText.length), - isWriteAccess: false, - isDefinition: false - }] - }); - } - return; - } - if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { - return; - } - var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); - if (referenceSymbol) { - var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); - var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, - /*searchLocationIsConstructor*/ searchLocation.kind === 122 /* ConstructorKeyword */, parents, inheritsFromCache); - if (relatedSymbol) { - addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); - } - else if (!(referenceSymbol.flags & 67108864 /* Transient */) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { - addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); - } - else if (searchLocation.kind === 122 /* ConstructorKeyword */) { - findAdditionalConstructorReferences(referenceSymbol, referenceLocation); + return; + /* If we are just looking for implementations and this is a property access expression, we need to get the + * symbol of the local type of the symbol the property is being accessed on. This is because our search + * symbol may have a different parent symbol if the local type's symbol does not declare the property + * being accessed (i.e. it is declared in some parent class or interface) + */ + function getParentSymbolsOfPropertyAccess() { + if (implementations) { + var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); + if (propertyAccessExpression) { + var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); + if (localParentType) { + if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== searchSymbol.parent) { + return [localParentType.symbol]; } - } - }); - } - return; - /* If we are just looking for implementations and this is a property access expression, we need to get the - * symbol of the local type of the symbol the property is being accessed on. This is because our search - * symbol may have a different parent symbol if the local type's symbol does not declare the property - * being accessed (i.e. it is declared in some parent class or interface) - */ - function getParentSymbolsOfPropertyAccess() { - if (implementations) { - var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); - if (propertyAccessExpression) { - var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); - if (localParentType) { - if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== searchSymbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 196608 /* UnionOrIntersection */) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } + else if (localParentType.flags & 196608 /* UnionOrIntersection */) { + return getSymbolsForClassAndInterfaceComponents(localParentType); } } } } - function getPropertyAccessExpressionFromRightHandSide(node) { - return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */ + function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { + ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); + var referenceClass = referenceLocation.parent; + if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { + ts.Debug.assert(referenceClass.name === referenceLocation); + // This is the class declaration containing the constructor. + addReferences(findOwnConstructorCalls(searchSymbol, sourceFile)); } - /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */ - function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { - ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); - var referenceClass = referenceLocation.parent; - if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { - ts.Debug.assert(referenceClass.name === referenceLocation); - // This is the class declaration containing the constructor. - addReferences(findOwnConstructorCalls(searchSymbol)); - } - else { - // If this class appears in `extends C`, then the extending class' "super" calls are references. - var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); - if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) { - addReferences(superConstructorAccesses(classExtending)); - } + else { + // If this class appears in `extends C`, then the extending class' "super" calls are references. + var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); + if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation, typeChecker) === searchSymbol) { + addReferences(superConstructorAccesses(classExtending)); } } - function addReferences(references) { - if (references.length) { - var referencedSymbol = getReferencedSymbol(searchSymbol); - ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); - } + } + function addReferences(references) { + if (references.length) { + var referencedSymbol = getReferencedSymbol(searchSymbol); + ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); } - /** `classSymbol` is the class where the constructor was defined. - * Reference the constructor and all calls to `new this()`. - */ - function findOwnConstructorCalls(classSymbol) { - var result = []; - for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150 /* Constructor */); - var ctrKeyword = decl.getChildAt(0); - ts.Debug.assert(ctrKeyword.kind === 122 /* ConstructorKeyword */); - result.push(ctrKeyword); - } - ts.forEachProperty(classSymbol.exports, function (member) { - var decl = member.valueDeclaration; - if (decl && decl.kind === 149 /* MethodDeclaration */) { - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) { - if (ts.isNewExpressionTarget(thisKeyword)) { - result.push(thisKeyword); - } - }); - } - } + } + function getReferencedSymbol(symbol) { + var symbolId = ts.getSymbolId(symbol); + var index = symbolToIndex[symbolId]; + if (index === undefined) { + index = result.length; + symbolToIndex[symbolId] = index; + result.push({ + definition: getDefinition(symbol, searchLocation, typeChecker), + references: [] }); - return result; } - /** Find references to `super` in the constructor of an extending class. */ - function superConstructorAccesses(cls) { - var symbol = cls.symbol; - var ctr = symbol.members["__constructor"]; - if (!ctr) { - return []; - } - var result = []; - for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150 /* Constructor */); - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) { - if (ts.isCallExpressionTarget(node)) { - result.push(node); - } - }); - } - } - ; - return result; + return result[index]; + } + function addReferenceToRelatedSymbol(node, relatedSymbol) { + var references = getReferencedSymbol(relatedSymbol).references; + if (implementations) { + getImplementationReferenceEntryForNode(node, references, typeChecker); } - function getReferencedSymbol(symbol) { - var symbolId = ts.getSymbolId(symbol); - var index = symbolToIndex[symbolId]; - if (index === undefined) { - index = result.length; - symbolToIndex[symbolId] = index; - result.push({ - definition: getDefinition(symbol), - references: [] + else { + references.push(getReferenceEntryFromNode(node)); + } + } + } + function getPropertyAccessExpressionFromRightHandSide(node) { + return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + /** `classSymbol` is the class where the constructor was defined. + * Reference the constructor and all calls to `new this()`. + */ + function findOwnConstructorCalls(classSymbol, sourceFile) { + var result = []; + for (var _i = 0, _a = classSymbol.members.get("__constructor").declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var ctrKeyword = ts.findChildOfKind(decl, 122 /* ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 151 /* Constructor */ && !!ctrKeyword); + result.push(ctrKeyword); + } + classSymbol.exports.forEach(function (member) { + var decl = member.valueDeclaration; + if (decl && decl.kind === 150 /* MethodDeclaration */) { + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) { + if (ts.isNewExpressionTarget(thisKeyword)) { + result.push(thisKeyword); + } }); } - return result[index]; } - function addReferenceToRelatedSymbol(node, relatedSymbol) { - var references = getReferencedSymbol(relatedSymbol).references; - if (implementations) { - getImplementationReferenceEntryForNode(node, references); - } - else { - references.push(getReferenceEntryFromNode(node)); - } + }); + return result; + } + /** Find references to `super` in the constructor of an extending class. */ + function superConstructorAccesses(cls) { + var symbol = cls.symbol; + var ctr = symbol.members.get("__constructor"); + if (!ctr) { + return []; + } + var result = []; + for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts.Debug.assert(decl.kind === 151 /* Constructor */); + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) { + if (ts.isCallExpressionTarget(node)) { + result.push(node); + } + }); } } - function getImplementationReferenceEntryForNode(refNode, result) { - // Check if we found a function/propertyAssignment/method with an implementation or initializer - if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { - result.push(getReferenceEntryFromNode(refNode.parent)); + ; + return result; + } + function getImplementationReferenceEntryForNode(refNode, result, typeChecker) { + // Check if we found a function/propertyAssignment/method with an implementation or initializer + if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { + result.push(getReferenceEntryFromNode(refNode.parent)); + } + else if (refNode.kind === 70 /* Identifier */) { + if (refNode.parent.kind === 260 /* ShorthandPropertyAssignment */) { + // Go ahead and dereference the shorthand assignment by going to its definition + getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); } - else if (refNode.kind === 70 /* Identifier */) { - if (refNode.parent.kind === 259 /* ShorthandPropertyAssignment */) { - // Go ahead and dereference the shorthand assignment by going to its definition - getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); - } - // Check if the node is within an extends or implements clause - var containingClass = getContainingClassIfInHeritageClause(refNode); - if (containingClass) { - result.push(getReferenceEntryFromNode(containingClass)); - return; - } - // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface - var containingTypeReference = getContainingTypeReference(refNode); - if (containingTypeReference) { - var parent_19 = containingTypeReference.parent; - if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); - } - else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { - if (parent_19.body.kind === 205 /* Block */) { - ts.forEachReturnStatement(parent_19.body, function (returnStatement) { - if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { - maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); - } - }); - } - else if (isImplementationExpression(parent_19.body)) { - maybeAdd(getReferenceEntryFromNode(parent_19.body)); - } + // Check if the node is within an extends or implements clause + var containingClass = getContainingClassIfInHeritageClause(refNode); + if (containingClass) { + result.push(getReferenceEntryFromNode(containingClass)); + return; + } + // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface + var containingTypeReference = getContainingTypeReference(refNode); + if (containingTypeReference) { + var parent = containingTypeReference.parent; + if (ts.isVariableLike(parent) && parent.type === containingTypeReference && parent.initializer && isImplementationExpression(parent.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent.initializer)); + } + else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { + if (parent.body.kind === 206 /* Block */) { + ts.forEachReturnStatement(parent.body, function (returnStatement) { + if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { + maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); + } + }); } - else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_19.expression)); + else if (isImplementationExpression(parent.body)) { + maybeAdd(getReferenceEntryFromNode(parent.body)); } } - } - // Type nodes can contain multiple references to the same type. For example: - // let x: Foo & (Foo & Bar) = ... - // Because we are returning the implementation locations and not the identifier locations, - // duplicate entries would be returned here as each of the type references is part of - // the same implementation. For that reason, check before we add a new entry - function maybeAdd(a) { - if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { - result.push(a); + else if (ts.isAssertionExpression(parent) && isImplementationExpression(parent.expression)) { + maybeAdd(getReferenceEntryFromNode(parent.expression)); } } } - function getSymbolsForClassAndInterfaceComponents(type, result) { - if (result === void 0) { result = []; } - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var componentType = _a[_i]; - if (componentType.symbol && componentType.symbol.getFlags() & (32 /* Class */ | 64 /* Interface */)) { - result.push(componentType.symbol); - } - if (componentType.getFlags() & 196608 /* UnionOrIntersection */) { - getSymbolsForClassAndInterfaceComponents(componentType, result); - } + // Type nodes can contain multiple references to the same type. For example: + // let x: Foo & (Foo & Bar) = ... + // Because we are returning the implementation locations and not the identifier locations, + // duplicate entries would be returned here as each of the type references is part of + // the same implementation. For that reason, check before we add a new entry + function maybeAdd(a) { + if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { + result.push(a); } - return result; } - function getContainingTypeReference(node) { - var topLevelTypeReference = undefined; - while (node) { - if (ts.isTypeNode(node)) { - topLevelTypeReference = node; - } - node = node.parent; + } + function getSymbolsForClassAndInterfaceComponents(type, result) { + if (result === void 0) { result = []; } + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var componentType = _a[_i]; + if (componentType.symbol && componentType.symbol.getFlags() & (32 /* Class */ | 64 /* Interface */)) { + result.push(componentType.symbol); + } + if (componentType.getFlags() & 196608 /* UnionOrIntersection */) { + getSymbolsForClassAndInterfaceComponents(componentType, result); } - return topLevelTypeReference; } - function getContainingClassIfInHeritageClause(node) { - if (node && node.parent) { - if (node.kind === 199 /* ExpressionWithTypeArguments */ - && node.parent.kind === 256 /* HeritageClause */ - && ts.isClassLike(node.parent.parent)) { - return node.parent.parent; - } - else if (node.kind === 70 /* Identifier */ || node.kind === 177 /* PropertyAccessExpression */) { - return getContainingClassIfInHeritageClause(node.parent); - } + return result; + } + function getContainingTypeReference(node) { + var topLevelTypeReference = undefined; + while (node) { + if (ts.isTypeNode(node)) { + topLevelTypeReference = node; } - return undefined; + node = node.parent; } - /** - * Returns true if this is an expression that can be considered an implementation - */ - function isImplementationExpression(node) { - // Unwrap parentheses - if (node.kind === 183 /* ParenthesizedExpression */) { - return isImplementationExpression(node.expression); + return topLevelTypeReference; + } + function getContainingClassIfInHeritageClause(node) { + if (node && node.parent) { + if (node.kind === 200 /* ExpressionWithTypeArguments */ + && node.parent.kind === 257 /* HeritageClause */ + && ts.isClassLike(node.parent.parent)) { + return node.parent.parent; + } + else if (node.kind === 70 /* Identifier */ || node.kind === 178 /* PropertyAccessExpression */) { + return getContainingClassIfInHeritageClause(node.parent); } - return node.kind === 185 /* ArrowFunction */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 176 /* ObjectLiteralExpression */ || - node.kind === 197 /* ClassExpression */ || - node.kind === 175 /* ArrayLiteralExpression */; } - /** - * Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol - * is an interface, determines if some ancestor of the child symbol extends or inherits from it. - * Also takes in a cache of previous results which makes this slightly more efficient and is - * necessary to avoid potential loops like so: - * class A extends B { } - * class B extends A { } - * - * We traverse the AST rather than using the type checker because users are typically only interested - * in explicit implementations of an interface/class when calling "Go to Implementation". Sibling - * implementations of types that share a common ancestor with the type whose implementation we are - * searching for need to be filtered out of the results. The type checker doesn't let us make the - * distinction between structurally compatible implementations and explicit implementations, so we - * must use the AST. - * - * @param child A class or interface Symbol - * @param parent Another class or interface Symbol - * @param cachedResults A map of symbol id pairs (i.e. "child,parent") to booleans indicating previous results - */ - function explicitlyInheritsFrom(child, parent, cachedResults) { - var parentIsInterface = parent.getFlags() & 64 /* Interface */; - return searchHierarchy(child); - function searchHierarchy(symbol) { - if (symbol === parent) { - return true; - } - var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); - if (key in cachedResults) { - return cachedResults[key]; - } - // Set the key so that we don't infinitely recurse - cachedResults[key] = false; - var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { - if (ts.isClassLike(declaration)) { - if (parentIsInterface) { - var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration); - if (interfaceReferences) { - for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) { - var typeReference = interfaceReferences_1[_i]; - if (searchTypeReference(typeReference)) { - return true; - } + return undefined; + } + /** + * Returns true if this is an expression that can be considered an implementation + */ + function isImplementationExpression(node) { + switch (node.kind) { + case 184 /* ParenthesizedExpression */: + return isImplementationExpression(node.expression); + case 186 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 177 /* ObjectLiteralExpression */: + case 198 /* ClassExpression */: + case 176 /* ArrayLiteralExpression */: + return true; + default: + return false; + } + } + /** + * Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol + * is an interface, determines if some ancestor of the child symbol extends or inherits from it. + * Also takes in a cache of previous results which makes this slightly more efficient and is + * necessary to avoid potential loops like so: + * class A extends B { } + * class B extends A { } + * + * We traverse the AST rather than using the type checker because users are typically only interested + * in explicit implementations of an interface/class when calling "Go to Implementation". Sibling + * implementations of types that share a common ancestor with the type whose implementation we are + * searching for need to be filtered out of the results. The type checker doesn't let us make the + * distinction between structurally compatible implementations and explicit implementations, so we + * must use the AST. + * + * @param child A class or interface Symbol + * @param parent Another class or interface Symbol + * @param cachedResults A map of symbol id pairs (i.e. "child,parent") to booleans indicating previous results + */ + function explicitlyInheritsFrom(child, parent, cachedResults, typeChecker) { + var parentIsInterface = parent.getFlags() & 64 /* Interface */; + return searchHierarchy(child); + function searchHierarchy(symbol) { + if (symbol === parent) { + return true; + } + var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); + var cached = cachedResults.get(key); + if (cached !== undefined) { + return cached; + } + // Set the key so that we don't infinitely recurse + cachedResults.set(key, false); + var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { + if (ts.isClassLike(declaration)) { + if (parentIsInterface) { + var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration); + if (interfaceReferences) { + for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) { + var typeReference = interfaceReferences_1[_i]; + if (searchTypeReference(typeReference)) { + return true; } } } - return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); } - else if (declaration.kind === 228 /* InterfaceDeclaration */) { - if (parentIsInterface) { - return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); - } - } - return false; - }); - cachedResults[key] = inherits; - return inherits; - } - function searchTypeReference(typeReference) { - if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); - if (type && type.symbol) { - return searchHierarchy(type.symbol); + return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + } + else if (declaration.kind === 229 /* InterfaceDeclaration */) { + if (parentIsInterface) { + return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } } return false; + }); + cachedResults.set(key, inherits); + return inherits; + } + function searchTypeReference(typeReference) { + if (typeReference) { + var type = typeChecker.getTypeAtLocation(typeReference); + if (type && type.symbol) { + return searchHierarchy(type.symbol); + } } + return false; + } + } + function getReferencesForSuperKeyword(superKeyword, typeChecker, cancellationToken) { + var searchSpaceNode = ts.getSuperContainer(superKeyword, /*stopOnFunctions*/ false); + if (!searchSpaceNode) { + return undefined; } - function getReferencesForSuperKeyword(superKeyword) { - var searchSpaceNode = ts.getSuperContainer(superKeyword, /*stopOnFunctions*/ false); - if (!searchSpaceNode) { + // Whether 'super' occurs in a static context within a class. + var staticFlag = 32 /* Static */; + switch (searchSpaceNode.kind) { + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + staticFlag &= ts.getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class + break; + default: return undefined; + } + var references = []; + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd(), cancellationToken); + for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) { + var position = possiblePositions_3[_i]; + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 96 /* SuperKeyword */) { + continue; } - // Whether 'super' occurs in a static context within a class. - var staticFlag = 32 /* Static */; - switch (searchSpaceNode.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - staticFlag &= ts.getModifierFlags(searchSpaceNode); - searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class + var container = ts.getSuperContainer(node, /*stopOnFunctions*/ 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. + if (container && (32 /* Static */ & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + references.push(getReferenceEntryFromNode(node)); + } + } + var definition = getDefinition(searchSpaceNode.symbol, superKeyword, typeChecker); + return [{ definition: definition, references: references }]; + } + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, typeChecker, cancellationToken) { + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); + // Whether 'this' occurs in a static context within a class. + var staticFlag = 32 /* Static */; + switch (searchSpaceNode.kind) { + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; - default: + } + // fall through + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + staticFlag &= ts.getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class + break; + case 263 /* SourceFile */: + if (ts.isExternalModule(searchSpaceNode)) { return undefined; - } - var references = []; + } + // Fall through + case 227 /* FunctionDeclaration */: + case 185 /* 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. + default: + return undefined; + } + var references = []; + var possiblePositions; + if (searchSpaceNode.kind === 263 /* SourceFile */) { + ts.forEach(sourceFiles, function (sourceFile) { + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); + }); + } + else { var sourceFile = searchSpaceNode.getSourceFile(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd(), cancellationToken); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); + } + var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); + var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: thisOrSuperKeyword.getSourceFile().fileName, + kind: ts.ScriptElementKind.variableElement, + name: "this", + textSpan: ts.createTextSpanFromNode(thisOrSuperKeyword), + displayParts: displayParts + }, + references: references + }]; + function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 96 /* SuperKeyword */) { + if (!node || !ts.isThis(node)) { return; } - var container = ts.getSuperContainer(node, /*stopOnFunctions*/ 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. - if (container && (32 /* Static */ & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - references.push(getReferenceEntryFromNode(node)); + var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); + switch (searchSpaceNode.kind) { + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + if (searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 198 /* ClassExpression */: + case 228 /* 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 && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 263 /* SourceFile */: + if (container.kind === 263 /* SourceFile */ && !ts.isExternalModule(container)) { + result.push(getReferenceEntryFromNode(node)); + } + break; } }); - var definition = getDefinition(searchSpaceNode.symbol); - return [{ definition: definition, references: references }]; - } - function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { - var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); - // Whether 'this' occurs in a static context within a class. - var staticFlag = 32 /* Static */; - switch (searchSpaceNode.kind) { - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - if (ts.isObjectLiteralMethod(searchSpaceNode)) { - break; - } - // fall through - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - staticFlag &= ts.getModifierFlags(searchSpaceNode); - searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class - break; - case 262 /* SourceFile */: - if (ts.isExternalModule(searchSpaceNode)) { - return undefined; - } - // Fall through - case 226 /* FunctionDeclaration */: - case 184 /* 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. - default: - return undefined; - } - var references = []; - var possiblePositions; - if (searchSpaceNode.kind === 262 /* SourceFile */) { - ts.forEach(sourceFiles, function (sourceFile) { - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); - getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); - }); - } - else { - var sourceFile = searchSpaceNode.getSourceFile(); - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); + } + } + function getReferencesForStringLiteral(node, sourceFiles, typeChecker, cancellationToken) { + var type = ts.getStringLiteralTypeForNode(node, typeChecker); + if (!type) { + // nothing to do here. moving on + return undefined; + } + var references = []; + for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { + var sourceFile = sourceFiles_9[_i]; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ts.ScriptElementKind.variableElement, + name: type.text, + textSpan: ts.createTextSpanFromNode(node), + displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] + }, + references: references + }]; + function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { + for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { + var position = possiblePositions_4[_i]; + cancellationToken.throwIfCancellationRequested(); + var node_2 = ts.getTouchingWord(sourceFile, position); + if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { + return; + } + var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + if (type_2 === searchType) { + references.push(getReferenceEntryFromNode(node_2)); + } } - var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); - var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: "this", - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: displayParts - }, - references: references - }]; - function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || !ts.isThis(node)) { - return; - } - var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); - switch (searchSpaceNode.kind) { - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 197 /* ClassExpression */: - case 227 /* 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 && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 262 /* SourceFile */: - if (container.kind === 262 /* SourceFile */ && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); - } - break; - } - }); + } + } + function populateSearchSymbolSet(symbol, location, typeChecker, implementations) { + // The search set contains at least the current symbol + var result = [symbol]; + // If the location is name of property symbol from object literal destructuring pattern + // Search the property symbol + // for ( { property: p2 } of elems) { } + var containingObjectLiteralElement = getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 260 /* ShorthandPropertyAssignment */) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, typeChecker); + if (propertySymbol) { + result.push(propertySymbol); } } - function getReferencesForStringLiteral(node, sourceFiles) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (!type) { - // nothing to do here. moving on - return undefined; + // If the location is in a context sensitive location (i.e. in an object literal) try + // to get a contextual type for it, and add the property symbol from the contextual + // type to the search set + if (containingObjectLiteralElement) { + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, typeChecker), function (contextualSymbol) { + ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); + }); + /* Because in short-hand property assignment, location has two meaning : property name and as value of the property + * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of + * property name and variable declaration of the identifier. + * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service + * should show both 'name' in 'obj' and 'name' in variable declaration + * const name = "Foo"; + * const obj = { name }; + * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment + * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration + * will be included correctly. + */ + var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol) { + result.push(shorthandValueSymbol); } - var references = []; - for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { - var sourceFile = sourceFiles_9[_i]; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); - getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + // If the symbol.valueDeclaration is a property parameter declaration, + // we should include both parameter declaration symbol and property declaration symbol + // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. + // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 145 /* Parameter */ && + ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { + ts.addRange(result, typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + // If this is symbol of binding element without propertyName declaration in Object binding pattern + // Include the property in the search + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, typeChecker); + if (bindingElementPropertySymbol) { + result.push(bindingElementPropertySymbol); + } + // If this is a union property, add all the symbols from all its source symbols in all unioned types. + // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list + for (var _i = 0, _a = typeChecker.getRootSymbols(symbol); _i < _a.length; _i++) { + var rootSymbol = _a[_i]; + if (rootSymbol !== symbol) { + result.push(rootSymbol); } - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: type.text, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] - }, - references: references - }]; - function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { - for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { - var position = possiblePositions_1[_i]; - cancellationToken.throwIfCancellationRequested(); - var node_3 = ts.getTouchingWord(sourceFile, position); - if (!node_3 || node_3.kind !== 9 /* StringLiteral */) { - return; - } - var type_1 = ts.getStringLiteralTypeForNode(node_3, typeChecker); - if (type_1 === searchType) { - references.push(getReferenceEntryFromNode(node_3)); - } - } + // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions + if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap(), typeChecker); } } - function populateSearchSymbolSet(symbol, location) { - // The search set contains at least the current symbol - var result = [symbol]; - // If the location is name of property symbol from object literal destructuring pattern - // Search the property symbol - // for ( { property: p2 } of elems) { } - var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 259 /* ShorthandPropertyAssignment */) { - var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); - if (propertySymbol) { - result.push(propertySymbol); - } - } - // If the symbol is an alias, add what it aliases to the list - // import {a} from "mod"; - // export {a} - // If the symbol is an alias to default declaration, add what it aliases to the list - // declare "mod" { export default class B { } } - // import B from "mod"; - //// For export specifiers, the exported name can be referring to a local symbol, e.g.: - //// import {a} from "mod"; - //// export {a as somethingElse} - //// We want the *local* declaration of 'a' as declared in the import, - //// *not* as declared within "mod" (or farther) - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); - if (aliasSymbol) { - result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); - } - // If the location is in a context sensitive location (i.e. in an object literal) try - // to get a contextual type for it, and add the property symbol from the contextual - // type to the search set - if (containingObjectLiteralElement) { - ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); - }); - /* Because in short-hand property assignment, location has two meaning : property name and as value of the property - * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of - * property name and variable declaration of the identifier. - * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service - * should show both 'name' in 'obj' and 'name' in variable declaration - * const name = "Foo"; - * const obj = { name }; - * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment - * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration - * will be included correctly. - */ - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); - if (shorthandValueSymbol) { - result.push(shorthandValueSymbol); - } - } - // If the symbol.valueDeclaration is a property parameter declaration, - // we should include both parameter declaration symbol and property declaration symbol - // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. - // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members - if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 /* Parameter */ && - ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { - result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); - } - // If this is symbol of binding element without propertyName declaration in Object binding pattern - // Include the property in the search - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); - if (bindingElementPropertySymbol) { - result.push(bindingElementPropertySymbol); - } - // If this is a union property, add all the symbols from all its source symbols in all unioned types. - // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list - ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { - if (rootSymbol !== symbol) { - result.push(rootSymbol); - } - // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions - if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap()); + return result; + } + /** + * Find symbol of the given property-name and add the symbol to the given result array + * @param symbol a symbol to start searching for the given propertyName + * @param propertyName a name of property to search for + * @param result an array of symbol of found property symbols + * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. + * The value of previousIterationSymbol is undefined when the function is first called. + */ + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, typeChecker) { + if (!symbol) { + return; + } + // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited + // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. + // For example: + // interface C extends C { + // /*findRef*/propName: string; + // } + // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, + // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, + // the function will add any found symbol of the property-name, then its sub-routine will call + // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already + // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. + if (previousIterationSymbolsCache.has(symbol.name)) { + return; + } + if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { + ts.forEach(symbol.getDeclarations(), function (declaration) { + if (ts.isClassLike(declaration)) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); + } + else if (declaration.kind === 229 /* InterfaceDeclaration */) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); - return result; } - /** - * Find symbol of the given property-name and add the symbol to the given result array - * @param symbol a symbol to start searching for the given propertyName - * @param propertyName a name of property to search for - * @param result an array of symbol of found property symbols - * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. - * The value of previousIterationSymbol is undefined when the function is first called. - */ - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { - if (!symbol) { - return; - } - // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited - // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. - // For example: - // interface C extends C { - // /*findRef*/propName: string; - // } - // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, - // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, - // the function will add any found symbol of the property-name, then its sub-routine will call - // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already - // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. - if (symbol.name in previousIterationSymbolsCache) { - return; - } - if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { - ts.forEach(symbol.getDeclarations(), function (declaration) { - if (ts.isClassLike(declaration)) { - getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); - ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); - } - else if (declaration.kind === 228 /* InterfaceDeclaration */) { - ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); - } - }); - } - return; - function getPropertySymbolFromTypeReference(typeReference) { - if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); - if (type) { - var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); - if (propertySymbol) { - result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); - } - // Visit the typeReference as well to see if it directly or indirectly use that property - previousIterationSymbolsCache[symbol.name] = symbol; - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); + return; + function getPropertySymbolFromTypeReference(typeReference) { + if (typeReference) { + var type = typeChecker.getTypeAtLocation(typeReference); + if (type) { + var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); + if (propertySymbol) { + result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); } + // Visit the typeReference as well to see if it directly or indirectly use that property + previousIterationSymbolsCache.set(symbol.name, symbol); + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, typeChecker); } } } - function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) { - if (ts.contains(searchSymbols, referenceSymbol)) { - // If we are searching for constructor uses, they must be 'new' expressions. - return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol; - } - // If the reference symbol is an alias, check if what it is aliasing is one of the search - // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); - if (aliasSymbol) { - return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache); + } + function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache, typeChecker) { + if (ts.contains(searchSymbols, referenceSymbol)) { + // If we are searching for constructor uses, they must be 'new' expressions. + return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) ? referenceSymbol : undefined; + } + // If the reference symbol is an alias, check if what it is aliasing is one of the search + // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation, typeChecker); + if (aliasSymbol) { + return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache, typeChecker); + } + // 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 + var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + if (containingObjectLiteralElement) { + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, typeChecker), function (contextualSymbol) { + return ts.find(typeChecker.getRootSymbols(contextualSymbol), function (symbol) { return ts.contains(searchSymbols, symbol); }); + }); + if (contextualSymbol) { + return contextualSymbol; } - // 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 - var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); - if (containingObjectLiteralElement) { - var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); - }); - if (contextualSymbol) { - return contextualSymbol; - } - // If the reference location is the name of property from object literal destructuring pattern - // Get the property symbol from the object literal's type and look if thats the search symbol - // In below eg. get 'property' from type of elems iterating type - // for ( { property: p2 } of elems) { } - var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); - if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { - return propertySymbol; - } - } - // If the reference location is the binding element and doesn't have property name - // then include the binding element in the related symbols - // let { a } : { a }; - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); - if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { - return bindingElementPropertySymbol; - } - // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) - // Or a union property, use its underlying unioned symbols - return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { - // if it is in the list, then we are done - 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 - // see if any is in the list. If we were passed a parent symbol, only include types that are subtypes of the - // parent symbol - if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - // Parents will only be defined if implementations is true - if (parents) { - if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) { - return undefined; - } + // If the reference location is the name of property from object literal destructuring pattern + // Get the property symbol from the object literal's type and look if thats the search symbol + // In below eg. get 'property' from type of elems iterating type + // for ( { property: p2 } of elems) { } + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, typeChecker); + if (propertySymbol && ts.contains(searchSymbols, propertySymbol)) { + return propertySymbol; + } + } + // If the reference location is the binding element and doesn't have property name + // then include the binding element in the related symbols + // let { a } : { a }; + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, typeChecker); + if (bindingElementPropertySymbol && ts.contains(searchSymbols, bindingElementPropertySymbol)) { + return bindingElementPropertySymbol; + } + // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) + // Or a union property, use its underlying unioned symbols + return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { + // if it is in the list, then we are done + if (ts.contains(searchSymbols, rootSymbol)) { + return rootSymbol; + } + // 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 we were passed a parent symbol, only include types that are subtypes of the + // parent symbol + if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { + // Parents will only be defined if implementations is true + if (parents) { + if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache, typeChecker); })) { + return undefined; } - var result_4 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, /*previousIterationSymbolsCache*/ ts.createMap()); - return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); } - return undefined; - }); - } - function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 142 /* ComputedPropertyName */) { - var nameExpression = node.name.expression; - // treat computed property names where expression is string/numeric literal as just string/numeric literal - if (ts.isStringOrNumericLiteral(nameExpression)) { - return nameExpression.text; - } - return undefined; + var result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap(), typeChecker); + return ts.find(result, function (symbol) { return ts.contains(searchSymbols, symbol); }); } - return node.name.text; - } - function getPropertySymbolsFromContextualType(node) { - var objectLiteral = node.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); - var name = getNameFromObjectLiteralElement(node); - if (name && contextualType) { - var result_5 = []; - var symbol_2 = contextualType.getProperty(name); - if (symbol_2) { - result_5.push(symbol_2); - } - if (contextualType.flags & 65536 /* Union */) { - ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name); - if (symbol) { - result_5.push(symbol); - } - }); - } - return result_5; + return undefined; + }); + } + function getNameFromObjectLiteralElement(node) { + if (node.name.kind === 143 /* ComputedPropertyName */) { + var nameExpression = node.name.expression; + // treat computed property names where expression is string/numeric literal as just string/numeric literal + if (ts.isStringOrNumericLiteral(nameExpression)) { + return nameExpression.text; } return undefined; } - /** Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations - * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class - * then we need to widen the search to include type positions as well. - * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated - * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) - * do not intersect in any of the three spaces. - */ - function getIntersectingMeaningFromDeclarations(meaning, declarations) { - if (declarations) { - var lastIterationMeaning = void 0; - do { - // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module] - // we need to consider both as they initialMeaning intersects with the module in the namespace space, and the module - // intersects with the class in the value space. - // To achieve that we will keep iterating until the result stabilizes. - // Remember the last meaning - lastIterationMeaning = meaning; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; - var declarationMeaning = ts.getMeaningFromDeclaration(declaration); - if (declarationMeaning & meaning) { - meaning |= declarationMeaning; - } + return node.name.text; + } + /** Gets all symbols for one property. Does not get symbols for every property. */ + function getPropertySymbolsFromContextualType(node, typeChecker) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = getNameFromObjectLiteralElement(node); + if (name && contextualType) { + var result_4 = []; + var symbol = contextualType.getProperty(name); + if (symbol) { + result_4.push(symbol); + } + if (contextualType.flags & 65536 /* Union */) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_4.push(symbol); } - } while (meaning !== lastIterationMeaning); + }); } - return meaning; + return result_4; } + return undefined; + } + /** + * Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations + * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class + * then we need to widen the search to include type positions as well. + * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated + * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) + * do not intersect in any of the three spaces. + */ + function getIntersectingMeaningFromDeclarations(meaning, declarations) { + if (declarations) { + var lastIterationMeaning = void 0; + do { + // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module] + // we need to consider both as they initialMeaning intersects with the module in the namespace space, and the module + // intersects with the class in the value space. + // To achieve that we will keep iterating until the result stabilizes. + // Remember the last meaning + lastIterationMeaning = meaning; + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; + var declarationMeaning = ts.getMeaningFromDeclaration(declaration); + if (declarationMeaning & meaning) { + meaning |= declarationMeaning; + } + } + } while (meaning !== lastIterationMeaning); + } + return meaning; } - FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; function convertReferences(referenceSymbols) { if (!referenceSymbols) { return undefined; @@ -71367,7 +71735,7 @@ var ts; if (node.initializer) { return true; } - else if (node.kind === 224 /* VariableDeclaration */) { + else if (node.kind === 225 /* VariableDeclaration */) { var parentStatement = getParentStatementOfVariableDeclaration(node); return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */); } @@ -71377,18 +71745,18 @@ var ts; } else { switch (node.kind) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 230 /* EnumDeclaration */: - case 231 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: return true; } } return false; } function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 206 /* VariableStatement */) { - ts.Debug.assert(node.parent.kind === 225 /* VariableDeclarationList */); + if (node.parent && node.parent.parent && node.parent.parent.kind === 207 /* VariableStatement */) { + ts.Debug.assert(node.parent.kind === 226 /* VariableDeclarationList */); return node.parent.parent; } } @@ -71427,10 +71795,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 191 /* PostfixUnaryExpression */ || parent.kind === 190 /* PrefixUnaryExpression */) { + if (parent.kind === 192 /* PostfixUnaryExpression */ || parent.kind === 191 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 192 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 193 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; return 57 /* FirstAssignment */ <= operator && operator <= 69 /* LastAssignment */; } @@ -71452,7 +71820,7 @@ var ts; switch (node.kind) { case 9 /* StringLiteral */: case 8 /* NumericLiteral */: - if (node.parent.kind === 142 /* ComputedPropertyName */) { + if (node.parent.kind === 143 /* ComputedPropertyName */) { return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; } // intential fall through @@ -71463,11 +71831,11 @@ var ts; } function isObjectLiteralPropertyDeclaration(node) { switch (node.kind) { - case 258 /* PropertyAssignment */: - case 259 /* ShorthandPropertyAssignment */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 259 /* PropertyAssignment */: + case 260 /* ShorthandPropertyAssignment */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return true; } return false; @@ -71482,6 +71850,9 @@ var ts; } return false; } + function isImportDefaultSymbol(symbol) { + return symbol.declarations[0].kind === 238 /* ImportClause */; + } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); /* @internal */ @@ -71502,11 +71873,9 @@ var ts; // Type reference directives var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { - var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; - if (referenceFile && referenceFile.resolvedFileName) { - return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; - } - return undefined; + var referenceFile = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName); + return referenceFile && referenceFile.resolvedFileName && + [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } var node = ts.getTouchingPropertyName(sourceFile, position); if (node === sourceFile) { @@ -71516,7 +71885,7 @@ var ts; if (ts.isJumpStatementTarget(node)) { var labelName = node.text; var label = ts.getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; + return label ? [createDefinitionInfoFromName(label, ts.ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } var typeChecker = program.getTypeChecker(); var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); @@ -71542,7 +71911,7 @@ var ts; // if (node.kind === 70 /* Identifier */ && (node.parent === declaration || - (declaration.kind === 240 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 239 /* NamedImports */))) { + (declaration.kind === 241 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 240 /* NamedImports */))) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -71551,7 +71920,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 259 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 260 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -71580,13 +71949,13 @@ var ts; return undefined; } if (type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */)) { - var result_6 = []; + var result_5 = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(/*to*/ result_6, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node)); + ts.addRange(/*to*/ result_5, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node)); } }); - return result_6; + return result_5; } if (!type.symbol) { return undefined; @@ -71633,29 +72002,42 @@ var ts; function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { var declarations = []; var definition; - ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 150 /* Constructor */) || - (!selectConstructors && (d.kind === 226 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) { + for (var _i = 0, signatureDeclarations_1 = signatureDeclarations; _i < signatureDeclarations_1.length; _i++) { + var d = signatureDeclarations_1[_i]; + if (selectConstructors ? d.kind === 151 /* Constructor */ : isSignatureDeclaration(d)) { declarations.push(d); if (d.body) definition = d; } - }); - if (definition) { - result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); - return true; } - else if (declarations.length) { - result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); + if (declarations.length) { + result.push(createDefinitionInfo(definition || ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); return true; } return false; } } + function isSignatureDeclaration(node) { + switch (node.kind) { + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + return true; + default: + return false; + } + } + /** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */ function createDefinitionInfo(node, symbolKind, symbolName, containerName) { + return createDefinitionInfoFromName(node.name || node, symbolKind, symbolName, containerName); + } + /** Creates a DefinitionInfo directly from the name of a declaration. */ + function createDefinitionInfoFromName(name, symbolKind, symbolName, containerName) { + var sourceFile = name.getSourceFile(); return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromNode(name, sourceFile), kind: symbolKind, name: symbolName, containerKind: undefined, @@ -71703,7 +72085,12 @@ var ts; } function tryGetSignatureDeclaration(typeChecker, node) { var callLike = getAncestorCallLikeExpression(node); - return callLike && typeChecker.getResolvedSignature(callLike).declaration; + var decl = callLike && typeChecker.getResolvedSignature(callLike).declaration; + if (decl && isSignatureDeclaration(decl)) { + return decl; + } + // Don't go to a function type, go to the value having that type. + return undefined; } })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); })(ts || (ts = {})); @@ -71715,7 +72102,7 @@ var ts; function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 259 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 260 /* ShorthandPropertyAssignment */) { var result = []; ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); return result.length > 0 ? result : undefined; @@ -71728,7 +72115,7 @@ var ts; } else { // Perform "Find all References" and retrieve only those that are implementations - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, /*findInStrings*/ false, /*findInComments*/ false, /*implementations*/ true); + var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, /*findInStrings*/ false, /*findInComments*/ false, /*isForRename*/ false, /*implementations*/ true); var result = ts.flatMap(referencedSymbols, function (symbol) { return ts.map(symbol.references, function (_a) { var textSpan = _a.textSpan, fileName = _a.fileName; @@ -71882,19 +72269,19 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 150 /* Constructor */: - case 227 /* ClassDeclaration */: - case 206 /* VariableStatement */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 151 /* Constructor */: + case 228 /* ClassDeclaration */: + case 207 /* VariableStatement */: break findOwner; - case 262 /* SourceFile */: + case 263 /* SourceFile */: return undefined; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - if (commentOwner.parent.kind === 231 /* ModuleDeclaration */) { + if (commentOwner.parent.kind === 232 /* ModuleDeclaration */) { return undefined; } break findOwner; @@ -71941,7 +72328,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 206 /* VariableStatement */) { + if (commentOwner.kind === 207 /* VariableStatement */) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -71959,17 +72346,17 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 183 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 184 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return rightHandSide.parameters; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150 /* Constructor */) { + if (member.kind === 151 /* Constructor */) { return member.parameters; } } @@ -72027,7 +72414,7 @@ var ts; }); if (!safeList) { var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMap(result.config) : EmptySafeList; + safeList = result.config ? ts.createMapFromTemplate(result.config) : EmptySafeList; } var filesToWatch = []; // Directories to search for package.json, bower.json and other typing information @@ -72054,33 +72441,33 @@ var ts; if (unresolvedImports) { for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { var moduleId = unresolvedImports_1[_a]; - var typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; + var typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); } } } // Add the cached typing locations for inferred typings that are already installed - for (var name_47 in packageNameToTypingLocation) { - if (name_47 in inferredTypings && !inferredTypings[name_47]) { - inferredTypings[name_47] = packageNameToTypingLocation[name_47]; + packageNameToTypingLocation.forEach(function (typingLocation, name) { + if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { + inferredTypings.set(name, typingLocation); } - } + }); // Remove typings that the user has added to the exclude list for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { var excludeTypingName = exclude_1[_b]; - delete inferredTypings[excludeTypingName]; + inferredTypings.delete(excludeTypingName); } var newTypingNames = []; var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); + inferredTypings.forEach(function (inferred, typing) { + if (inferred !== undefined) { + cachedTypingPaths.push(inferred); } else { newTypingNames.push(typing); } - } + }); return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; /** * Merge a given list of typingNames to the inferredTypings map @@ -72091,8 +72478,8 @@ var ts; } for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; + if (!inferredTypings.has(typing)) { + inferredTypings.set(typing, undefined); } } } @@ -72131,7 +72518,7 @@ var ts; var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); if (safeList !== EmptySafeList) { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return safeList.has(f); })); } var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2 /* JSX */; }); if (hasJsxFile) { @@ -72174,7 +72561,7 @@ var ts; } if (packageJson.typings) { var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; + inferredTypings.set(packageJson.name, absolutePath); } else { typingNames.push(packageJson.name); @@ -72194,21 +72581,18 @@ var ts; function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; - // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] - ts.forEach(sourceFiles, function (sourceFile) { + var _loop_4 = function (sourceFile) { cancellationToken.throwIfCancellationRequested(); if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) { - return; + return "continue"; } - var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_48 in nameToDeclarations) { - var declarations = nameToDeclarations[name_48]; + ts.forEachEntry(sourceFile.getNamedDeclarations(), function (declarations, name) { if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_48); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); if (!matches) { - continue; + return; // continue to next named declarations } for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; @@ -72217,24 +72601,29 @@ var ts; if (patternMatcher.patternContainsDots) { var containers = getContainers(declaration); if (!containers) { - return undefined; + return true; // Break out of named declarations and go to the next source file. } - matches = patternMatcher.getMatches(containers, name_48); + matches = patternMatcher.getMatches(containers, name); if (!matches) { - continue; + return; // continue to next named declarations } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_48, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } - } - }); + }); + }; + // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] + for (var _i = 0, sourceFiles_10 = sourceFiles; _i < sourceFiles_10.length; _i++) { + var sourceFile = sourceFiles_10[_i]; + _loop_4(sourceFile); + } // Remove imports when the imported declaration is already in the list and has the same name. rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 237 /* ImportClause */ || decl.kind === 240 /* ImportSpecifier */ || decl.kind === 235 /* ImportEqualsDeclaration */) { + if (decl.kind === 238 /* ImportClause */ || decl.kind === 241 /* ImportSpecifier */ || decl.kind === 236 /* ImportEqualsDeclaration */) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -72276,7 +72665,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 142 /* ComputedPropertyName */) { + else if (declaration.name.kind === 143 /* ComputedPropertyName */) { return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true); } else { @@ -72297,7 +72686,7 @@ var ts; } return true; } - if (expression.kind === 177 /* PropertyAccessExpression */) { + if (expression.kind === 178 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -72310,7 +72699,7 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 142 /* ComputedPropertyName */) { + if (declaration.name.kind === 143 /* ComputedPropertyName */) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) { return undefined; } @@ -72356,7 +72745,7 @@ var ts; matchKind: ts.PatternMatchKind[rawItem.matchKind], isCaseSensitive: rawItem.isCaseSensitive, fileName: rawItem.fileName, - textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + textSpan: ts.createTextSpanFromNode(declaration), // TODO(jfreeman): What should be the containerName when the container has a computed name? containerName: container && container.name ? container.name.text : "", containerKind: container && container.name ? ts.getNodeKind(container) : "" @@ -72463,7 +72852,7 @@ var ts; return; } switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -72475,21 +72864,21 @@ var ts; } } break; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 149 /* MethodSignature */: if (!ts.hasDynamicName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: if (!ts.hasDynamicName(node)) { addLeafNode(node); } break; - case 237 /* ImportClause */: + case 238 /* ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -72501,7 +72890,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 238 /* NamespaceImport */) { + if (namedBindings.kind === 239 /* NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -72512,12 +72901,12 @@ var ts; } } break; - case 174 /* BindingElement */: - case 224 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 225 /* VariableDeclaration */: var decl = node; - var name_49 = decl.name; - if (ts.isBindingPattern(name_49)) { - addChildrenRecursively(name_49); + var name = decl.name; + if (ts.isBindingPattern(name)) { + addChildrenRecursively(name); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { // For `const x = function() {}`, just use the function node, not the const. @@ -72527,12 +72916,12 @@ var ts; addNodeWithRecursiveChild(decl, decl.initializer); } break; - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -72542,9 +72931,9 @@ var ts; } endNode(); break; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -72552,21 +72941,21 @@ var ts; } endNode(); break; - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 244 /* ExportSpecifier */: - case 235 /* ImportEqualsDeclaration */: - case 155 /* IndexSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 229 /* TypeAliasDeclaration */: + case 245 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 156 /* IndexSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 230 /* TypeAliasDeclaration */: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 286 /* JSDocTypedefTag */) { + if (tag.kind === 287 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -72584,9 +72973,9 @@ var ts; // Anonymous items are never merged. return true; } - var itemsWithSameName = nameToItems[name]; + var itemsWithSameName = nameToItems.get(name); if (!itemsWithSameName) { - nameToItems[name] = child; + nameToItems.set(name, child); return true; } if (itemsWithSameName instanceof Array) { @@ -72604,7 +72993,7 @@ var ts; if (tryMerge(itemWithSameName, child)) { return false; } - nameToItems[name] = [itemWithSameName, child]; + nameToItems.set(name, [itemWithSameName, child]); return true; } function tryMerge(a, b) { @@ -72617,14 +73006,14 @@ var ts; }); /** a and b have the same name, but they may not be mergeable. */ function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 231 /* ModuleDeclaration */ || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 232 /* ModuleDeclaration */ || areSameModule(a, b)); // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes. // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'! function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 231 /* ModuleDeclaration */) { + if (a.body.kind !== 232 /* ModuleDeclaration */) { return true; } return areSameModule(a.body, b.body); @@ -72652,39 +73041,20 @@ var ts; function compareChildren(child1, child2) { var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node); if (name1 && name2) { - var cmp = localeCompareFix(name1, name2); + var cmp = ts.compareStringsCaseInsensitive(name1, name2); return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } else { return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } } - // Intl is missing in Safari, and node 0.10 treats "a" as greater than "B". - var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; - var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) { - // This isn't perfect, but it passes all of our tests. - for (var i = 0; i < Math.min(a.length, b.length); i++) { - var chA = a.charAt(i), chB = b.charAt(i); - if (chA === "\"" && chB === "'") { - return 1; - } - if (chA === "'" && chB === "\"") { - return -1; - } - var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase()); - if (cmp !== 0) { - return cmp; - } - } - return a.length - b.length; - }; /** * This differs from getItemName because this is just used for sorting. * We only sort nodes by name that have a more-or-less "direct" name, as opposed to `new()` and the like. * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 231 /* ModuleDeclaration */) { + if (node.kind === 232 /* ModuleDeclaration */) { return getModuleName(node); } var decl = node; @@ -72692,18 +73062,18 @@ var ts; return ts.getPropertyNameForPropertyNameNode(decl.name); } switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 197 /* ClassExpression */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 198 /* ClassExpression */: return getFunctionOrClassName(node); - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 231 /* ModuleDeclaration */) { + if (node.kind === 232 /* ModuleDeclaration */) { return getModuleName(node); } var name = node.name; @@ -72714,16 +73084,16 @@ var ts; } } switch (node.kind) { - case 262 /* SourceFile */: + case 263 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; } @@ -72731,15 +73101,15 @@ var ts; // (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the // navigation bar. return getFunctionOrClassName(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return "constructor"; - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: return "new()"; - case 153 /* CallSignature */: + case 154 /* CallSignature */: return "()"; - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return "[]"; - case 286 /* JSDocTypedefTag */: + case 287 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -72751,7 +73121,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 206 /* VariableStatement */) { + if (parentNode && parentNode.kind === 207 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -72780,24 +73150,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 230 /* EnumDeclaration */: - case 228 /* InterfaceDeclaration */: - case 231 /* ModuleDeclaration */: - case 262 /* SourceFile */: - case 229 /* TypeAliasDeclaration */: - case 286 /* JSDocTypedefTag */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 231 /* EnumDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 263 /* SourceFile */: + case 230 /* TypeAliasDeclaration */: + case 287 /* JSDocTypedefTag */: return true; - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 224 /* VariableDeclaration */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 225 /* VariableDeclaration */: return hasSomeImportantChild(item); - case 185 /* ArrowFunction */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -72807,10 +73177,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 232 /* ModuleBlock */: - case 262 /* SourceFile */: - case 149 /* MethodDeclaration */: - case 150 /* Constructor */: + case 233 /* ModuleBlock */: + case 263 /* SourceFile */: + case 150 /* MethodDeclaration */: + case 151 /* Constructor */: return true; default: return hasSomeImportantChild(item); @@ -72819,7 +73189,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 224 /* VariableDeclaration */ && childKind !== 174 /* BindingElement */; + return childKind !== 225 /* VariableDeclaration */ && childKind !== 175 /* BindingElement */; }); } } @@ -72830,7 +73200,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToTree) }; @@ -72839,7 +73209,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray, indent: n.indent, @@ -72877,7 +73247,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 231 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 232 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -72888,28 +73258,34 @@ var ts; * We store 'A' as associated with a NavNode, and use getModuleName to traverse down again. */ function getInteriorModule(decl) { - return decl.body.kind === 231 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 232 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 142 /* ComputedPropertyName */; + return !member.name || member.name.kind === 143 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 262 /* SourceFile */ + return node.kind === 263 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); + : ts.createTextSpanFromNode(node, curSourceFile); + } + function getModifiers(node) { + if (node.parent && node.parent.kind === 225 /* VariableDeclaration */) { + node = node.parent; + } + return ts.getNodeModifiers(node); } function getFunctionOrClassName(node) { if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 224 /* VariableDeclaration */) { + else if (node.parent.kind === 225 /* VariableDeclaration */) { return ts.declarationNameToString(node.parent.name); } - else if (node.parent.kind === 192 /* BinaryExpression */ && + else if (node.parent.kind === 193 /* BinaryExpression */ && node.parent.operatorToken.kind === 57 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 258 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 259 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512 /* Default */) { @@ -72920,7 +73296,7 @@ var ts; } } function isFunctionOrClassExpression(node) { - return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */ || node.kind === 197 /* ClassExpression */; + return node.kind === 185 /* FunctionExpression */ || node.kind === 186 /* ArrowFunction */ || node.kind === 198 /* ClassExpression */; } /** * Matches all whitespace characters in a string. Eg: @@ -72950,7 +73326,7 @@ var ts; if (hintSpanNode && startElement && endElement) { var span_12 = { textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), - hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + hintSpan: ts.createTextSpanFromNode(hintSpanNode, sourceFile), bannerText: collapseText, autoCollapse: autoCollapse }; @@ -73010,7 +73386,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 185 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 186 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -73022,30 +73398,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 205 /* Block */: + case 206 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_20 = n.parent; + var parent = n.parent; var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_20.kind === 210 /* DoStatement */ || - parent_20.kind === 213 /* ForInStatement */ || - parent_20.kind === 214 /* ForOfStatement */ || - parent_20.kind === 212 /* ForStatement */ || - parent_20.kind === 209 /* IfStatement */ || - parent_20.kind === 211 /* WhileStatement */ || - parent_20.kind === 218 /* WithStatement */ || - parent_20.kind === 257 /* CatchClause */) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + if (parent.kind === 211 /* DoStatement */ || + parent.kind === 214 /* ForInStatement */ || + parent.kind === 215 /* ForOfStatement */ || + parent.kind === 213 /* ForStatement */ || + parent.kind === 210 /* IfStatement */ || + parent.kind === 212 /* WhileStatement */ || + parent.kind === 219 /* WithStatement */ || + parent.kind === 258 /* CatchClause */) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_20.kind === 222 /* TryStatement */) { + if (parent.kind === 223 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_20; + var tryStatement = parent; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -73058,7 +73434,7 @@ var ts; } // Block was a standalone block. In this case we want to only collapse // the span of the block, independent of any parent span. - var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end); + var span_14 = ts.createTextSpanFromNode(n); elements.push({ textSpan: span_14, hintSpan: span_14, @@ -73068,23 +73444,23 @@ var ts; break; } // Fallthrough. - case 232 /* ModuleBlock */: { + case 233 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 176 /* ObjectLiteralExpression */: - case 233 /* CaseBlock */: { + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 177 /* ObjectLiteralExpression */: + case 234 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 20 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 21 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -73180,10 +73556,11 @@ var ts; return totalMatch; } function getWordSpans(word) { - if (!(word in stringToWordSpans)) { - stringToWordSpans[word] = breakIntoWordSpans(word); + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - return stringToWordSpans[word]; + return spans; } function matchTextChunk(candidate, chunk, punctuationStripped) { var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); @@ -73758,7 +74135,7 @@ var ts; else { if (token === 70 /* Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import d from "mod"; @@ -73789,7 +74166,7 @@ var ts; } if (token === 17 /* CloseBraceToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import {a as A} from "mod"; @@ -73805,7 +74182,7 @@ var ts; token = nextToken(); if (token === 70 /* Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import * as NS from "mod" @@ -73835,7 +74212,7 @@ var ts; } if (token === 17 /* CloseBraceToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // export {a as A} from "mod"; @@ -73847,7 +74224,7 @@ var ts; } else if (token === 38 /* AsteriskToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // export * from "mod" @@ -73999,93 +74376,85 @@ var ts; var Rename; (function (Rename) { function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) { - var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); + var getCanonicalDefaultLibName = ts.memoize(function () { return getCanonicalFileName(ts.normalizePath(defaultLibFileName)); }); var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true); - if (node) { - if (node.kind === 70 /* Identifier */ || - node.kind === 9 /* StringLiteral */ || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - ts.isThis(node)) { - var symbol = typeChecker.getSymbolAtLocation(node); - // Only allow a symbol to be renamed if it actually has at least one declaration. - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - // Disallow rename for elements that are defined in the standard TypeScript library. - if (ts.forEach(declarations, isDefinedInLibraryFile)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - if (kind) { - return { - canRename: true, - kind: kind, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } - else if (node.kind === 9 /* StringLiteral */) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (type) { - if (isDefinedInLibraryFile(node)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - else { - var displayName = ts.stripQuotes(type.text); - return { - canRename: true, - kind: ts.ScriptElementKind.variableElement, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: displayName, - kindModifiers: ts.ScriptElementKindModifier.none, - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } + var renameInfo = node && nodeIsEligibleForRename(node) + ? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) + : undefined; + return renameInfo || getRenameInfoError(ts.Diagnostics.You_cannot_rename_this_element); + function isDefinedInLibraryFile(declaration) { + if (!defaultLibFileName) { + return false; } + var sourceFile = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName)); + return canonicalName === getCanonicalDefaultLibName(); } - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element)); - function getRenameInfoError(localizedErrorMessage) { - return { - canRename: false, - localizedErrorMessage: localizedErrorMessage, - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }; - } - function isDefinedInLibraryFile(declaration) { - if (defaultLibFileName) { - var sourceFile_1 = declaration.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)); - if (canonicalName === canonicalDefaultLibName) { - return true; + } + Rename.getRenameInfo = getRenameInfo; + function getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) { + var symbol = typeChecker.getSymbolAtLocation(node); + // Only allow a symbol to be renamed if it actually has at least one declaration. + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + // Disallow rename for elements that are defined in the standard TypeScript library. + if (ts.some(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); + return kind ? getRenameInfoSuccess(displayName, typeChecker.getFullyQualifiedName(symbol), kind, ts.SymbolDisplay.getSymbolModifiers(symbol), node, sourceFile) : undefined; } - return false; } - function createTriggerSpanForNode(node, sourceFile) { - var start = node.getStart(sourceFile); - var width = node.getWidth(sourceFile); - if (node.kind === 9 /* StringLiteral */) { - // Exclude the quotes - start += 1; - width -= 2; + else if (node.kind === 9 /* StringLiteral */) { + var type = ts.getStringLiteralTypeForNode(node, typeChecker); + if (type) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); + } + var displayName = ts.stripQuotes(type.text); + return getRenameInfoSuccess(displayName, displayName, ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, node, sourceFile); } - return ts.createTextSpan(start, width); } } - Rename.getRenameInfo = getRenameInfo; + function getRenameInfoSuccess(displayName, fullDisplayName, kind, kindModifiers, node, sourceFile) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: fullDisplayName, + kindModifiers: kindModifiers, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + function getRenameInfoError(diagnostic) { + return { + canRename: false, + localizedErrorMessage: ts.getLocaleSpecificMessage(diagnostic), + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9 /* StringLiteral */) { + // Exclude the quotes + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } + function nodeIsEligibleForRename(node) { + return node.kind === 70 /* Identifier */ || node.kind === 9 /* StringLiteral */ || + ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + ts.isThis(node); + } })(Rename = ts.Rename || (ts.Rename = {})); })(ts || (ts = {})); /// @@ -74263,7 +74632,7 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 179 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 180 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -74271,7 +74640,7 @@ var ts; var expression = callExpression.expression; var name = expression.kind === 70 /* Identifier */ ? expression - : expression.kind === 177 /* PropertyAccessExpression */ + : expression.kind === 178 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -74281,7 +74650,7 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameToDeclarations = sourceFile.getNamedDeclarations(); - var declarations = nameToDeclarations[name.text]; + var declarations = nameToDeclarations.get(name.text); if (declarations) { for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) { var declaration = declarations_10[_b]; @@ -74304,7 +74673,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { - if (node.parent.kind === 179 /* CallExpression */ || node.parent.kind === 180 /* NewExpression */) { + if (node.parent.kind === 180 /* CallExpression */ || node.parent.kind === 181 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -74358,25 +74727,25 @@ var ts; } return undefined; } - else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 182 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0, sourceFile); } } - else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 182 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 195 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 203 /* TemplateSpan */ && node.parent.parent.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 204 /* TemplateSpan */ && node.parent.parent.parent.kind === 182 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 195 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 15 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -74387,6 +74756,7 @@ var ts; } return undefined; } + SignatureHelp.getImmediatelyContainingArgumentInfo = getImmediatelyContainingArgumentInfo; function getArgumentIndex(argumentsList, node) { // The list we got back can include commas. In the presence of errors it may // also just have nodes without commas. For example "Foo(a b c)" will have 3 @@ -74494,7 +74864,7 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 194 /* TemplateExpression */) { + if (template.kind === 195 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -74503,7 +74873,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 262 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 263 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -74648,7 +75018,7 @@ var ts; function getSymbolKind(typeChecker, symbol, location) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 198 /* ClassExpression */) ? ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ts.ScriptElementKind.enumElement; @@ -74754,7 +75124,7 @@ var ts; var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 177 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 178 /* 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)) { @@ -74763,7 +75133,7 @@ var ts; } // try get the call/construct signature from the type if it matches var callExpression = void 0; - if (location.kind === 179 /* CallExpression */ || location.kind === 180 /* NewExpression */) { + if (location.kind === 180 /* CallExpression */ || location.kind === 181 /* NewExpression */) { callExpression = location; } else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) { @@ -74776,7 +75146,7 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 180 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 181 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -74829,24 +75199,24 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 150 /* Constructor */)) { + (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 151 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 150 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration.kind === 151 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 150 /* Constructor */) { + if (functionDeclaration.kind === 151 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ts.ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 154 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -74855,7 +75225,7 @@ var ts; } } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { - if (ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 198 /* 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 @@ -74878,7 +75248,7 @@ var ts; } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(136 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(137 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -74899,7 +75269,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 231 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 232 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 70 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 128 /* NamespaceKeyword */ : 127 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -74920,28 +75290,28 @@ var ts; } else { // Method/function type parameter - var declaration = ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */); + var declaration = ts.getDeclarationOfKind(symbol, 144 /* TypeParameter */); ts.Debug.assert(declaration !== undefined); declaration = declaration.parent; if (declaration) { if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 154 /* ConstructSignature */) { + if (declaration.kind === 155 /* ConstructSignature */) { displayParts.push(ts.keywordPart(93 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 153 /* CallSignature */ && declaration.name) { + else if (declaration.kind !== 154 /* CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 229 /* TypeAliasDeclaration */) { + else if (declaration.kind === 230 /* TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(136 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(137 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -74952,7 +75322,7 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 261 /* EnumMember */) { + if (declaration.kind === 262 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -74964,7 +75334,7 @@ var ts; } if (symbolFlags & 8388608 /* Alias */) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 234 /* NamespaceExportDeclaration */) { + if (symbol.declarations[0].kind === 235 /* NamespaceExportDeclaration */) { displayParts.push(ts.keywordPart(83 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128 /* NamespaceKeyword */)); @@ -74975,7 +75345,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 235 /* ImportEqualsDeclaration */) { + if (declaration.kind === 236 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -75048,10 +75418,10 @@ var ts; // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 262 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 263 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 192 /* BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 193 /* BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -75132,16 +75502,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 184 /* FunctionExpression */) { + if (declaration.kind === 185 /* FunctionExpression */) { return true; } - if (declaration.kind !== 224 /* VariableDeclaration */ && declaration.kind !== 226 /* FunctionDeclaration */) { + if (declaration.kind !== 225 /* VariableDeclaration */ && declaration.kind !== 227 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { + for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent_21.kind === 262 /* SourceFile */ || parent_21.kind === 232 /* ModuleBlock */) { + if (parent.kind === 263 /* SourceFile */ || parent.kind === 233 /* ModuleBlock */) { return false; } } @@ -75194,7 +75564,7 @@ var ts; sourceFile.moduleName = transpileOptions.moduleName; } if (transpileOptions.renamedDependencies) { - sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies); + sourceFile.renamedDependencies = ts.createMapFromTemplate(transpileOptions.renamedDependencies); } var newLine = ts.getNewLineCharacter(options); // Output @@ -75249,10 +75619,10 @@ var ts; function fixupCompilerOptions(options, diagnostics) { // Lazily create this value to fix module loading errors. commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { - return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); + return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_3 = function (opt) { + var _loop_5 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -75263,7 +75633,7 @@ var ts; options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics); } else { - if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) { + if (!ts.forEachEntry(opt.type, function (v) { return v === value; })) { // Supplied value isn't a valid enum value. diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt)); } @@ -75271,7 +75641,7 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_3(opt); + _loop_5(opt); } return options; } @@ -75379,10 +75749,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 251 /* JsxAttribute */: - case 249 /* JsxOpeningElement */: - case 250 /* JsxClosingElement */: - case 248 /* JsxSelfClosingElement */: + case 252 /* JsxAttribute */: + case 250 /* JsxOpeningElement */: + case 251 /* JsxClosingElement */: + case 249 /* JsxSelfClosingElement */: return node.kind === 70 /* Identifier */; } } @@ -75794,7 +76164,7 @@ var ts; this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Space after }. - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromRange(0 /* FirstToken */, 140 /* LastToken */, [19 /* CloseParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromRange(0 /* FirstToken */, 141 /* LastToken */, [19 /* CloseParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, 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(17 /* CloseBraceToken */, 81 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 105 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); @@ -75859,7 +76229,7 @@ var ts; this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101 /* TryKeyword */, 86 /* FinallyKeyword */]), 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 133 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 134 /* SetKeyword */]), 70 /* 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.IsNonJsxSameLineTokenContext, 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.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); @@ -75870,8 +76240,8 @@ var ts; // 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([127 /* ModuleKeyword */, 131 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 130 /* ReadonlyKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */, 126 /* KeyOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 138 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 130 /* ReadonlyKeyword */, 134 /* SetKeyword */, 114 /* StaticKeyword */, 137 /* TypeKeyword */, 139 /* FromKeyword */, 126 /* KeyOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 139 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); // Lambda expressions @@ -75891,7 +76261,7 @@ var ts; // decorators this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 133 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 134 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115 /* YieldKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); @@ -76021,9 +76391,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_50 in o) { - if (o[name_50] === rule) { - return name_50; + for (var name in o) { + if (o[name] === rule) { + return name; } } throw new Error("Unknown rule"); @@ -76032,44 +76402,44 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 212 /* ForStatement */; + return context.contextNode.kind === 213 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 192 /* BinaryExpression */: - case 193 /* ConditionalExpression */: - case 200 /* AsExpression */: - case 244 /* ExportSpecifier */: - case 240 /* ImportSpecifier */: - case 156 /* TypePredicate */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 193 /* BinaryExpression */: + case 194 /* ConditionalExpression */: + case 201 /* AsExpression */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 157 /* TypePredicate */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 174 /* BindingElement */: + case 175 /* BindingElement */: // equals in type X = ... - case 229 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: // equal in p = 0; - case 144 /* Parameter */: - case 261 /* EnumMember */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 145 /* Parameter */: + case 262 /* EnumMember */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return context.currentTokenSpan.kind === 57 /* EqualsToken */ || context.nextTokenSpan.kind === 57 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: // "in" keyword in [P in keyof T]: T[P] - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return context.currentTokenSpan.kind === 91 /* InKeyword */ || context.nextTokenSpan.kind === 91 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 214 /* ForOfStatement */: - return context.currentTokenSpan.kind === 140 /* OfKeyword */ || context.nextTokenSpan.kind === 140 /* OfKeyword */; + case 215 /* ForOfStatement */: + return context.currentTokenSpan.kind === 141 /* OfKeyword */ || context.nextTokenSpan.kind === 141 /* OfKeyword */; } return false; }; @@ -76077,7 +76447,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 193 /* ConditionalExpression */; + return context.contextNode.kind === 194 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -76099,7 +76469,7 @@ var ts; return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; Rules.IsBraceWrappedContext = function (context) { - return context.contextNode.kind === 172 /* ObjectBindingPattern */ || Rules.IsSingleLineBlockContext(context); + return context.contextNode.kind === 173 /* ObjectBindingPattern */ || Rules.IsSingleLineBlockContext(context); }; // This check is done before an open brace in a control construct, a function, or a typescript block declaration Rules.IsBeforeMultilineBlockContext = function (context) { @@ -76124,70 +76494,70 @@ var ts; return true; } switch (node.kind) { - case 205 /* Block */: - case 233 /* CaseBlock */: - case 176 /* ObjectLiteralExpression */: - case 232 /* ModuleBlock */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 177 /* ObjectLiteralExpression */: + case 233 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: // case SyntaxKind.MethodSignature: - case 153 /* CallSignature */: - case 184 /* FunctionExpression */: - case 150 /* Constructor */: - case 185 /* ArrowFunction */: + case 154 /* CallSignature */: + case 185 /* FunctionExpression */: + case 151 /* Constructor */: + case 186 /* ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 228 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 226 /* FunctionDeclaration */ || context.contextNode.kind === 184 /* FunctionExpression */; + return context.contextNode.kind === 227 /* FunctionDeclaration */ || context.contextNode.kind === 185 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 161 /* TypeLiteral */: - case 231 /* ModuleDeclaration */: - case 242 /* ExportDeclaration */: - case 243 /* NamedExports */: - case 236 /* ImportDeclaration */: - case 239 /* NamedImports */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 162 /* TypeLiteral */: + case 232 /* ModuleDeclaration */: + case 243 /* ExportDeclaration */: + case 244 /* NamedExports */: + case 237 /* ImportDeclaration */: + case 240 /* NamedImports */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 227 /* ClassDeclaration */: - case 231 /* ModuleDeclaration */: - case 230 /* EnumDeclaration */: - case 257 /* CatchClause */: - case 232 /* ModuleBlock */: - case 219 /* SwitchStatement */: + case 228 /* ClassDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 258 /* CatchClause */: + case 233 /* ModuleBlock */: + case 220 /* SwitchStatement */: return true; - case 205 /* Block */: { + case 206 /* Block */: { var blockParent = context.currentTokenParent.parent; - if (blockParent.kind !== 185 /* ArrowFunction */ && - blockParent.kind !== 184 /* FunctionExpression */) { + if (blockParent.kind !== 186 /* ArrowFunction */ && + blockParent.kind !== 185 /* FunctionExpression */) { return true; } } @@ -76196,31 +76566,31 @@ var ts; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 209 /* IfStatement */: - case 219 /* SwitchStatement */: - case 212 /* ForStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 211 /* WhileStatement */: - case 222 /* TryStatement */: - case 210 /* DoStatement */: - case 218 /* WithStatement */: + case 210 /* IfStatement */: + case 220 /* SwitchStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 212 /* WhileStatement */: + case 223 /* TryStatement */: + case 211 /* DoStatement */: + case 219 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 257 /* CatchClause */: + case 258 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 176 /* ObjectLiteralExpression */; + return context.contextNode.kind === 177 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 179 /* CallExpression */; + return context.contextNode.kind === 180 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 180 /* NewExpression */; + return context.contextNode.kind === 181 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -76232,25 +76602,25 @@ var ts; return context.nextTokenSpan.kind !== 21 /* CloseBracketToken */; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 185 /* ArrowFunction */; + return context.contextNode.kind === 186 /* ArrowFunction */; }; Rules.IsNonJsxSameLineTokenContext = function (context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 247 /* JsxElement */; + return context.contextNode.kind !== 248 /* JsxElement */; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 253 /* JsxExpression */; + return context.contextNode.kind === 254 /* JsxExpression */; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 251 /* JsxAttribute */; + return context.nextTokenParent.kind === 252 /* JsxAttribute */; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 251 /* JsxAttribute */; + return context.contextNode.kind === 252 /* JsxAttribute */; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 248 /* JsxSelfClosingElement */; + return context.contextNode.kind === 249 /* JsxSelfClosingElement */; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -76265,42 +76635,42 @@ var ts; while (ts.isPartOfExpression(node)) { node = node.parent; } - return node.kind === 145 /* Decorator */; + return node.kind === 146 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 225 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 226 /* 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 === 231 /* ModuleDeclaration */; + return context.contextNode.kind === 232 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 161 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 162 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 26 /* LessThanToken */ && token.kind !== 28 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 157 /* TypeReference */: - case 182 /* TypeAssertionExpression */: - case 229 /* TypeAliasDeclaration */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 199 /* ExpressionWithTypeArguments */: + case 158 /* TypeReference */: + case 183 /* TypeAssertionExpression */: + case 230 /* TypeAliasDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 200 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -76311,16 +76681,16 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 182 /* TypeAssertionExpression */; + return context.contextNode.kind === 183 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 188 /* VoidExpression */; + return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 189 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 195 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 196 /* YieldExpression */ && context.contextNode.expression !== undefined; }; Rules.IsNonNullAssertionContext = function (context) { - return context.contextNode.kind === 201 /* NonNullExpression */; + return context.contextNode.kind === 202 /* NonNullExpression */; }; return Rules; }()); @@ -76344,7 +76714,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 140 /* LastToken */ + 1; + this.mapRowLength = 141 /* 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); @@ -76358,7 +76728,7 @@ var ts; }); }; RulesMap.prototype.GetRuleBucketIndex = function (row, column) { - ts.Debug.assert(row <= 140 /* LastKeyword */ && column <= 140 /* LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 141 /* LastKeyword */ && column <= 141 /* LastKeyword */, "Must compute formatting context from tokens"); var rulesBucketIndex = (row * this.mapRowLength) + column; return rulesBucketIndex; }; @@ -76539,7 +76909,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 140 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 141 /* LastToken */; token++) { result.push(token); } return result; @@ -76583,9 +76953,9 @@ var ts; }()); TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 140 /* LastKeyword */); + TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 141 /* LastKeyword */); TokenRange.BinaryOperators = TokenRange.FromRange(26 /* FirstBinaryOperator */, 69 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 140 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 141 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42 /* PlusPlusToken */, 43 /* MinusMinusToken */, 51 /* TildeToken */, 50 /* ExclamationToken */]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 70 /* Identifier */, 18 /* OpenParenToken */, 20 /* OpenBracketToken */, 16 /* OpenBraceToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); @@ -76593,7 +76963,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 19 /* CloseParenToken */, 21 /* CloseBracketToken */, 93 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 134 /* StringKeyword */, 121 /* BooleanKeyword */, 135 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 135 /* StringKeyword */, 121 /* BooleanKeyword */, 136 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -76864,17 +77234,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 227 /* ClassDeclaration */: - case 228 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 232 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 262 /* SourceFile */: - case 205 /* Block */: - case 232 /* ModuleBlock */: + return body && body.kind === 233 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 263 /* SourceFile */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -77079,20 +77449,20 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 227 /* ClassDeclaration */: return 74 /* ClassKeyword */; - case 228 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; - case 226 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; - case 230 /* EnumDeclaration */: return 230 /* EnumDeclaration */; - case 151 /* GetAccessor */: return 124 /* GetKeyword */; - case 152 /* SetAccessor */: return 133 /* SetKeyword */; - case 149 /* MethodDeclaration */: + case 228 /* ClassDeclaration */: return 74 /* ClassKeyword */; + case 229 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; + case 227 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; + case 231 /* EnumDeclaration */: return 231 /* EnumDeclaration */; + case 152 /* GetAccessor */: return 124 /* GetKeyword */; + case 153 /* SetAccessor */: return 134 /* SetKeyword */; + case 150 /* MethodDeclaration */: if (node.asteriskToken) { return 38 /* AsteriskToken */; } /* fall-through */ - case 147 /* PropertyDeclaration */: - case 144 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 145 /* Parameter */: return node.name.kind; } } @@ -77130,16 +77500,16 @@ var ts; return indentation; case 40 /* SlashToken */: case 28 /* GreaterThanToken */: { - if (container.kind === 249 /* JsxOpeningElement */ || - container.kind === 250 /* JsxClosingElement */ || - container.kind === 248 /* JsxSelfClosingElement */) { + if (container.kind === 250 /* JsxOpeningElement */ || + container.kind === 251 /* JsxClosingElement */ || + container.kind === 249 /* JsxSelfClosingElement */) { return indentation; } break; } case 20 /* OpenBracketToken */: case 21 /* CloseBracketToken */: { - if (container.kind !== 170 /* MappedType */) { + if (container.kind !== 171 /* MappedType */) { return indentation; } break; @@ -77249,11 +77619,11 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 145 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 146 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 175 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + if (isFirstListItem && parent.kind === 176 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -77610,12 +77980,12 @@ var ts; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 150 /* Constructor */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 185 /* ArrowFunction */: + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 186 /* ArrowFunction */: if (node.typeParameters === list) { return 26 /* LessThanToken */; } @@ -77623,8 +77993,8 @@ var ts; return 18 /* OpenParenToken */; } break; - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: if (node.typeArguments === list) { return 26 /* LessThanToken */; } @@ -77632,7 +78002,7 @@ var ts; return 18 /* OpenParenToken */; } break; - case 157 /* TypeReference */: + case 158 /* TypeReference */: if (node.typeArguments === list) { return 26 /* LessThanToken */; } @@ -77748,7 +78118,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 192 /* BinaryExpression */) { + if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 193 /* 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 */) { @@ -77871,7 +78241,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.isStatementButNotDeclaration(current)) && - (parent.kind === 262 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 263 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -77904,7 +78274,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 209 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 210 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -77916,23 +78286,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 157 /* TypeReference */: + case 158 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return node.parent.properties; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return node.parent.elements; - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: { + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -77943,8 +78313,8 @@ var ts; } break; } - case 180 /* NewExpression */: - case 179 /* CallExpression */: { + case 181 /* NewExpression */: + case 180 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -77974,8 +78344,8 @@ var ts; if (node.kind === 19 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 179 /* CallExpression */ || - node.parent.kind === 180 /* NewExpression */) && + if (node.parent && (node.parent.kind === 180 /* CallExpression */ || + node.parent.kind === 181 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -77993,10 +78363,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: node = node.expression; break; default: @@ -78060,49 +78430,49 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 208 /* ExpressionStatement */: - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 230 /* EnumDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 175 /* ArrayLiteralExpression */: - case 205 /* Block */: - case 232 /* ModuleBlock */: - case 176 /* ObjectLiteralExpression */: - case 161 /* TypeLiteral */: - case 170 /* MappedType */: - case 163 /* TupleType */: - case 233 /* CaseBlock */: - case 255 /* DefaultClause */: - case 254 /* CaseClause */: - case 183 /* ParenthesizedExpression */: - case 177 /* PropertyAccessExpression */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 206 /* VariableStatement */: - case 224 /* VariableDeclaration */: - case 241 /* ExportAssignment */: - case 217 /* ReturnStatement */: - case 193 /* ConditionalExpression */: - case 173 /* ArrayBindingPattern */: - case 172 /* ObjectBindingPattern */: - case 249 /* JsxOpeningElement */: - case 248 /* JsxSelfClosingElement */: - case 253 /* JsxExpression */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 144 /* Parameter */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 166 /* ParenthesizedType */: - case 181 /* TaggedTemplateExpression */: - case 189 /* AwaitExpression */: - case 243 /* NamedExports */: - case 239 /* NamedImports */: - case 244 /* ExportSpecifier */: - case 240 /* ImportSpecifier */: + case 209 /* ExpressionStatement */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 176 /* ArrayLiteralExpression */: + case 206 /* Block */: + case 233 /* ModuleBlock */: + case 177 /* ObjectLiteralExpression */: + case 162 /* TypeLiteral */: + case 171 /* MappedType */: + case 164 /* TupleType */: + case 234 /* CaseBlock */: + case 256 /* DefaultClause */: + case 255 /* CaseClause */: + case 184 /* ParenthesizedExpression */: + case 178 /* PropertyAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 207 /* VariableStatement */: + case 225 /* VariableDeclaration */: + case 242 /* ExportAssignment */: + case 218 /* ReturnStatement */: + case 194 /* ConditionalExpression */: + case 174 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 250 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 254 /* JsxExpression */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 145 /* Parameter */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 167 /* ParenthesizedType */: + case 182 /* TaggedTemplateExpression */: + case 190 /* AwaitExpression */: + case 244 /* NamedExports */: + case 240 /* NamedImports */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: return true; } return false; @@ -78111,27 +78481,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 210 /* DoStatement */: - case 211 /* WhileStatement */: - case 213 /* ForInStatement */: - case 214 /* ForOfStatement */: - case 212 /* ForStatement */: - case 209 /* IfStatement */: - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 185 /* ArrowFunction */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - return childKind !== 205 /* Block */; - case 242 /* ExportDeclaration */: - return childKind !== 243 /* NamedExports */; - case 236 /* ImportDeclaration */: - return childKind !== 237 /* ImportClause */ || - (child.namedBindings && child.namedBindings.kind !== 239 /* NamedImports */); - case 247 /* JsxElement */: - return childKind !== 250 /* JsxClosingElement */; + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 213 /* ForStatement */: + case 210 /* IfStatement */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 186 /* ArrowFunction */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return childKind !== 206 /* Block */; + case 243 /* ExportDeclaration */: + return childKind !== 244 /* NamedExports */; + case 237 /* ImportDeclaration */: + return childKind !== 238 /* ImportClause */ || + (child.namedBindings && child.namedBindings.kind !== 240 /* NamedImports */); + case 248 /* JsxElement */: + return childKind !== 251 /* JsxClosingElement */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -78152,7 +78522,7 @@ var ts; (function (ts) { var codefix; (function (codefix) { - var codeFixes = ts.createMap(); + var codeFixes = []; function registerCodeFix(action) { ts.forEach(action.errorCodes, function (error) { var fixes = codeFixes[error]; @@ -78228,9 +78598,9 @@ var ts; if (IndexInfoOfKind) { var writer = ts.getSingleLineStringWriter(); checker.getSymbolDisplayBuilder().buildIndexSignatureDisplay(IndexInfoOfKind, writer, kind, enclosingDeclaration); - var result_7 = writer.string(); + var result_6 = writer.string(); ts.releaseStringWriter(writer); - return result_7; + return result_6; } } return ""; @@ -78324,7 +78694,7 @@ var ts; } // figure out if the this access is actuall inside the supercall // i.e. super(this.a), since in that case we won't suggest a fix - if (superCall.expression && superCall.expression.kind == 179 /* CallExpression */) { + if (superCall.expression && superCall.expression.kind == 180 /* CallExpression */) { var arguments_1 = superCall.expression.arguments; for (var i = 0; i < arguments_1.length; i++) { if (arguments_1[i].expression === token) { @@ -78348,7 +78718,7 @@ var ts; changes: changes }]; function findSuperCall(n) { - if (n.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { + if (n.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -78431,6 +78801,25 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + var start = token.getStart(sourceFile); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_this_to_unresolved_variable), + changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "this.", span: { start: start, length: 0 } }] }] + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -78450,9 +78839,9 @@ var ts; switch (token.kind) { case 70 /* Identifier */: switch (token.parent.kind) { - case 224 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: switch (token.parent.parent.parent.kind) { - case 212 /* ForStatement */: + case 213 /* ForStatement */: var forStatement = token.parent.parent.parent; var forInitializer = forStatement.initializer; if (forInitializer.declarations.length === 1) { @@ -78461,18 +78850,18 @@ var ts; else { return removeSingleItem(forInitializer.declarations, token); } - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 225 /* VariableDeclarationList */) { + if (forOfStatement.initializer.kind === 226 /* VariableDeclarationList */) { var forOfInitializer = forOfStatement.initializer; return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); } break; - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: // There is no valid fix in the case of: // for .. in return undefined; - case 257 /* CatchClause */: + case 258 /* CatchClause */: var catchClause = token.parent.parent; var parameter = catchClause.variableDeclaration.getChildren()[0]; return createCodeFix("", parameter.pos, parameter.end - parameter.pos); @@ -78486,7 +78875,7 @@ var ts; return removeSingleItem(declarations, token); } } - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: var typeParameters = token.parent.parent.typeParameters; if (typeParameters.length === 1) { return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); @@ -78494,7 +78883,7 @@ var ts; else { return removeSingleItem(typeParameters, token); } - case 144 /* Parameter */: + case 145 /* Parameter */: var functionDeclaration = token.parent.parent; if (functionDeclaration.parameters.length === 1) { return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); @@ -78503,10 +78892,10 @@ var ts; return removeSingleItem(functionDeclaration.parameters, token); } // handle case where 'import a = A;' - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: var importEquals = findImportDeclaration(token); return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 240 /* ImportSpecifier */: + case 241 /* ImportSpecifier */: var namedImports = token.parent.parent; if (namedImports.elements.length === 1) { // Only 1 import and it is unused. So the entire declaration should be removed. @@ -78518,7 +78907,7 @@ var ts; } // handle case where "import d, * as ns from './file'" // or "'import {a, b as ns} from './file'" - case 237 /* ImportClause */: + case 238 /* ImportClause */: var importClause = token.parent; if (!importClause.namedBindings) { var importDecl = findImportDeclaration(importClause); @@ -78527,7 +78916,7 @@ var ts; else { return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); } - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: var namespaceImport = token.parent; if (namespaceImport.name == token && !namespaceImport.parent.name) { var importDecl = findImportDeclaration(namespaceImport); @@ -78539,9 +78928,9 @@ var ts; } } break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 238 /* NamespaceImport */: + case 239 /* NamespaceImport */: return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); } if (ts.isDeclarationName(token)) { @@ -78555,14 +78944,14 @@ var ts; } function findImportDeclaration(token) { var importDecl = token; - while (importDecl.kind != 236 /* ImportDeclaration */ && importDecl.parent) { + while (importDecl.kind != 237 /* ImportDeclaration */ && importDecl.parent) { importDecl = importDecl.parent; } return importDecl; } function createCodeFix(newText, start, length) { return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_declaration_for_Colon_0), { 0: token.getText() }), changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: newText, span: { start: start, length: length } }] @@ -78594,18 +78983,19 @@ var ts; })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); var ImportCodeActionMap = (function () { function ImportCodeActionMap() { - this.symbolIdToActionMap = ts.createMap(); + this.symbolIdToActionMap = []; } ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { if (!newAction) { return; } - if (!this.symbolIdToActionMap[symbolId]) { + var actions = this.symbolIdToActionMap[symbolId]; + if (!actions) { this.symbolIdToActionMap[symbolId] = [newAction]; return; } if (newAction.kind === "CodeChange") { - this.symbolIdToActionMap[symbolId].push(newAction); + actions.push(newAction); return; } var updatedNewImports = []; @@ -78649,8 +79039,8 @@ var ts; }; ImportCodeActionMap.prototype.getAllActions = function () { var result = []; - for (var symbolId in this.symbolIdToActionMap) { - result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + for (var key in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[key]); } return result; }; @@ -78695,7 +79085,7 @@ var ts; var name = token.getText(); var symbolIdActionMap = new ImportCodeActionMap(); // this is a module id -> module import declaration map - var cachedImportDeclarations = ts.createMap(); + var cachedImportDeclarations = []; var cachedNewImportInsertPosition; var currentTokenMeaning = ts.getMeaningFromLocation(token); if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -78732,8 +79122,9 @@ var ts; return symbolIdActionMap.getAllActions(); function getImportDeclarations(moduleSymbol) { var moduleSymbolId = getUniqueSymbolId(moduleSymbol); - if (cachedImportDeclarations[moduleSymbolId]) { - return cachedImportDeclarations[moduleSymbolId]; + var cached = cachedImportDeclarations[moduleSymbolId]; + if (cached) { + return cached; } var existingDeclarations = []; for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { @@ -78748,10 +79139,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 236 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { return node; } - if (node.kind === 235 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } node = node.parent; @@ -78797,9 +79188,9 @@ var ts; var existingModuleSpecifier; for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { var declaration = declarations_11[_i]; - if (declaration.kind === 236 /* ImportDeclaration */) { + if (declaration.kind === 237 /* ImportDeclaration */) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 238 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 239 /* NamespaceImport */) { // case: // import * as ns from "foo" namespaceImportDeclaration = declaration; @@ -78839,7 +79230,7 @@ var ts; } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 246 /* ExternalModuleReference */) { + if (declaration.moduleReference && declaration.moduleReference.kind === 247 /* ExternalModuleReference */) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); @@ -78887,7 +79278,7 @@ var ts; } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 236 /* ImportDeclaration */) { + if (declaration.kind === 237 /* ImportDeclaration */) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { @@ -78940,13 +79331,13 @@ var ts; var sourceDirectory = ts.getDirectoryPath(fileName); var options = context.program.getCompilerOptions(); return tryGetModuleNameFromAmbientModule() || - tryGetModuleNameFromBaseUrl() || - tryGetModuleNameFromRootDirs() || tryGetModuleNameFromTypeRoots() || tryGetModuleNameAsNodeModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 262 /* SourceFile */) { + if (moduleSymbol.valueDeclaration.kind !== 263 /* SourceFile */) { return moduleSymbol.name; } } @@ -79109,7 +79500,7 @@ var ts; */ function getMissingMembersInsertion(classDeclaration, possiblyMissingSymbols, checker, newlineChar) { var classMembers = classDeclaration.symbol.members; - var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !(symbol.getName() in classMembers); }); + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !classMembers.has(symbol.getName()); }); var insertion = ""; for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { var symbol = missingMembers_1[_i]; @@ -79132,14 +79523,14 @@ var ts; var name = declaration.name ? declaration.name.getText() : undefined; var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration)); switch (declaration.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 146 /* PropertySignature */: - case 147 /* PropertyDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 147 /* PropertySignature */: + case 148 /* PropertyDeclaration */: var typeString = checker.typeToString(type, enclosingDeclaration, 0 /* None */); return "" + visibility + name + ": " + typeString + ";" + newlineChar; - case 148 /* MethodSignature */: - case 149 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 150 /* MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -79179,7 +79570,7 @@ var ts; } } function createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker) { - var newSignatureDeclaration = ts.createNode(153 /* CallSignature */); + var newSignatureDeclaration = ts.createNode(154 /* CallSignature */); newSignatureDeclaration.parent = enclosingDeclaration; newSignatureDeclaration.name = signatures[0].getDeclaration().name; var maxNonRestArgs = -1; @@ -79210,7 +79601,7 @@ var ts; } return checker.getSignatureFromDeclaration(newSignatureDeclaration); function createParameterDeclarationWithoutType(index, minArgCount, enclosingSignatureDeclaration) { - var newParameter = ts.createNode(144 /* Parameter */); + var newParameter = ts.createNode(145 /* Parameter */); newParameter.symbol = new SymbolConstructor(1 /* FunctionScopedVariable */, maxArgsParameterSymbolNames[index] || "rest"); newParameter.symbol.valueDeclaration = newParameter; newParameter.symbol.declarations = [newParameter]; @@ -79241,6 +79632,7 @@ var ts; /// /// /// +/// /// /// /// @@ -79276,7 +79668,7 @@ var ts; /** The version of the language service API */ ts.servicesVersion = "0.5"; function createNode(kind, pos, end, parent) { - var node = kind >= 141 /* FirstNode */ ? new NodeObject(kind, pos, end) : + var node = kind >= 142 /* FirstNode */ ? new NodeObject(kind, pos, end) : kind === 70 /* Identifier */ ? new IdentifierObject(70 /* Identifier */, pos, end) : new TokenObject(kind, pos, end); node.parent = parent; @@ -79334,7 +79726,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(293 /* SyntaxList */, nodes.pos, nodes.end, this); + var list = createNode(294 /* SyntaxList */, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -79353,11 +79745,11 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 141 /* FirstNode */) { + if (this.kind >= 142 /* FirstNode */) { ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 279 /* FirstJSDocTagNode */ && this.kind <= 292 /* LastJSDocTagNode */; + var useJSDocScanner_1 = this.kind >= 280 /* FirstJSDocTagNode */ && this.kind <= 293 /* LastJSDocTagNode */; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -79414,8 +79806,10 @@ var ts; if (!children.length) { return undefined; } - var child = children[0]; - return child.kind < 141 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + var child = ts.find(children, function (kid) { return kid.kind < 264 /* FirstJSDocNode */ || kid.kind > 293 /* LastJSDocNode */; }); + return child.kind < 142 /* FirstNode */ ? + child : + child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -79423,7 +79817,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 141 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 142 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; return NodeObject; }()); @@ -79622,27 +80016,31 @@ var ts; return this.namedDeclarations; }; SourceFileObject.prototype.computeNamedDeclarations = function () { - var result = ts.createMap(); + var result = ts.createMultiMap(); ts.forEachChild(this, visit); return result; function addDeclaration(declaration) { var name = getDeclarationName(declaration); if (name) { - ts.multiMapAdd(result, name, declaration); + result.add(name, declaration); } } function getDeclarations(name) { - return result[name] || (result[name] = []); + var declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; } function getDeclarationName(declaration) { if (declaration.name) { - var result_8 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_8 !== undefined) { - return result_8; + var result_7 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_7 !== undefined) { + return result_7; } - if (declaration.name.kind === 142 /* ComputedPropertyName */) { + if (declaration.name.kind === 143 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 177 /* PropertyAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -79662,10 +80060,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 226 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -79685,32 +80083,32 @@ var ts; } ts.forEachChild(node, visit); break; - case 227 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: - case 230 /* EnumDeclaration */: - case 231 /* ModuleDeclaration */: - case 235 /* ImportEqualsDeclaration */: - case 244 /* ExportSpecifier */: - case 240 /* ImportSpecifier */: - case 235 /* ImportEqualsDeclaration */: - case 237 /* ImportClause */: - case 238 /* NamespaceImport */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 161 /* TypeLiteral */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 162 /* TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 144 /* Parameter */: + case 145 /* Parameter */: // Only consider parameter properties if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) { break; } // fall through - case 224 /* VariableDeclaration */: - case 174 /* BindingElement */: { + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -79719,19 +80117,19 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 261 /* EnumMember */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 262 /* EnumMember */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: addDeclaration(node); break; - case 242 /* ExportDeclaration */: + case 243 /* 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 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -79743,7 +80141,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 238 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 239 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -80273,10 +80671,10 @@ var ts; // Try getting just type at this position and show switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: case 98 /* ThisKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: case 96 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); @@ -80318,10 +80716,10 @@ var ts; function getOccurrencesAtPosition(fileName, position) { var results = getOccurrencesAtPositionCore(fileName, position); if (results) { - var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); + var sourceFile_1 = getCanonicalFileName(ts.normalizeSlashes(fileName)); // 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_2; }); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_1; }); } return results; } @@ -80356,21 +80754,21 @@ var ts; } } function findRenameLocations(fileName, position, findInStrings, findInComments) { - var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments); + var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments, /*isForRename*/ true); return ts.FindAllReferences.convertReferences(referencedSymbols); } function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false, /*isForRename*/ false); return ts.FindAllReferences.convertReferences(referencedSymbols); } function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false, /*isForRename*/ false); // Only include referenced symbols that have a valid definition. return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); } - function findReferencedSymbols(fileName, position, findInStrings, findInComments) { + function findReferencedSymbols(fileName, position, findInStrings, findInComments, isForRename) { synchronizeHostData(); - return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments); + return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments, isForRename); } /// NavigateTo function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { @@ -80419,15 +80817,15 @@ var ts; return; } switch (node.kind) { - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: case 9 /* StringLiteral */: case 85 /* FalseKeyword */: case 100 /* TrueKeyword */: case 94 /* NullKeyword */: case 96 /* SuperKeyword */: case 98 /* ThisKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: case 70 /* Identifier */: break; // Cant create the text span @@ -80444,7 +80842,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 231 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 232 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -80821,7 +81219,7 @@ var ts; function walk(node) { switch (node.kind) { case 70 /* Identifier */: - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); break; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -80830,10 +81228,10 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 246 /* ExternalModuleReference */ || + node.parent.kind === 247 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); } break; default: @@ -80846,11 +81244,14 @@ var ts; } } } + function setNameTable(text, node) { + nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); + } } function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 178 /* ElementAccessExpression */ && + node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -80934,113 +81335,113 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 206 /* VariableStatement */: + case 207 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 224 /* VariableDeclaration */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 225 /* VariableDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return spanInVariableDeclaration(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return spanInParameterDeclaration(node); - case 226 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 205 /* Block */: + case 206 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: return spanInBlock(node); - case 257 /* CatchClause */: + case 258 /* CatchClause */: return spanInBlock(node.block); - case 208 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 217 /* ReturnStatement */: + case 218 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 211 /* WhileStatement */: + case 212 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 210 /* DoStatement */: + case 211 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 223 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 209 /* IfStatement */: + case 210 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 220 /* LabeledStatement */: + case 221 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 216 /* BreakStatement */: - case 215 /* ContinueStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 212 /* ForStatement */: + case 213 /* ForStatement */: return spanInForStatement(node); - case 213 /* ForInStatement */: + case 214 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 214 /* ForOfStatement */: + case 215 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 219 /* SwitchStatement */: + case 220 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 254 /* CaseClause */: - case 255 /* DefaultClause */: + case 255 /* CaseClause */: + case 256 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 222 /* TryStatement */: + case 223 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 221 /* ThrowStatement */: + case 222 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 241 /* ExportAssignment */: + case 242 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 236 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 242 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 227 /* ClassDeclaration */: - case 230 /* EnumDeclaration */: - case 261 /* EnumMember */: - case 174 /* BindingElement */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 262 /* EnumMember */: + case 175 /* BindingElement */: // span on complete node return textSpan(node); - case 218 /* WithStatement */: + case 219 /* WithStatement */: // span in statement return spanInNode(node.statement); - case 145 /* Decorator */: + case 146 /* Decorator */: return spanInNodeArray(node.parent.decorators); - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 228 /* InterfaceDeclaration */: - case 229 /* TypeAliasDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: return undefined; // Tokens: case 24 /* SemicolonToken */: @@ -81070,7 +81471,7 @@ var ts; case 73 /* CatchKeyword */: case 86 /* FinallyKeyword */: return spanInNextNode(node); - case 140 /* OfKeyword */: + case 141 /* OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -81083,13 +81484,13 @@ var ts; // a or ...c or d: x from // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern if ((node.kind === 70 /* Identifier */ || - node.kind == 196 /* SpreadElement */ || - node.kind === 258 /* PropertyAssignment */ || - node.kind === 259 /* ShorthandPropertyAssignment */) && + node.kind == 197 /* SpreadElement */ || + node.kind === 259 /* PropertyAssignment */ || + node.kind === 260 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 192 /* BinaryExpression */) { + if (node.kind === 193 /* BinaryExpression */) { var binaryExpression = node; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -81112,22 +81513,22 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 210 /* DoStatement */: + case 211 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 145 /* Decorator */: + case 146 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 212 /* ForStatement */: - case 214 /* ForOfStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: return textSpan(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: if (node.parent.operatorToken.kind === 25 /* CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -81136,13 +81537,13 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 258 /* PropertyAssignment */ && + if (node.parent.kind === 259 /* PropertyAssignment */ && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 182 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 183 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNextNode(node.parent.type); } // return type of function go to previous token @@ -81150,8 +81551,8 @@ var ts; return spanInPreviousNode(node); } // initializer of variable/parameter declaration go to previous node - if ((node.parent.kind === 224 /* VariableDeclaration */ || - node.parent.kind === 144 /* Parameter */)) { + if ((node.parent.kind === 225 /* VariableDeclaration */ || + node.parent.kind === 145 /* Parameter */)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -81159,7 +81560,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 192 /* BinaryExpression */) { + if (node.parent.kind === 193 /* BinaryExpression */) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -81185,7 +81586,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 213 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 214 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern, set breakpoint in binding pattern @@ -81196,7 +81597,7 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1 /* Export */) || - variableDeclaration.parent.parent.kind === 214 /* ForOfStatement */) { + variableDeclaration.parent.parent.kind === 215 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -81236,7 +81637,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1 /* Export */) || - (functionDeclaration.parent.kind === 227 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */); + (functionDeclaration.parent.kind === 228 /* ClassDeclaration */ && functionDeclaration.kind !== 151 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -81259,25 +81660,25 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 231 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 211 /* WhileStatement */: - case 209 /* IfStatement */: - case 213 /* ForInStatement */: + case 212 /* WhileStatement */: + case 210 /* IfStatement */: + case 214 /* ForInStatement */: 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 212 /* ForStatement */: - case 214 /* ForOfStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 225 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 226 /* VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -81302,23 +81703,23 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 199 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 174 /* BindingElement */) { + if (bindingPattern.parent.kind === 175 /* BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 173 /* ArrayBindingPattern */ && node.kind !== 172 /* ObjectBindingPattern */); - var elements = node.kind === 175 /* ArrayLiteralExpression */ ? + ts.Debug.assert(node.kind !== 174 /* ArrayBindingPattern */ && node.kind !== 173 /* ObjectBindingPattern */); + var elements = node.kind === 176 /* ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 199 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -81326,18 +81727,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 192 /* BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 193 /* BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 230 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 227 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -81345,24 +81746,24 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 232 /* ModuleBlock */: + case 233 /* ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 230 /* EnumDeclaration */: - case 227 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 205 /* Block */: + case 206 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through - case 257 /* CatchClause */: + case 258 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 233 /* CaseBlock */: + case 234 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -81370,7 +81771,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -81386,7 +81787,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -81401,12 +81802,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 210 /* DoStatement */ || - node.parent.kind === 179 /* CallExpression */ || - node.parent.kind === 180 /* NewExpression */) { + if (node.parent.kind === 211 /* DoStatement */ || + node.parent.kind === 180 /* CallExpression */ || + node.parent.kind === 181 /* NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 183 /* ParenthesizedExpression */) { + if (node.parent.kind === 184 /* ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -81415,21 +81816,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 184 /* FunctionExpression */: - case 226 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 211 /* WhileStatement */: - case 210 /* DoStatement */: - case 212 /* ForStatement */: - case 214 /* ForOfStatement */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 183 /* ParenthesizedExpression */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 212 /* WhileStatement */: + case 211 /* DoStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 184 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -81439,20 +81840,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 258 /* PropertyAssignment */ || - node.parent.kind === 144 /* Parameter */) { + node.parent.kind === 259 /* PropertyAssignment */ || + node.parent.kind === 145 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 182 /* TypeAssertionExpression */) { + if (node.parent.kind === 183 /* TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 210 /* DoStatement */) { + if (node.parent.kind === 211 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -81460,7 +81861,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 214 /* ForOfStatement */) { + if (node.parent.kind === 215 /* ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -81591,7 +81992,10 @@ var ts; if (settingsJson == null || settingsJson == "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); } - return JSON.parse(settingsJson); + var compilerOptions = JSON.parse(settingsJson); + // permit language service to handle all files (filtering should be performed on the host side) + compilerOptions.allowNonTsExtensions = true; + return compilerOptions; }; LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { var encoded = this.shimHost.getScriptFileNames(); @@ -82099,12 +82503,6 @@ var ts; var compilerOptions = JSON.parse(compilerOptionsJson); var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; - if (resolvedFileName && !compilerOptions.allowJs && ts.fileExtensionIs(resolvedFileName, ".js")) { - return { - resolvedFileName: undefined, - failedLookupLocations: [] - }; - } return { resolvedFileName: resolvedFileName, failedLookupLocations: result.failedLookupLocations diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 47b04ae9e58f8..1b235441f9f10 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -98,32 +98,32 @@ var ts; var measures; function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } performance.mark = mark; function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; function enable() { @@ -145,19 +145,93 @@ var ts; ts.version = "2.2.0"; })(ts || (ts = {})); (function (ts) { - var createObject = Object.create; - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + function createDictionaryObject() { + var map = Object.create(null); map["__"] = undefined; delete map["__"]; + return map; + } + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -170,32 +244,27 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -209,6 +278,10 @@ var ts; return getCanonicalFileName(nonCanonicalizedPath); } ts.toPath = toPath; + function length(array) { + return array ? array.length : 0; + } + ts.length = length; function forEach(array, callback) { if (array) { for (var i = 0; i < array.length; i++) { @@ -249,6 +322,15 @@ var ts; return undefined; } ts.find = find; + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; function findMap(array, callback) { for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); @@ -470,21 +552,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -768,38 +847,46 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + function arrayFrom(iterator) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + ts.arrayFrom = arrayFrom; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } } - return false; + return undefined; + var _b; } - ts.someProperties = someProperties; - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; + ts.forEachEntry = forEachEntry; + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } } + return undefined; + var _b; } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachKey = forEachKey; + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); } - ts.appendProperty = appendProperty; + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -815,14 +902,6 @@ var ts; return t; } ts.assign = assign; - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -847,23 +926,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -890,27 +960,32 @@ var ts; return result; } ts.extend = extend; - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; function isArray(value) { return Array.isArray ? Array.isArray(value) : value instanceof Array; } @@ -1088,8 +1163,10 @@ var ts; if (b === undefined) return 1; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); return result < 0 ? -1 : result > 0 ? 1 : 0; } a = a.toUpperCase(); @@ -1471,36 +1548,26 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } var replaceWildcardCharacter = usage === "files" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther; var singleAsteriskRegexFragment = usage === "files" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther; var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; function isImplicitGlob(lastPathComponent) { return !/[.*?]/.test(lastPathComponent); } @@ -1570,6 +1637,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -1582,34 +1650,48 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } + } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -1625,14 +1707,14 @@ var ts; includeBasePaths.push(getIncludeBasePath(absolute)); } includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } }; for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -2079,32 +2161,32 @@ var ts; var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; function createWatchedFileSet() { var dirWatchers = ts.createMap(); - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -2116,16 +2198,19 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { var fileName = typeof relativeFileName !== "string" ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } @@ -2190,10 +2275,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -2870,6 +2955,7 @@ var ts; Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2880,6 +2966,7 @@ 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_2607", message: "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_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other 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_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -2928,6 +3015,7 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, @@ -3052,7 +3140,7 @@ var ts; Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'" }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -3067,6 +3155,7 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, @@ -3100,7 +3189,7 @@ var ts; Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'" }, File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, @@ -3234,9 +3323,10 @@ var ts; Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: {0}" }, Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, @@ -3252,7 +3342,7 @@ var ts; return token >= 70; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ + var textToToken = ts.createMapFromTemplate({ "abstract": 116, "any": 118, "as": 117, @@ -3276,7 +3366,7 @@ var ts; "false": 85, "finally": 86, "for": 87, - "from": 138, + "from": 139, "function": 88, "get": 124, "if": 89, @@ -3294,27 +3384,28 @@ var ts; "new": 93, "null": 94, "number": 132, + "object": 133, "package": 110, "private": 111, "protected": 112, "public": 113, "readonly": 130, "require": 131, - "global": 139, + "global": 140, "return": 95, - "set": 133, + "set": 134, "static": 114, - "string": 134, + "string": 135, "super": 96, "switch": 97, - "symbol": 135, + "symbol": 136, "this": 98, "throw": 99, "true": 100, "try": 101, - "type": 136, + "type": 137, "typeof": 102, - "undefined": 137, + "undefined": 138, "var": 103, "void": 104, "while": 105, @@ -3322,7 +3413,7 @@ var ts; "yield": 115, "async": 119, "await": 120, - "of": 140, + "of": 141, "{": 16, "}": 17, "(": 18, @@ -3417,9 +3508,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; - } + source.forEach(function (value, name) { + result[value] = name; + }); return result; } var tokenStrings = makeReverseMap(textToToken); @@ -3428,7 +3519,7 @@ var ts; } ts.tokenToString = tokenToString; function stringToToken(s) { - return textToToken[s]; + return textToToken.get(s); } ts.stringToToken = stringToToken; function computeLineStarts(text) { @@ -3488,7 +3579,6 @@ var ts; return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -4147,8 +4237,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= 97 && ch <= 122) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = 70; @@ -4858,12 +4951,13 @@ var ts; }, { name: "jsx", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "preserve": 1, + "react-native": 3, "react": 2 }), paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, }, { name: "reactNamespace", @@ -4893,7 +4987,7 @@ var ts; { name: "module", shortName: "m", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "none": ts.ModuleKind.None, "commonjs": ts.ModuleKind.CommonJS, "amd": ts.ModuleKind.AMD, @@ -4907,7 +5001,7 @@ var ts; }, { name: "newLine", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "crlf": 0, "lf": 1 }), @@ -5004,8 +5098,8 @@ var ts; shortName: "p", type: "string", isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY }, { name: "removeComments", @@ -5055,7 +5149,7 @@ var ts; { name: "target", shortName: "t", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es3": 0, "es5": 1, "es6": 2, @@ -5092,7 +5186,7 @@ var ts; }, { name: "moduleResolution", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "node": ts.ModuleResolutionKind.NodeJs, "classic": ts.ModuleResolutionKind.Classic, }), @@ -5197,7 +5291,7 @@ var ts; type: "list", element: { name: "lib", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es5": "lib.es5.d.ts", "es6": "lib.es2015.d.ts", "es2015": "lib.es2015.d.ts", @@ -5297,9 +5391,9 @@ var ts; var optionNameMap = ts.createMap(); var shortOptionNames = ts.createMap(); ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; @@ -5307,7 +5401,7 @@ var ts; } ts.getOptionNameMap = getOptionNameMap; function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; @@ -5356,11 +5450,12 @@ var ts; } else if (s.charCodeAt(0) === 45) { s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); - if (s in shortOptionNames) { - s = shortOptionNames[s]; + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - var opt = optionNameMap[s]; + var opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -5486,19 +5581,18 @@ var ts; } } function getNameOfCompilerOptionValue(value, customTypeMap) { - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { return key; } - } - return undefined; + }); } function serializeCompilerOptions(options) { - var result = ts.createMap(); + var result = {}; var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_5 in options) { - if (ts.hasProperty(options, name_5)) { - switch (name_5) { + for (var name in options) { + if (ts.hasProperty(options, name)) { + switch (name) { case "init": case "watch": case "version": @@ -5506,12 +5600,12 @@ var ts; case "project": break; default: - var value = options[name_5]; - var optionDefinition = optionsNameMap[name_5.toLowerCase()]; + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { - result[name_5] = value; + result[name] = value; } else { if (optionDefinition.type === "list") { @@ -5520,10 +5614,10 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_5] = convertedValue; + result[name] = convertedValue; } else { - result[name_5] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -5730,8 +5824,8 @@ var ts; } var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; + var opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -5765,8 +5859,9 @@ var ts; } function convertJsonOptionOfCustomType(opt, value, errors) { var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + var val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -5800,7 +5895,7 @@ var ts; for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } if (include && include.length > 0) { @@ -5811,14 +5906,13 @@ var ts; } removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); return { fileNames: literalFiles.concat(wildcardFiles), wildcardDirectories: wildcardDirectories @@ -5826,8 +5920,8 @@ var ts; } function validateSpecs(specs, errors, allowTrailingRecursion) { var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } @@ -5846,7 +5940,7 @@ var ts; function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); + var wildcardDirectories = {}; if (include !== undefined) { var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { @@ -5867,14 +5961,16 @@ var ts; } } } - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } } } - } + ; } return wildcardDirectories; } @@ -5897,7 +5993,7 @@ var ts; for (var i = 0; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i]; var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -5909,13 +6005,9 @@ var ts; for (var i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i]; var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - function addFileToOutput(output, file) { - output.push(file); - return output; - } function caseSensitiveKeyMapper(key) { return key; } @@ -5951,7 +6043,7 @@ var ts; }); if (!safeList) { var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMap(result.config) : EmptySafeList; + safeList = result.config ? ts.createMapFromTemplate(result.config) : EmptySafeList; } var filesToWatch = []; var searchDirs = []; @@ -5976,31 +6068,31 @@ var ts; if (unresolvedImports) { for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { var moduleId = unresolvedImports_1[_a]; - var typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; + var typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); } } } - for (var name_6 in packageNameToTypingLocation) { - if (name_6 in inferredTypings && !inferredTypings[name_6]) { - inferredTypings[name_6] = packageNameToTypingLocation[name_6]; + packageNameToTypingLocation.forEach(function (typingLocation, name) { + if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { + inferredTypings.set(name, typingLocation); } - } + }); for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { var excludeTypingName = exclude_1[_b]; - delete inferredTypings[excludeTypingName]; + inferredTypings.delete(excludeTypingName); } var newTypingNames = []; var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); + inferredTypings.forEach(function (inferred, typing) { + if (inferred !== undefined) { + cachedTypingPaths.push(inferred); } else { newTypingNames.push(typing); } - } + }); return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; function mergeTypings(typingNames) { if (!typingNames) { @@ -6008,8 +6100,8 @@ var ts; } for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; + if (!inferredTypings.has(typing)) { + inferredTypings.set(typing, undefined); } } } @@ -6039,7 +6131,7 @@ var ts; var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); if (safeList !== EmptySafeList) { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return safeList.has(f); })); } var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; }); if (hasJsxFile) { @@ -6072,7 +6164,7 @@ var ts; } if (packageJson.typings) { var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; + inferredTypings.set(packageJson.name, absolutePath); } else { typingNames.push(packageJson.name); @@ -6347,9 +6439,10 @@ var ts; if (!moduleHasNonRelativeName(nonRelativeModuleName)) { return undefined; } - var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); if (!perModuleNameCache) { - moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); } return perModuleNameCache; } @@ -6369,12 +6462,12 @@ var ts; var commonPrefix = getCommonPrefix(path, resolvedFileName); var current = path; while (true) { - var parent_1 = ts.getDirectoryPath(current); - if (parent_1 === current || directoryPathMap.contains(parent_1)) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { break; } - directoryPathMap.set(parent_1, result); - current = parent_1; + directoryPathMap.set(parent, result); + current = parent; if (current == commonPrefix) { break; } @@ -6405,7 +6498,7 @@ var ts; } var containingDirectory = ts.getDirectoryPath(containingFile); var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); - var result = perFolderCache && perFolderCache[moduleName]; + var result = perFolderCache && perFolderCache.get(moduleName); if (result) { if (traceEnabled) { trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); @@ -6433,7 +6526,7 @@ var ts; break; } if (perFolderCache) { - perFolderCache[moduleName] = result; + perFolderCache.set(moduleName, result); var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); if (perModuleNameCache) { perModuleNameCache.set(containingDirectory, result); @@ -6946,7 +7039,7 @@ var ts; if (this.log.isEnabled()) { this.log.writeLine("Closing file watchers for project '" + projectName + "'"); } - var watchers = this.projectWatchers[projectName]; + var watchers = this.projectWatchers.get(projectName); if (!watchers) { if (this.log.isEnabled()) { this.log.writeLine("No watchers are registered for project '" + projectName + "'"); @@ -6957,7 +7050,7 @@ var ts; var w = watchers_1[_i]; w.close(); } - delete this.projectWatchers[projectName]; + this.projectWatchers.delete(projectName); if (this.log.isEnabled()) { this.log.writeLine("Closing file watchers for project '" + projectName + "' - done."); } @@ -6991,7 +7084,7 @@ var ts; if (this.log.isEnabled()) { this.log.writeLine("Processing cache location '" + cacheLocation + "'"); } - if (this.knownCachesSet[cacheLocation]) { + if (this.knownCachesSet.get(cacheLocation)) { if (this.log.isEnabled()) { this.log.writeLine("Cache location was already processed..."); } @@ -7014,10 +7107,10 @@ var ts; } var typingFile = typingToFileName(cacheLocation, packageName, this.installTypingHost, this.log); if (!typingFile) { - this.missingTypingsSet[packageName] = true; + this.missingTypingsSet.set(packageName, true); continue; } - var existingTypingFile = this.packageNameToTypingLocation[packageName]; + var existingTypingFile = this.packageNameToTypingLocation.get(packageName); if (existingTypingFile === typingFile) { continue; } @@ -7029,14 +7122,14 @@ var ts; if (this.log.isEnabled()) { this.log.writeLine("Adding entry into typings cache: '" + packageName + "' => '" + typingFile + "'"); } - this.packageNameToTypingLocation[packageName] = typingFile; + this.packageNameToTypingLocation.set(packageName, typingFile); } } } if (this.log.isEnabled()) { this.log.writeLine("Finished processing cache location '" + cacheLocation + "'"); } - this.knownCachesSet[cacheLocation] = true; + this.knownCachesSet.set(cacheLocation, true); }; TypingsInstaller.prototype.filterTypings = function (typingsToInstall) { if (typingsToInstall.length === 0) { @@ -7045,12 +7138,12 @@ var ts; var result = []; for (var _i = 0, typingsToInstall_1 = typingsToInstall; _i < typingsToInstall_1.length; _i++) { var typing = typingsToInstall_1[_i]; - if (this.missingTypingsSet[typing] || this.packageNameToTypingLocation[typing]) { + if (this.missingTypingsSet.get(typing) || this.packageNameToTypingLocation.get(typing)) { continue; } var validationResult = validatePackageName(typing); if (validationResult === PackageNameValidationResult.Ok) { - if (typing in this.typesRegistry) { + if (this.typesRegistry.has(typing)) { result.push(typing); } else { @@ -7060,7 +7153,7 @@ var ts; } } else { - this.missingTypingsSet[typing] = true; + this.missingTypingsSet.set(typing, true); if (this.log.isEnabled()) { switch (validationResult) { case PackageNameValidationResult.EmptyName: @@ -7106,8 +7199,7 @@ var ts; this.log.writeLine("Installing typings " + JSON.stringify(typingsToInstall)); } var filteredTypings = this.filterTypings(typingsToInstall); - var scopedTypings = filteredTypings.map(function (x) { return "@types/" + x; }); - if (scopedTypings.length === 0) { + if (filteredTypings.length === 0) { if (this.log.isEnabled()) { this.log.writeLine("All typings are known to be missing or invalid - no need to go any further"); } @@ -7122,6 +7214,7 @@ var ts; typingsInstallerVersion: ts.version, projectName: req.projectName }); + var scopedTypings = filteredTypings.map(typingsName); this.installTypingsAsync(requestId, scopedTypings, cachePath, function (ok) { try { if (!ok) { @@ -7130,7 +7223,7 @@ var ts; } for (var _i = 0, filteredTypings_1 = filteredTypings; _i < filteredTypings_1.length; _i++) { var typing = filteredTypings_1[_i]; - _this.missingTypingsSet[typing] = true; + _this.missingTypingsSet.set(typing, true); } return; } @@ -7142,11 +7235,11 @@ var ts; var packageName = filteredTypings_2[_a]; var typingFile = typingToFileName(cachePath, packageName, _this.installTypingHost, _this.log); if (!typingFile) { - _this.missingTypingsSet[packageName] = true; + _this.missingTypingsSet.set(packageName, true); continue; } - if (!_this.packageNameToTypingLocation[packageName]) { - _this.packageNameToTypingLocation[packageName] = typingFile; + if (!_this.packageNameToTypingLocation.has(packageName)) { + _this.packageNameToTypingLocation.set(packageName, typingFile); } installedTypingFiles.push(typingFile); } @@ -7197,7 +7290,7 @@ var ts; }, 2000); watchers.push(w); } - this.projectWatchers[projectName] = watchers; + this.projectWatchers.set(projectName, watchers); }; TypingsInstaller.prototype.createSetTypings = function (request, typings) { return { @@ -7215,7 +7308,7 @@ var ts; }; TypingsInstaller.prototype.executeWithThrottling = function () { var _this = this; - var _loop_2 = function () { + var _loop_3 = function () { this_1.inFlightRequestCount++; var request = this_1.pendingRunRequests.pop(); this_1.installWorker(request.requestId, request.args, request.cwd, function (ok) { @@ -7226,12 +7319,17 @@ var ts; }; var this_1 = this; while (this.inFlightRequestCount < this.throttleLimit && this.pendingRunRequests.length) { - _loop_2(); + _loop_3(); } }; return TypingsInstaller; }()); typingsInstaller.TypingsInstaller = TypingsInstaller; + function typingsName(packageName) { + return "@types/" + packageName + "@ts" + versionMajorMinor; + } + typingsInstaller.typingsName = typingsName; + var versionMajorMinor = ts.version.split(".").slice(0, 2).join("."); })(typingsInstaller = server.typingsInstaller || (server.typingsInstaller = {})); })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); @@ -7272,7 +7370,7 @@ var ts; } try { var content = JSON.parse(host.readFile(typesRegistryFilePath)); - return ts.createMap(content.entries); + return ts.createMapFromTemplate(content.entries); } catch (e) { if (log.isEnabled()) {